summaryrefslogtreecommitdiff
path: root/yjit/src/codegen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'yjit/src/codegen.rs')
-rw-r--r--yjit/src/codegen.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index c6f766f0fa..ce4f87649a 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -1896,6 +1896,8 @@ pub const SEND_MAX_CHAIN_DEPTH: i32 = 20;
// up to 20 different offsets for case-when
pub const CASE_WHEN_MAX_DEPTH: i32 = 20;
+pub const MAX_SPLAT_LENGTH: i32 = 127;
+
// Codegen for setting an instance variable.
// Preconditions:
// - receiver is in REG0
@@ -5875,6 +5877,10 @@ fn gen_send_iseq(
// all the remaining arguments. In the generated code
// we test if this is true and if not side exit.
argc = argc - 1 + array_length as i32 + remaining_opt as i32;
+ if argc + asm.ctx.get_stack_size() as i32 > MAX_SPLAT_LENGTH {
+ gen_counter_incr!(asm, send_splat_too_long);
+ return None;
+ }
push_splat_args(array_length, asm);
for _ in 0..remaining_opt {