summaryrefslogtreecommitdiff
path: root/yjit_codegen.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-10-05 16:07:57 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:42 -0400
commit7eea96c7803138776bf2bc3f26a42bdb39ccca8c (patch)
tree8d7f7f3aa539a4d8fb7c33b23177e6bf76d4de17 /yjit_codegen.c
parent70c5bbf84b569d293c0162c084c99d2ca609d9be (diff)
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'
Diffstat (limited to 'yjit_codegen.c')
-rw-r--r--yjit_codegen.c3
1 files changed, 3 insertions, 0 deletions
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);