summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-12-15 18:10:28 -0500
committerGitHub <noreply@github.com>2022-12-15 18:10:28 -0500
commit14158f1f8c50069f076f99e08405c5006ca65df9 (patch)
tree8dcaed95be4b77d17619b20fe36c258c05bb2202 /yjit
parente9ba3042e13313944fd2695731d0d7498532b80f (diff)
YJIT: Fix `obj.send(:call)`
All the method call types need to handle argument shifting in case they're called by `.send`, and we weren't handling that in `OPTIMIZED_METHOD_TYPE_CALL`. Lack of shifting caused the stack size assertion in gen_leave() to fail. Discovered by Rails CI: https://buildkite.com/rails/rails/builds/91705#018516c4-f8f8-469e-bc2d-ddeb25ca8317/1920-2067 Diagnosed with help from `@eileencodes` and `@k0kubun`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6943 Merged-By: XrXr
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index abd9eae2de..e12a29240d 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -5938,6 +5938,11 @@ fn gen_send_general(
return CantCompile;
}
+ // If this is a .send call we need to adjust the stack
+ if flags & VM_CALL_OPT_SEND != 0 {
+ handle_opt_send_shift_stack(asm, argc as i32, ctx);
+ }
+
// About to reset the SP, need to load this here
let recv_load = asm.load(recv);
@@ -6309,7 +6314,7 @@ fn gen_leave(
ocb: &mut OutlinedCb,
) -> CodegenStatus {
// Only the return value should be on the stack
- assert!(ctx.get_stack_size() == 1);
+ assert_eq!(1, ctx.get_stack_size());
// Create a side-exit to fall back to the interpreter
let side_exit = get_side_exit(jit, ocb, ctx);