@@ -1053,7 +1053,7 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *
10531053 }
10541054}
10551055
1056- static void vm_adjust_stack_forwarding (const struct rb_execution_context_struct * ec , struct rb_control_frame_struct * cfp , CALL_INFO callers_info , VALUE splat );
1056+ static void vm_adjust_stack_forwarding (const struct rb_execution_context_struct * ec , struct rb_control_frame_struct * cfp , int argc , VALUE splat );
10571057
10581058static VALUE
10591059vm_caller_setup_fwd_args (const rb_execution_context_t * ec , rb_control_frame_t * reg_cfp ,
@@ -1066,13 +1066,20 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r
10661066 RUBY_ASSERT (ISEQ_BODY (ISEQ_BODY (GET_ISEQ ())-> local_iseq )-> param .flags .forwardable );
10671067 CALL_INFO caller_ci = (CALL_INFO )TOPN (0 );
10681068
1069- unsigned int forwarding_argc = vm_ci_argc (site_ci );
1069+ unsigned int site_argc = vm_ci_argc (site_ci );
1070+ unsigned int site_flag = vm_ci_flag (site_ci );
1071+ ID site_mid = vm_ci_mid (site_ci );
1072+
1073+ unsigned int caller_argc = vm_ci_argc (caller_ci );
1074+ unsigned int caller_flag = vm_ci_flag (caller_ci );
1075+ const struct rb_callinfo_kwarg * kw = vm_ci_kwarg (caller_ci );
1076+
10701077 VALUE splat = Qfalse ;
10711078
1072- if (vm_ci_flag ( site_ci ) & VM_CALL_ARGS_SPLAT ) {
1079+ if (site_flag & VM_CALL_ARGS_SPLAT ) {
10731080 // If we're called with args_splat, the top 1 should be an array
10741081 splat = TOPN (1 );
1075- forwarding_argc += (RARRAY_LEN (splat ) - 1 );
1082+ site_argc += (RARRAY_LEN (splat ) - 1 );
10761083 }
10771084
10781085 // Need to setup the block in case of e.g. `super { :block }`
@@ -1083,13 +1090,13 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r
10831090 bh = VM_ENV_BLOCK_HANDLER (GET_LEP ());
10841091 }
10851092
1086- vm_adjust_stack_forwarding (ec , GET_CFP (), caller_ci , splat );
1093+ vm_adjust_stack_forwarding (ec , GET_CFP (), caller_argc , splat );
10871094
10881095 * adjusted_ci = VM_CI_ON_STACK (
1089- vm_ci_mid ( site_ci ) ,
1090- (vm_ci_flag ( caller_ci ) | (vm_ci_flag ( site_ci ) & (VM_CALL_FCALL | VM_CALL_FORWARDING ))),
1091- forwarding_argc + vm_ci_argc ( caller_ci ) ,
1092- vm_ci_kwarg ( caller_ci )
1096+ site_mid ,
1097+ (caller_flag | (site_flag & (VM_CALL_FCALL | VM_CALL_FORWARDING ))),
1098+ site_argc + caller_argc ,
1099+ kw
10931100 );
10941101
10951102 adjusted_cd -> cd .ci = adjusted_ci ;
0 commit comments