ruby-changes:61614
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 9 Jun 2020 09:53:12 +0900 (JST)
Subject: [ruby-changes:61614] 9c287f8caa (master): vm_call_symbol: on-stack call info
https://git.ruby-lang.org/ruby.git/commit/?id=9c287f8caa From 9c287f8caa1fdfc9820ab3f6b01fed252dff77b5 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:43:47 +0900 Subject: 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. diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 53f2b33..6fb2e2b 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2682,6 +2682,17 @@ 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_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( https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2782 } 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)), }); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/