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

ruby-changes:57806

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 19 Sep 2019 15:18:34 +0900 (JST)
Subject: [ruby-changes:57806] fcfe36b733 (master): fix spec failure

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

From fcfe36b7332a29fd6835ba65984448477acc5bcc 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 10:37:30 +0900
Subject: fix spec failure

See also https://travis-ci.org/ruby/ruby/jobs/586452224

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 66c50cd..bea8d10 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1380,7 +1380,7 @@ __attribute__((__artificial__)) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1380
 #endif
 #endif
 static inline vm_call_handler
-calccall(const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
+calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
 {
     if (UNLIKELY(!me)) {
         return vm_call_general; /* vm_call_method_nome() situation */
@@ -1391,6 +1391,14 @@ calccall(const struct rb_call_cache *cc, const rb_callable_method_entry_t *me) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1391
     else if (UNLIKELY(cc->def != me->def)) {
         return vm_call_general;  /* cc->me was refined elsewhere */
     }
+    /* "Calling a formerly-public method, which is now privatised, with an
+     * explicit receiver" is the only situation we have to check here.  A
+     * formerly-private method now publicised is an absolutely safe thing.
+     * Calling a private method without specifying a receiver is also safe. */
+    else if ((METHOD_ENTRY_VISI(cc->me) != METHOD_VISI_PUBLIC) &&
+             !(ci->flag & VM_CALL_FCALL)) {
+        return vm_call_general;
+    }
     else {
         return cc->call;
     }
@@ -1406,7 +1414,7 @@ rb_vm_search_method_slowpath(const struct rb_call_info *ci, struct rb_call_cache https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1414
         RCLASS_SERIAL(klass),
         me,
         me ? me->def : NULL,
-        calccall(cc, me),
+        calccall(ci, cc, me),
     };
     VM_ASSERT(callable_method_entry_p(cc->me));
 }
-- 
cgit v0.10.2


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

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