ruby-changes:61031
From: Takashi <ko1@a...>
Date: Thu, 7 May 2020 12:28:55 +0900 (JST)
Subject: [ruby-changes:61031] a5073c053f (master): Always correct sp on leave cancel
https://git.ruby-lang.org/ruby.git/commit/?id=a5073c053f From a5073c053fd2d5352d098a3747c49ae0cab6451c Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Wed, 6 May 2020 20:25:57 -0700 Subject: 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. diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index 500a4fc..019994e 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) { https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L74 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"); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/