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
Родитель 5e00eeb4d4
Коммит 2a1c68c91e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6FFC433B12EE23DD
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -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
}