diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2023-12-11 17:37:39 -0500 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2023-12-11 19:21:08 -0500 |
| commit | 47553094740ee17f2490fcb29893cac653c0b5dd (patch) | |
| tree | ed84cfc552b7698a12cb466b0566e354be24d35f | |
| parent | 9765ada69c34eb1c21855d145c2c6d752b8839b0 (diff) | |
YJIT: Rename helper function and correct counter name
Counter::guard_send_iseq_has_rest_and_splat_not_equal was using
jump-if-lesser-than, so wasn't checking for equality. Rename function
because moving is destructive in Rust, which is confusing for this function
which doesn't modify the array.
| -rw-r--r-- | yjit/src/codegen.rs | 14 | ||||
| -rw-r--r-- | yjit/src/stats.rs | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 42a52432c3..a3bbb95cd8 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -5720,15 +5720,15 @@ fn get_array_ptr(asm: &mut Assembler, array_reg: Opnd) -> Opnd { } /// Pushes arguments from an array to the stack. Differs from push splat because -/// the array can have items left over. -fn move_rest_args_to_stack(array: Opnd, num_args: u32, asm: &mut Assembler) { - asm_comment!(asm, "move_rest_args_to_stack"); +/// the array can have items left over. Array is assumed to be T_ARRAY without guards. +fn copy_splat_args_for_rest_callee(array: Opnd, num_args: u32, asm: &mut Assembler) { + asm_comment!(asm, "copy_splat_args_for_rest_callee"); let array_len_opnd = get_array_len(asm, array); - asm_comment!(asm, "Side exit if length is less than required"); + asm_comment!(asm, "guard splat array large enough"); asm.cmp(array_len_opnd, num_args.into()); - asm.jl(Target::side_exit(Counter::guard_send_iseq_has_rest_and_splat_not_equal)); + asm.jl(Target::side_exit(Counter::guard_send_iseq_has_rest_and_splat_too_few)); // Unused operands cause the backend to panic if num_args == 0 { @@ -6364,8 +6364,8 @@ fn gen_send_iseq( let diff: u32 = (required_num - non_rest_arg_count + opts_filled) .try_into().unwrap(); - // This moves the arguments onto the stack. But it doesn't modify the array. - move_rest_args_to_stack(array, diff, asm); + // Copy required arguments to the stack without modifying the array + copy_splat_args_for_rest_callee(array, diff, asm); // We will now slice the array to give us a new array of the correct size let sliced = asm.ccall(rb_yjit_rb_ary_subseq_length as *const u8, vec![array, Opnd::UImm(diff as u64)]); diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 769e2d78e2..ac247d2fa8 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -404,7 +404,7 @@ make_counters! { guard_send_send_chain, guard_send_send_chain_not_string, guard_send_send_chain_not_sym, - guard_send_iseq_has_rest_and_splat_not_equal, + guard_send_iseq_has_rest_and_splat_too_few, guard_send_is_a_class_mismatch, guard_send_instance_of_class_mismatch, guard_send_interrupted, |
