From dbbde61cefdcdef9054dde2e799e1ff9df343575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 1 Jun 2020 13:52:31 +0900 Subject: 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. --- vm_insnhelper.c | 14 +++++--------- 1 file 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 -- cgit v1.2.3