ruby-changes:58039
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 30 Sep 2019 11:03:22 +0900 (JST)
Subject: [ruby-changes:58039] fba8627dc1 (master): delete unnecessary branch
https://git.ruby-lang.org/ruby.git/commit/?id=fba8627dc1 From fba8627dc1c5b191713edeb5fc21cbe0ddde9e3c 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, 26 Sep 2019 13:44:51 +0900 Subject: delete unnecessary branch At last, not only myself but also your compiler are fully confident that the method entries pointed from call caches are immutable. We don't have to worry about silent updates. Just delete the branch that is now always false. Calculating ------------------------------------- ours trunk vm2_poly_same_method 2.142M 2.070M i/s - 6.000M times in 2.801148s 2.898994s Comparison: vm2_poly_same_method ours: 2141979.2 i/s trunk: 2069683.8 i/s - 1.03x slower diff --git a/insns.def b/insns.def index f365106..e3edc5e 100644 --- a/insns.def +++ b/insns.def @@ -911,7 +911,7 @@ invokeblock https://github.com/ruby/ruby/blob/trunk/insns.def#L911 // attr rb_snum_t sp_inc = sp_inc_of_invokeblock(ci); { static struct rb_call_cache cc = { - 0, 0, NULL, NULL, vm_invokeblock_i, + 0, 0, NULL, vm_invokeblock_i, }; VALUE bh = VM_BLOCK_HANDLER_NONE; diff --git a/internal.h b/internal.h index 2346703..dee7775 100644 --- a/internal.h +++ b/internal.h @@ -2330,7 +2330,6 @@ enum method_missing_reason { https://github.com/ruby/ruby/blob/trunk/internal.h#L2330 MISSING_NONE = 0x40 }; struct rb_callable_method_entry_struct; -struct rb_method_definition_struct; struct rb_execution_context_struct; struct rb_control_frame_struct; struct rb_calling_info; @@ -2342,7 +2341,6 @@ struct rb_call_cache { https://github.com/ruby/ruby/blob/trunk/internal.h#L2341 /* inline cache: values */ const struct rb_callable_method_entry_struct *me; - const struct rb_method_definition_struct *def; VALUE (*call)(struct rb_execution_context_struct *ec, struct rb_control_frame_struct *cfp, diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 197e100..545fba2 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1386,9 +1386,6 @@ calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1386 else if (LIKELY(cc->me != me)) { return vm_call_general; /* normal cases */ } - 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. @@ -1411,7 +1408,6 @@ 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#L1408 GET_GLOBAL_METHOD_STATE(), RCLASS_SERIAL(klass), me, - me ? me->def : NULL, 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/