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
parent 5e00eeb4d4
commit 2a1c68c91e
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

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
}