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

ruby-changes:62088

From: Nobuyoshi <ko1@a...>
Date: Tue, 30 Jun 2020 19:32:58 +0900 (JST)
Subject: [ruby-changes:62088] 52ef2477e4 (master): Extracted METHOD_ENTRY_CACHEABLE macro

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

From 52ef2477e41caed01a4edc2f667306740d9b589c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 3 Jun 2020 08:31:00 +0900
Subject: Extracted METHOD_ENTRY_CACHEABLE macro


diff --git a/method.h b/method.h
index cd59963..6bc494f 100644
--- a/method.h
+++ b/method.h
@@ -75,6 +75,7 @@ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_e https://github.com/ruby/ruby/blob/trunk/method.h#L75
 #define METHOD_ENTRY_CACHED_SET(me)          ((me)->flags |= IMEMO_FL_USER4)
 #define METHOD_ENTRY_INVALIDATED(me)         ((me)->flags & IMEMO_FL_USER5)
 #define METHOD_ENTRY_INVALIDATED_SET(me)     ((me)->flags |= IMEMO_FL_USER5)
+#define METHOD_ENTRY_CACHEABLE(me)           !(METHOD_ENTRY_VISI(me) == METHOD_VISI_PROTECTED)
 
 static inline void
 METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 294099b..cacddc2 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2240,12 +2240,12 @@ vm_callee_setup_arg(rb_execution_context_t *ec, struct rb_calling_info *calling, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2240
             if (LIKELY(!(vm_ci_flag(ci) & VM_CALL_TAILCALL))) {
                 CC_SET_FASTPATH(cc, vm_call_iseq_setup_normal_opt_start,
                                 !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) &&
-                                !(METHOD_ENTRY_VISI(vm_cc_cme(cc)) == METHOD_VISI_PROTECTED));
+                                METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc)));
             }
             else {
                 CC_SET_FASTPATH(cc, vm_call_iseq_setup_tailcall_opt_start,
                                 !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) &&
-                                !(METHOD_ENTRY_VISI(vm_cc_cme(cc)) == METHOD_VISI_PROTECTED));
+                                METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc)));
             }
 
             /* initialize opt vars for self-references */
@@ -2273,7 +2273,7 @@ vm_callee_setup_arg(rb_execution_context_t *ec, struct rb_calling_info *calling, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2273
                     args_setup_kw_parameters(ec, iseq, ci_kws, ci_kw_len, ci_keywords, klocals);
 
                     CC_SET_FASTPATH(cc, vm_call_iseq_setup_kwparm_kwarg,
-                                    !(METHOD_ENTRY_VISI(vm_cc_cme(cc)) == METHOD_VISI_PROTECTED));
+                                    METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc)));
 
                     return 0;
                 }
@@ -2286,7 +2286,7 @@ vm_callee_setup_arg(rb_execution_context_t *ec, struct rb_calling_info *calling, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2286
                 if (klocals[kw_param->num] == INT2FIX(0)) {
                     /* copy from default_values */
                     CC_SET_FASTPATH(cc, vm_call_iseq_setup_kwparm_nokwarg,
-                                    !(METHOD_ENTRY_VISI(vm_cc_cme(cc)) == METHOD_VISI_PROTECTED));
+                                    METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc)));
                 }
 
                 return 0;
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 936778f..53099b2 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -254,7 +254,7 @@ static bool https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L254
 vm_call_iseq_optimizable_p(const struct rb_callinfo *ci, const struct rb_callcache *cc)
 {
     return !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) &&
-        !(METHOD_ENTRY_VISI(vm_cc_cme(cc)) == METHOD_VISI_PROTECTED);
+        METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc));
 }
 
 #endif /* RUBY_INSNHELPER_H */
-- 
cgit v0.10.2


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

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