ruby-changes:64828
From: Takashi <ko1@a...>
Date: Mon, 11 Jan 2021 16:43:37 +0900 (JST)
Subject: [ruby-changes:64828] 2a1c68c91e (master): Avoid re-entering opt_invokebuiltin_delegate_leave
https://git.ruby-lang.org/ruby.git/commit/?id=2a1c68c91e From 2a1c68c91efeba93c413d0736bc513179d784c50 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/