summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-01 13:52:31 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commitdbbde61cefdcdef9054dde2e799e1ff9df343575 (patch)
treeb4876af93c92fa087f0d1f8f02a92c3a3d26a2af
parent9c287f8caa1fdfc9820ab3f6b01fed252dff77b5 (diff)
vm_call_method_missing_body: on-stack call info
This changeset reduces the generated binary of vm_call_method_missing_body from 604 bytes to 532 bytes on my machine. Should reduce GC pressure as well.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3179
-rw-r--r--vm_insnhelper.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 6fb2e2b3f6..19898fb176 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2884,20 +2884,12 @@ vm_call_method_missing_body(rb_execution_context_t *ec, rb_control_frame_t *reg_
RB_DEBUG_COUNTER_INC(ccf_method_missing);
VALUE *argv = STACK_ADDR_FROM_TOP(calling->argc);
- struct rb_call_data cd;
unsigned int argc;
CALLER_SETUP_ARG(reg_cfp, calling, orig_ci);
argc = calling->argc + 1;
unsigned int flag = VM_CALL_FCALL | VM_CALL_OPT_SEND | (calling->kw_splat ? VM_CALL_KW_SPLAT : 0);
- cd.ci = vm_ci_new_runtime(idMethodMissing, flag, argc, vm_ci_kwarg(orig_ci));
- struct rb_callcache cc_body;
- cd.cc = vm_cc_fill(&cc_body,
- Qundef,
- rb_callable_method_entry_without_refinements(CLASS_OF(calling->recv), idMethodMissing, NULL),
- vm_call_general);
-
calling->argc = argc;
/* shift arguments: m(a, b, c) #=> method_missing(:m, a, b, c) */
@@ -2910,7 +2902,11 @@ vm_call_method_missing_body(rb_execution_context_t *ec, rb_control_frame_t *reg_
INC_SP(1);
ec->method_missing_reason = reason;
- return vm_call_method(ec, reg_cfp, calling, &cd);
+ return vm_call_method(ec, reg_cfp, calling, &(struct rb_call_data) {
+ .ci = &VM_CI_ON_STACK(idMethodMissing, flag, argc, vm_ci_kwarg(orig_ci)),
+ .cc = &VM_CC_ON_STACK(Qundef, vm_call_general, { 0 },
+ rb_callable_method_entry_without_refinements(CLASS_OF(calling->recv), idMethodMissing, NULL)),
+ });
}
static VALUE