summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-01 13:43:47 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commit9c287f8caa1fdfc9820ab3f6b01fed252dff77b5 (patch)
treecf9fcb2e7837ea47b08c933f0de97ddb78d5dc52 /vm_insnhelper.c
parent62b471bd441c841e8dedc209512227722dd542e6 (diff)
vm_call_symbol: on-stack call info
This changeset reduces the generated binary of vm_call_symbol from 808 bytes to 798 bytes on my machine. Should reduce GC pressure as well.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3179
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 53f2b332aa..6fb2e2b3f6 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2682,6 +2682,17 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me)
return cme;
}
+#define VM_CI_ON_STACK(mid_, flags_, argc_, kwarg_) \
+ (struct rb_callinfo) { \
+ .flags = T_IMEMO | \
+ (imemo_callinfo << FL_USHIFT) | \
+ VM_CALLINFO_NOT_UNDER_GC, \
+ .mid = mid_, \
+ .flag = flags_, \
+ .argc = argc_, \
+ .kwarg = kwarg_, \
+ }
+
#define VM_CC_ON_STACK(clazz, call, aux, cme) \
(struct rb_callcache) { \
.flags = T_IMEMO | \
@@ -2771,14 +2782,11 @@ vm_call_symbol(
}
return vm_call_method(ec, reg_cfp, calling, &(struct rb_call_data) {
- .ci = vm_ci_new_runtime(mid, flags, argc, vm_ci_kwarg(ci)),
- .cc = &(struct rb_callcache) {
- .flags = T_IMEMO | (imemo_callcache << FL_USHIFT) | VM_CALLCACHE_UNMARKABLE,
- .klass = klass,
- .cme_ = rb_callable_method_entry_with_refinements(klass, mid, NULL),
- .call_ = 0,
- .aux_.method_missing_reason = missing_reason,
- },
+ .ci = &VM_CI_ON_STACK(mid, flags, argc, vm_ci_kwarg(ci)),
+ .cc = &VM_CC_ON_STACK(klass, vm_call_general, {
+ .method_missing_reason = missing_reason
+ },
+ rb_callable_method_entry_with_refinements(klass, mid, NULL)),
});
}