summaryrefslogtreecommitdiff
path: root/yjit/src/codegen.rs
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2025-01-04 11:41:00 -0500
committerAlan Wu <[email protected]>2025-01-04 12:53:20 -0500
commitc71addc5227f2f7a04db2b2fb4c14d464639f3f6 (patch)
treee5a1a9e656eabe0508a23c184cd156954036bb9a /yjit/src/codegen.rs
parent37356b713ceb0d159f946269c8479854ceb2acee (diff)
YJIT: Fix crash when yielding keyword arguments
Previously, the code for dropping surplus arguments when yielding into blocks erroneously attempted to drop keyword arguments when there is in fact no surplus arguments. Fix the condition and test that supplying the exact number of keyword arguments as require compiles without fallback.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12499
Diffstat (limited to 'yjit/src/codegen.rs')
-rw-r--r--yjit/src/codegen.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 37ddbce0bb..d04da48c6a 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -8011,14 +8011,14 @@ fn gen_send_iseq(
// Pop surplus positional arguments when yielding
if arg_setup_block {
- let extras = argc - required_num - opt_num;
+ let extras = argc - required_num - opt_num - kw_arg_num;
if extras > 0 {
// Checked earlier. If there are keyword args, then
// the positional arguments are not at the stack top.
assert_eq!(0, kw_arg_num);
asm.stack_pop(extras as usize);
- argc = required_num + opt_num;
+ argc = required_num + opt_num + kw_arg_num;
}
}