ruby-changes:61615
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 9 Jun 2020 09:53:13 +0900 (JST)
Subject: [ruby-changes:61615] 62b471bd44 (master): vm_call_alias: no call vm_cc_fill
https://git.ruby-lang.org/ruby.git/commit/?id=62b471bd44 From 62b471bd441c841e8dedc209512227722dd542e6 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:26:44 +0900 Subject: 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). diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e7e126b..53f2b33 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2682,16 +2682,25 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2682 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/