ruby-changes:61616
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 9 Jun 2020 09:53:14 +0900 (JST)
Subject: [ruby-changes:61616] dbbde61cef (master): vm_call_method_missing_body: on-stack call info
https://git.ruby-lang.org/ruby.git/commit/?id=dbbde61cef 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?= <shyouhei@r...> 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. diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6fb2e2b..19898fb 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_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2884 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_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2902 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 v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/