summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-05-06 20:25:57 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-05-06 20:26:03 -0700
commita5073c053fd2d5352d098a3747c49ae0cab6451c (patch)
treef6ccdb7c151d3d2e67f20f71dffe911a36487bfa /tool/ruby_vm
parent0244f91e89eb0c3067bb4e15558ecd9e02c49c42 (diff)
Always correct sp on leave cancel
Even if local stack optimization is not used and values are written to VM stack, the stack pointer itself may not be moved properly. So this should be always moved on JIT cancellation. By the way it's hard to write a test for this because if we try to generate an interrupt, it will be a method call and it consumes the interrupt by itself on popping a frame.
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/views/mjit_compile.inc.erb4
1 files changed, 1 insertions, 3 deletions
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb
index 500a4fcf2c..019994e2dc 100644
--- a/tool/ruby_vm/views/mjit_compile.inc.erb
+++ b/tool/ruby_vm/views/mjit_compile.inc.erb
@@ -74,9 +74,7 @@ switch (insn) {
if (status->inlined_iseqs != NULL) { // the current ISeq is NOT being inlined
% # Cancel on interrupts to make leave insn leaf
fprintf(f, " if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {\n");
- if (status->local_stack_p) {
- fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size);
- }
+ 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, " goto cancel;\n");
fprintf(f, " }\n");