[前][次][番号順一覧][スレッド一覧]

ruby-changes:57802

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 19 Sep 2019 12:20:28 +0900 (JST)
Subject: [ruby-changes:57802] 66c644da5e (master): refactor reuse existing on-stack structs

https://git.ruby-lang.org/ruby.git/commit/?id=66c644da5e

From 66c644da5e80258bb3217941223d923f923c3548 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: Thu, 19 Sep 2019 12:15:53 +0900
Subject: refactor reuse existing on-stack structs

rb_vm_call0 allocates its own struct call_info etc.  But they are
already there in case of rb_funcallv_with_cc.  Let's just pass the
existing ones, instead of re-creation.

diff --git a/vm_eval.c b/vm_eval.c
index 8bbbe7c..706301e 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -991,7 +991,18 @@ rb_funcallv_with_cc(struct rb_call_cache_and_mid *cc, VALUE recv, ID mid, int ar https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L991
         vm_search_method(&ci, &cc->cc, recv);
 
         if (LIKELY(! UNDEFINED_METHOD_ENTRY_P(cc->cc.me))) {
-            return rb_vm_call0(GET_EC(), recv, mid, argc, argv, cc->cc.me, VM_NO_KEYWORDS);
+            return vm_call0_body(
+                GET_EC(),
+                &(struct rb_calling_info) {
+                    Qundef,
+                    recv,
+                    argc,
+                    VM_NO_KEYWORDS,
+                },
+                &ci,
+                &cc->cc,
+                argv
+            );
         }
     }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]