@@ -1058,7 +1058,7 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *
10581058 }
10591059}
10601060
1061- 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 );
1061+ static void vm_adjust_stack_forwarding (const struct rb_execution_context_struct * ec , struct rb_control_frame_struct * cfp , int argc , VALUE splat );
10621062
10631063static VALUE
10641064vm_caller_setup_fwd_args (const rb_execution_context_t * ec , rb_control_frame_t * reg_cfp ,
@@ -1071,13 +1071,20 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r
10711071 RUBY_ASSERT (ISEQ_BODY (ISEQ_BODY (GET_ISEQ ())-> local_iseq )-> param .flags .forwardable );
10721072 CALL_INFO caller_ci = (CALL_INFO )TOPN (0 );
10731073
1074- unsigned int forwarding_argc = vm_ci_argc (site_ci );
1074+ unsigned int site_argc = vm_ci_argc (site_ci );
1075+ unsigned int site_flag = vm_ci_flag (site_ci );
1076+ ID site_mid = vm_ci_mid (site_ci );
1077+
1078+ unsigned int caller_argc = vm_ci_argc (caller_ci );
1079+ unsigned int caller_flag = vm_ci_flag (caller_ci );
1080+ const struct rb_callinfo_kwarg * kw = vm_ci_kwarg (caller_ci );
1081+
10751082 VALUE splat = Qfalse ;
10761083
1077- if (vm_ci_flag ( site_ci ) & VM_CALL_ARGS_SPLAT ) {
1084+ if (site_flag & VM_CALL_ARGS_SPLAT ) {
10781085 // If we're called with args_splat, the top 1 should be an array
10791086 splat = TOPN (1 );
1080- forwarding_argc += (RARRAY_LEN (splat ) - 1 );
1087+ site_argc += (RARRAY_LEN (splat ) - 1 );
10811088 }
10821089
10831090 // Need to setup the block in case of e.g. `super { :block }`
@@ -1088,13 +1095,13 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r
10881095 bh = VM_ENV_BLOCK_HANDLER (GET_LEP ());
10891096 }
10901097
1091- vm_adjust_stack_forwarding (ec , GET_CFP (), caller_ci , splat );
1098+ vm_adjust_stack_forwarding (ec , GET_CFP (), caller_argc , splat );
10921099
10931100 * adjusted_ci = VM_CI_ON_STACK (
1094- vm_ci_mid ( site_ci ) ,
1095- (vm_ci_flag ( caller_ci ) | (vm_ci_flag ( site_ci ) & (VM_CALL_FCALL | VM_CALL_FORWARDING ))),
1096- forwarding_argc + vm_ci_argc ( caller_ci ) ,
1097- vm_ci_kwarg ( caller_ci )
1101+ site_mid ,
1102+ (caller_flag | (site_flag & (VM_CALL_FCALL | VM_CALL_FORWARDING ))),
1103+ site_argc + caller_argc ,
1104+ kw
10981105 );
10991106
11001107 adjusted_cd -> cd .ci = adjusted_ci ;
0 commit comments