Skip to content

Commit

Permalink
use T_ARRAY type info in the context from splatarray
Browse files Browse the repository at this point in the history
  • Loading branch information
XrXr committed Feb 27, 2024
1 parent ee21650 commit ac3849b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion yjit.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ rb_yjit_ruby2_keywords_splat_p(VALUE obj)
VALUE
rb_yjit_splat_varg_checks(VALUE *sp, VALUE splat_array, rb_control_frame_t *cfp)
{
if (!RB_TYPE_P(splat_array, T_ARRAY)) return Qfalse;
// We inserted a T_ARRAY guard before this call
long len = RARRAY_LEN(splat_array);

// Large splat arrays need a separate allocation
Expand Down
4 changes: 3 additions & 1 deletion yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6217,9 +6217,11 @@ fn gen_send_cfunc(

// Guard for variable length splat call before any modifications to the stack
if variable_splat {
let splat_array = asm.stack_opnd(i32::from(kw_splat) + i32::from(block_arg));
guard_object_is_array(asm, splat_array, splat_array.into(), Counter::guard_send_splat_not_array);

asm_comment!(asm, "guard variable length splat call servicable");
let sp = asm.ctx.sp_opnd(0);
let splat_array = asm.stack_opnd(i32::from(kw_splat) + i32::from(block_arg));
let proceed = asm.ccall(rb_yjit_splat_varg_checks as _, vec![sp, splat_array, CFP]);
asm.cmp(proceed, Qfalse.into());
asm.je(Target::side_exit(Counter::guard_send_cfunc_bad_splat_vargs));
Expand Down

0 comments on commit ac3849b

Please sign in to comment.