From 7eea96c7803138776bf2bc3f26a42bdb39ccca8c Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 5 Oct 2021 16:07:57 -0400 Subject: [PATCH] Fix gen_getclassvariable We need to reconstruct interpreter state before calling into the routines to be able to raise exceptions. I'm getting a crash in debug build with: make test-all 'TESTS=test/ruby/variable.rb' RUN_OPTS='--yjit-call-threshold=1 --yjit-max-versions=1' --- yjit_codegen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yjit_codegen.c b/yjit_codegen.c index 80270e64d4..1dcd26843d 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -4119,6 +4119,9 @@ rb_vm_get_cref(const VALUE *ep); static codegen_status_t gen_getclassvariable(jitstate_t* jit, ctx_t* ctx, codeblock_t* cb) { + // rb_vm_getclassvariable can raise exceptions. + jit_prepare_routine_call(jit, ctx, REG0); + mov(cb, C_ARG_REGS[0], member_opnd(REG_CFP, rb_control_frame_t, ep)); call_ptr(cb, REG0, (void *)rb_vm_get_cref);