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

ruby-changes:64879

From: Takashi <ko1@a...>
Date: Thu, 14 Jan 2021 11:22:11 +0900 (JST)
Subject: [ruby-changes:64879] 303533d23c (ruby_3_0): Avoid re-entering opt_invokebuiltin_delegate_leave

https://git.ruby-lang.org/ruby.git/commit/?id=303533d23c

From 303533d23c5f566c0277c86c83f826c5e52f0c1a Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 11 Jan 2021 07:40:37 +0000
Subject: Avoid re-entering opt_invokebuiltin_delegate_leave

on interruption.

The cancellation code was originally written for leave insn, but re-entering
opt_invokebuiltin_delegate_leave insn on a cancellation is not safe, because
a builtin function is executed twice.

diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb
index 937cb4a..5820f81 100644
--- a/tool/ruby_vm/views/mjit_compile.inc.erb
+++ b/tool/ruby_vm/views/mjit_compile.inc.erb
@@ -84,8 +84,7 @@ switch (insn) { https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L84
         fprintf(f, "    if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {\n");
         fprintf(f, "        reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size);
         fprintf(f, "        reg_cfp->pc = original_body_iseq + %d;\n", pos);
-        fprintf(f, "        RB_DEBUG_COUNTER_INC(mjit_cancel_leave);\n");
-        fprintf(f, "        goto cancel;\n");
+        fprintf(f, "        rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);\n");
         fprintf(f, "    }\n");
         fprintf(f, "    ec->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(reg_cfp);\n"); // vm_pop_frame
     }
-- 
cgit v0.10.2


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

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