1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-10-14 11:25:36 +00:00
parent f89fe59db4
commit 589d80e7e3
4 changed files with 10 additions and 15 deletions

View file

@ -108,11 +108,6 @@ comment_id(FILE *f, ID id)
#endif #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, static void compile_insns(FILE *f, const struct rb_iseq_constant_body *body, unsigned int stack_size,
unsigned int pos, struct compile_status *status); unsigned int pos, struct compile_status *status);

View file

@ -7,7 +7,7 @@
% # details. % # details.
% %
% # Optimized case of get_instancevariable instruction. % # 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` % # compiler: Prepare operands which may be used by `insn.call_attribute`
% insn.opes.each_with_index do |ope, i| % insn.opes.each_with_index do |ope, i|
@ -41,4 +41,4 @@
break; break;
} }
} }
#endif /* USE_IC_FOR_IVAR */ #endif /* OPT_IC_FOR_IVAR */

View file

@ -950,15 +950,11 @@ vm_search_const_defined_class(const VALUE cbase, ID id)
return 0; 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)); ALWAYS_INLINE(static VALUE vm_getivar(VALUE, ID, IC, struct rb_call_cache *, int));
static inline VALUE static inline VALUE
vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr) 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))) { if (LIKELY(RB_TYPE_P(obj, T_OBJECT))) {
VALUE val = Qundef; VALUE val = Qundef;
if (LIKELY(is_attr ? if (LIKELY(is_attr ?
@ -1000,7 +996,7 @@ vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
else { else {
RB_DEBUG_COUNTER_INC(ivar_get_ic_miss_noobject); 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); RB_DEBUG_COUNTER_INC(ivar_get_ic_miss);
if (is_attr) if (is_attr)
@ -1011,7 +1007,7 @@ vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
static inline VALUE static inline VALUE
vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_attr) 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); rb_check_frozen_internal(obj);
if (LIKELY(RB_TYPE_P(obj, T_OBJECT))) { if (LIKELY(RB_TYPE_P(obj, T_OBJECT))) {
@ -1051,7 +1047,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_
else { else {
RB_DEBUG_COUNTER_INC(ivar_set_ic_miss_noobject); 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); RB_DEBUG_COUNTER_INC(ivar_set_ic_miss);
return rb_ivar_set(obj, id, val); return rb_ivar_set(obj, id, val);
} }

View file

@ -50,6 +50,10 @@
#define OPT_GLOBAL_METHOD_CACHE 1 #define OPT_GLOBAL_METHOD_CACHE 1
#define OPT_BLOCKINLINING 0 #define OPT_BLOCKINLINING 0
#ifndef OPT_IC_FOR_IVAR
#define OPT_IC_FOR_IVAR 1
#endif
/* architecture independent, affects generated code */ /* architecture independent, affects generated code */
#define OPT_OPERANDS_UNIFICATION 1 #define OPT_OPERANDS_UNIFICATION 1
#define OPT_INSTRUCTIONS_UNIFICATION 0 #define OPT_INSTRUCTIONS_UNIFICATION 0