Skip to content

Commit a645057

Browse files
committed
Refactor so we don't have _cd
This should make the diff more clean
1 parent 86d7cca commit a645057

3 files changed

Lines changed: 33 additions & 47 deletions

File tree

insns.def

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -889,15 +889,13 @@ sendforward
889889
struct rb_forwarding_call_data adjusted_cd;
890890
struct rb_callinfo adjusted_ci;
891891

892-
CALL_DATA _cd = cd;
892+
VALUE bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), cd, blockiseq, 0, &adjusted_cd, &adjusted_ci);
893893

894-
VALUE bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), &cd, blockiseq, 0, &adjusted_cd, &adjusted_ci);
895-
896-
val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_method);
894+
val = vm_sendish(ec, GET_CFP(), &adjusted_cd.cd, bh, mexp_search_method);
897895
JIT_EXEC(ec, val);
898896

899-
if (_cd->cc != cd->cc && vm_cc_markable(cd->cc)) {
900-
RB_OBJ_WRITE(GET_ISEQ(), &_cd->cc, cd->cc);
897+
if (cd->cc != adjusted_cd.cd.cc && vm_cc_markable(adjusted_cd.cd.cc)) {
898+
RB_OBJ_WRITE(GET_ISEQ(), &cd->cc, adjusted_cd.cd.cc);
901899
}
902900

903901
if (UNDEF_P(val)) {
@@ -1042,17 +1040,16 @@ invokesuperforward
10421040
// attr rb_snum_t sp_inc = sp_inc_of_sendish(cd->ci);
10431041
// attr rb_snum_t comptime_sp_inc = sp_inc_of_sendish(ci);
10441042
{
1045-
CALL_DATA _cd = cd;
10461043
struct rb_forwarding_call_data adjusted_cd;
10471044
struct rb_callinfo adjusted_ci;
10481045

1049-
VALUE bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), &cd, blockiseq, 1, &adjusted_cd, &adjusted_ci);
1046+
VALUE bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), cd, blockiseq, 1, &adjusted_cd, &adjusted_ci);
10501047

1051-
val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_super);
1048+
val = vm_sendish(ec, GET_CFP(), &adjusted_cd.cd, bh, mexp_search_super);
10521049
JIT_EXEC(ec, val);
10531050

1054-
if (_cd->cc != cd->cc && vm_cc_markable(cd->cc)) {
1055-
RB_OBJ_WRITE(GET_ISEQ(), &_cd->cc, cd->cc);
1051+
if (cd->cc != adjusted_cd.cd.cc && vm_cc_markable(adjusted_cd.cd.cc)) {
1052+
RB_OBJ_WRITE(GET_ISEQ(), &cd->cc, adjusted_cd.cd.cc);
10561053
}
10571054

10581055
if (UNDEF_P(val)) {

vm_args.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,10 @@ static void vm_adjust_stack_forwarding(const struct rb_execution_context_struct
10571057

10581058
static VALUE
10591059
vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
1060-
CALL_DATA *cd, const rb_iseq_t *blockiseq, const int is_super,
1060+
CALL_DATA cd, const rb_iseq_t *blockiseq, const int is_super,
10611061
struct rb_forwarding_call_data *adjusted_cd, struct rb_callinfo *adjusted_ci)
10621062
{
1063-
CALL_INFO site_ci = (*cd)->ci;
1063+
CALL_INFO site_ci = cd->ci;
10641064
VALUE bh = Qundef;
10651065

10661066
RUBY_ASSERT(ISEQ_BODY(ISEQ_BODY(GET_ISEQ())->local_iseq)->param.flags.forwardable);
@@ -1093,17 +1093,8 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r
10931093
);
10941094

10951095
adjusted_cd->cd.ci = adjusted_ci;
1096-
adjusted_cd->cd.cc = (*cd)->cc;
1096+
adjusted_cd->cd.cc = cd->cc;
10971097
adjusted_cd->caller_ci = caller_ci;
10981098

1099-
*cd = &adjusted_cd->cd;
1100-
11011099
return bh;
11021100
}
1103-
1104-
static VALUE
1105-
vm_caller_setup_args(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
1106-
CALL_DATA *cd, const rb_iseq_t *blockiseq, const int is_super)
1107-
{
1108-
return vm_caller_setup_arg_block(ec, GET_CFP(), (*cd)->ci, blockiseq, is_super);
1109-
}

vm_insnhelper.c

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5927,23 +5927,22 @@ rb_vm_send(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, CALL_DATA cd
59275927

59285928
struct rb_forwarding_call_data adjusted_cd;
59295929
struct rb_callinfo adjusted_ci;
5930-
CALL_DATA _cd = cd;
59315930

59325931
VALUE bh;
5932+
VALUE val;
59335933

5934-
if (vm_ci_flag(_cd->ci) & VM_CALL_FORWARDING) {
5935-
bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), &cd, blockiseq, false, &adjusted_cd, &adjusted_ci);
5936-
}
5937-
else {
5938-
bh = vm_caller_setup_args(ec, GET_CFP(), &cd, blockiseq, false);
5939-
}
5934+
if (vm_ci_flag(cd->ci) & VM_CALL_FORWARDING) {
5935+
bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), cd, blockiseq, false, &adjusted_cd, &adjusted_ci);
59405936

