summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-01 13:26:44 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commit62b471bd441c841e8dedc209512227722dd542e6 (patch)
tree902a414eee89f82827a137e47331d98faf206df7 /vm_insnhelper.c
parent97f456374d73a8510ecfce44f3ed3b775e57f3a0 (diff)
vm_call_alias: no call vm_cc_fill
This changeset reduces the generated binary of vm_call_alias from 188 bytes to 149 bytes on my machine, accroding to nm(1).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3179
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index e7e126b2e7..53f2b332aa 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -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