diff options
| -rw-r--r-- | bootstraptest/test_yjit.rb | 11 | ||||
| -rw-r--r-- | yjit/src/codegen.rs | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 786d2cc7dd..d5427588e0 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -4527,3 +4527,14 @@ assert_equal '[1, 2]', %q{ arr = [1] foo(*arr, 2) } + +# pop before fallback +assert_normal_exit %q{ + class Foo + attr_reader :foo + + def try = foo(0, &nil) + end + + Foo.new.try +} diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index d7de29c5d3..4eaeebd503 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -7516,6 +7516,10 @@ fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>( return None; } + // Rewind stack_size using ctx.with_stack_size to allow stack_size changes + // before you return None. + asm.ctx = asm.ctx.with_stack_size(jit.stack_size_for_pc); + // Save PC and SP to prepare for dynamic dispatch jit_prepare_non_leaf_call(jit, asm); |
