1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Collapse if conditions to decrease indentation

in mjit_compile_send to clarify it's not that deeply branched.
This commit is contained in:
Takashi Kokubun 2020-04-06 00:45:42 -07:00
parent a7e7000387
commit f984975c4d
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -16,21 +16,20 @@
% # compiler: Use copied cc to avoid race condition
const struct rb_callcache *captured_cc = captured_cc_entries(status)[call_data_index(cd, body)];
%
if (!status->compile_info->disable_send_cache && has_valid_method_type(captured_cc)) {
const rb_iseq_t *iseq;
const CALL_INFO ci = cd->ci;
if (!status->compile_info->disable_send_cache && has_valid_method_type(captured_cc)
// CC_SET_FASTPATH in vm_callee_setup_arg
&& !(vm_ci_flag(ci) & VM_CALL_TAILCALL) // inlining non-tailcall path
&& vm_cc_cme(captured_cc)->def->type == VM_METHOD_TYPE_ISEQ
&& fastpath_applied_iseq_p(ci, captured_cc, iseq = def_iseq_ptr(vm_cc_cme(captured_cc)->def))) {
int param_size = iseq->body->param.size;
unsigned int argc = vm_ci_argc(ci); // this `argc` variable is for calculating a value's position on stack considering `blockarg`.
% if insn.name == 'send'
argc += ((vm_ci_flag(ci) & VM_CALL_ARGS_BLOCKARG) ? 1 : 0); // simulate `vm_caller_setup_arg_block`'s `--reg_cfp->sp`
% end
if (!(vm_ci_flag(ci) & VM_CALL_TAILCALL) // inlining non-tailcall path
&& vm_cc_cme(captured_cc)->def->type == VM_METHOD_TYPE_ISEQ
&& fastpath_applied_iseq_p(ci, captured_cc, iseq = def_iseq_ptr(vm_cc_cme(captured_cc)->def))) {
// CC_SET_FASTPATH in vm_callee_setup_arg
int param_size = iseq->body->param.size;
fprintf(f, "{\n");
% # JIT: Declare stack_size to be used in some macro of _mjit_compile_insn_body.erb
if (status->local_stack_p) {
@ -108,4 +107,3 @@
break;
}
}
}