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

ruby-changes:69019

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:16 +0900 (JST)
Subject: [ruby-changes:69019] 0fb2926097 (master): Guard against implicitly forwarded block

https://git.ruby-lang.org/ruby.git/commit/?id=0fb2926097

From 0fb292609788efed17f482bf9b2474cfc0a7e2fb Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Wed, 9 Jun 2021 16:31:32 -0700
Subject: Guard against implicitly forwarded block

---
 yjit_codegen.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 01fe83d786..4a8cf6ff32 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -2967,6 +2967,20 @@ gen_invokesuper(jitstate_t *jit, ctx_t *ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L2967
     // Guard that the receiver has the same class as the one from compile time
     uint8_t *side_exit = yjit_side_exit(jit, ctx);
 
+    if (!block) {
+        // Guard no block passed
+        // rb_vm_frame_block_handler(GET_EC()->cfp) == VM_BLOCK_HANDLER_NONE
+        // note, we assume VM_ASSERT(VM_ENV_LOCAL_P(ep))
+        //
+        // TODO: this could properly forward the current block handler, but
+        // would require changes to gen_send_*
+        ADD_COMMENT(cb, "guard no block given");
+        mov(cb, REG0, member_opnd(REG_CFP, rb_control_frame_t, ep));
+        mov(cb, REG0, mem_opnd(64, REG0, SIZEOF_VALUE * VM_ENV_DATA_INDEX_SPECVAL));
+        cmp(cb, REG0, imm_opnd(VM_BLOCK_HANDLER_NONE));
+        jne_ptr(cb, side_exit);
+    }
+
     // Points to the receiver operand on the stack
     x86opnd_t recv = ctx_stack_opnd(ctx, argc);
     insn_opnd_t recv_opnd = OPND_STACK(argc);
-- 
cgit v1.2.1


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

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