Skip to content

Commit

Permalink
vm_call_alias: no call vm_cc_fill
Browse files Browse the repository at this point in the history
This changeset reduces the generated binary of vm_call_alias from 188
bytes to 149 bytes on my machine, accroding to nm(1).
  • Loading branch information
shyouhei committed Jun 9, 2020
1 parent 97f4563 commit 62b471b
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions vm_insnhelper.c
Expand Up @@ -2682,16 +2682,25 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me)
return cme;
}

#define VM_CC_ON_STACK(clazz, call, aux, cme) \
(struct rb_callcache) { \
.flags = T_IMEMO | \
(imemo_callcache << FL_USHIFT) | \
VM_CALLCACHE_UNMARKABLE, \
.klass = clazz, \
.cme_ = cme, \
.call_ = call, \
.aux_ = aux, \
}

static VALUE
vm_call_alias(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, struct rb_call_data *cd)
{
const rb_callable_method_entry_t *cme = aliased_callable_method_entry(vm_cc_cme(cd->cc));
struct rb_callcache cc_body;
struct rb_call_data cd_body = {
return vm_call_method_each_type(ec, cfp, calling, &(struct rb_call_data) {
.ci = cd->ci,
.cc = vm_cc_fill(&cc_body, Qundef, cme, 0),
};
return vm_call_method_each_type(ec, cfp, calling, &cd_body);
.cc = &VM_CC_ON_STACK(Qundef, vm_call_general, { 0 },
aliased_callable_method_entry(vm_cc_cme(cd->cc))),
});
}

static enum method_missing_reason
Expand Down

0 comments on commit 62b471b

Please sign in to comment.