1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Takashi Kokubun 2021-01-11 07:40:37 +00:00 committed by NARUSE, Yui
parent 98ca667b98
commit 303533d23c

View file

@ -84,8 +84,7 @@ switch (insn) {
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
}