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

ruby-changes:52862

From: k0kubun <ko1@a...>
Date: Sun, 14 Oct 2018 20:25:41 +0900 (JST)
Subject: [ruby-changes:52862] k0kubun:r65074 (trunk): vm_opts.h: share USE_IC_FOR_IVAR as OPT_IC_FOR_IVAR

k0kubun	2018-10-14 20:25:36 +0900 (Sun, 14 Oct 2018)

  New Revision: 65074

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65074

  Log:
    vm_opts.h: share USE_IC_FOR_IVAR as OPT_IC_FOR_IVAR
    
    with mjit_compile.c (tool/ruby_vm/views/_mjit_compile_getivar.erb).
    
    mjit_compile.c: ditto
    tool/ruby_vm/views/_mjit_compile_getivar.erb: ditto
    vm_opts.h: ditto

  Modified files:
    trunk/mjit_compile.c
    trunk/tool/ruby_vm/views/_mjit_compile_getivar.erb
    trunk/vm_insnhelper.c
    trunk/vm_opts.h
Index: vm_opts.h
===================================================================
--- vm_opts.h	(revision 65073)
+++ vm_opts.h	(revision 65074)
@@ -50,6 +50,10 @@ https://github.com/ruby/ruby/blob/trunk/vm_opts.h#L50
 #define OPT_GLOBAL_METHOD_CACHE      1
 #define OPT_BLOCKINLINING            0
 
+#ifndef OPT_IC_FOR_IVAR
+#define OPT_IC_FOR_IVAR 1
+#endif
+
 /* architecture independent, affects generated code */
 #define OPT_OPERANDS_UNIFICATION     1
 #define OPT_INSTRUCTIONS_UNIFICATION 0
Index: mjit_compile.c
===================================================================
--- mjit_compile.c	(revision 65073)
+++ mjit_compile.c	(revision 65074)
@@ -108,11 +108,6 @@ comment_id(FILE *f, ID id) https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L108
 #endif
 }
 
-/* TODO: share this with vm_insnhelper.c */
-#ifndef USE_IC_FOR_IVAR
-#define USE_IC_FOR_IVAR 1
-#endif
-
 static void compile_insns(FILE *f, const struct rb_iseq_constant_body *body, unsigned int stack_size,
                           unsigned int pos, struct compile_status *status);
 
Index: tool/ruby_vm/views/_mjit_compile_getivar.erb
===================================================================
--- tool/ruby_vm/views/_mjit_compile_getivar.erb	(revision 65073)
+++ tool/ruby_vm/views/_mjit_compile_getivar.erb	(revision 65074)
@@ -7,7 +7,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_getivar.erb#L7
 % # details.
 %
 % # Optimized case of get_instancevariable instruction.
-#if USE_IC_FOR_IVAR
+#if OPT_IC_FOR_IVAR
 {
 % # compiler: Prepare operands which may be used by `insn.call_attribute`
 % insn.opes.each_with_index do |ope, i|
@@ -41,4 +41,4 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_getivar.erb#L41
         break;
     }
 }
-#endif	/* USE_IC_FOR_IVAR */
+#endif /* OPT_IC_FOR_IVAR */
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 65073)
+++ vm_insnhelper.c	(revision 65074)
@@ -950,15 +950,11 @@ vm_search_const_defined_class(const VALU https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L950
     return 0;
 }
 
-#ifndef USE_IC_FOR_IVAR
-#define USE_IC_FOR_IVAR 1
-#endif
-
 ALWAYS_INLINE(static VALUE vm_getivar(VALUE, ID, IC, struct rb_call_cache *, int));
 static inline VALUE
 vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
 {
-#if USE_IC_FOR_IVAR
+#if OPT_IC_FOR_IVAR
     if (LIKELY(RB_TYPE_P(obj, T_OBJECT))) {
 	VALUE val = Qundef;
         if (LIKELY(is_attr ?
@@ -1000,7 +996,7 @@ vm_getivar(VALUE obj, ID id, IC ic, stru https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L996
     else {
 	RB_DEBUG_COUNTER_INC(ivar_get_ic_miss_noobject);
     }
-#endif	/* USE_IC_FOR_IVAR */
+#endif /* OPT_IC_FOR_IVAR */
     RB_DEBUG_COUNTER_INC(ivar_get_ic_miss);
 
     if (is_attr)
@@ -1011,7 +1007,7 @@ vm_getivar(VALUE obj, ID id, IC ic, stru https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1007
 static inline VALUE
 vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_attr)
 {
-#if USE_IC_FOR_IVAR
+#if OPT_IC_FOR_IVAR
     rb_check_frozen_internal(obj);
 
     if (LIKELY(RB_TYPE_P(obj, T_OBJECT))) {
@@ -1051,7 +1047,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1047
     else {
 	RB_DEBUG_COUNTER_INC(ivar_set_ic_miss_noobject);
     }
-#endif	/* USE_IC_FOR_IVAR */
+#endif /* OPT_IC_FOR_IVAR */
     RB_DEBUG_COUNTER_INC(ivar_set_ic_miss);
     return rb_ivar_set(obj, id, val);
 }

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

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