5941-
VALUE val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_method);
5937+
val = vm_sendish(ec, GET_CFP(), &adjusted_cd.cd, bh, mexp_search_method);
59425938

5943-
if (vm_ci_flag(_cd->ci) & VM_CALL_FORWARDING) {
5944-
if (_cd->cc != cd->cc && vm_cc_markable(cd->cc)) {
5945-
RB_OBJ_WRITE(GET_ISEQ(), &_cd->cc, cd->cc);
5946-
}
5939+
if (cd->cc != adjusted_cd.cd.cc && vm_cc_markable(adjusted_cd.cd.cc)) {
5940+
RB_OBJ_WRITE(GET_ISEQ(), &cd->cc, adjusted_cd.cd.cc);
5941+
}
5942+
}
5943+
else {
5944+
bh = vm_caller_setup_arg_block(ec, GET_CFP(), cd->ci, blockiseq, false);
5945+
val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_method);
59475946
}
59485947

59495948
VM_EXEC(ec, val);
@@ -5966,23 +5965,22 @@ rb_vm_invokesuper(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, CALL_
59665965
stack_check(ec);
59675966
struct rb_forwarding_call_data adjusted_cd;
59685967
struct rb_callinfo adjusted_ci;
5969-
CALL_DATA _cd = cd;
59705968

59715969
VALUE bh;
5970+
VALUE val;
59725971

5973-
if (vm_ci_flag(_cd->ci) & VM_CALL_FORWARDING) {
5974-
bh = vm_caller_setup_fwd_args(ec, GET_CFP(), &cd, blockiseq, true, &adjusted_cd, &adjusted_ci);
5975-
}
5976-
else {
5977-
bh = vm_caller_setup_args(ec, GET_CFP(), &cd, blockiseq, true);
5978-
}
5972+
if (vm_ci_flag(cd->ci) & VM_CALL_FORWARDING) {
5973+
bh = vm_caller_setup_fwd_args(GET_EC(), GET_CFP(), cd, blockiseq, true, &adjusted_cd, &adjusted_ci);
59795974

5980-
VALUE val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_super);
5975+
val = vm_sendish(ec, GET_CFP(), &adjusted_cd.cd, bh, mexp_search_super);
59815976

5982-
if (vm_ci_flag(_cd->ci) & VM_CALL_FORWARDING) {
5983-
if (_cd->cc != cd->cc && vm_cc_markable(cd->cc)) {
5984-
RB_OBJ_WRITE(GET_ISEQ(), &_cd->cc, cd->cc);
5985-
}
5977+
if (cd->cc != adjusted_cd.cd.cc && vm_cc_markable(adjusted_cd.cd.cc)) {
5978+
RB_OBJ_WRITE(GET_ISEQ(), &cd->cc, adjusted_cd.cd.cc);
5979+
}
5980+
}
5981+
else {
5982+
bh = vm_caller_setup_arg_block(ec, GET_CFP(), cd->ci, blockiseq, true);
5983+
val = vm_sendish(ec, GET_CFP(), cd, bh, mexp_search_super);
59865984
}
59875985

59885986
VM_EXEC(ec, val);

0 commit comments

Comments
 (0)