[前][次][番号順一覧][スレッド一覧]

ruby-changes:69263

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:24:24 +0900 (JST)
Subject: [ruby-changes:69263] 7eea96c780 (master): Fix gen_getclassvariable

https://git.ruby-lang.org/ruby.git/commit/?id=7eea96c780

From 7eea96c7803138776bf2bc3f26a42bdb39ccca8c Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Tue, 5 Oct 2021 16:07:57 -0400
Subject: 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); https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L4119
 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);
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]