summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 14:03:48 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 14:03:48 +0000
commite4eb6e33428b91c417169d5273e63af9063837c6 (patch)
tree448b96e040afde08b432b50c00df05285c06ee4f
parent5f9f9013dab9923e714a40a9e0b76961914d5eba (diff)
vm_insnhelper.c: finish reverting r63333
That optimization is already reverted and we're not retrying the optimization soon. Let me simplify the code of vm_getivar. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--vm_insnhelper.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index f0da52dbcb..475514d1f0 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -955,28 +955,24 @@ vm_search_const_defined_class(const VALUE cbase, ID id)
#endif
/* `index` argument is used in MJIT to inline index value of call cache */
-ALWAYS_INLINE(static VALUE vm_getivar(VALUE, ID, IC, struct rb_call_cache *, st_index_t, int));
+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, st_index_t index, 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 (LIKELY(RB_TYPE_P(obj, T_OBJECT))) {
VALUE val = Qundef;
- if (LIKELY(index > 0 || is_attr ?
+ if (LIKELY(is_attr ?
RB_DEBUG_COUNTER_INC_UNLESS(ivar_get_ic_miss_unset, cc->aux.index > 0) :
RB_DEBUG_COUNTER_INC_UNLESS(ivar_get_ic_miss_serial,
ic->ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass)))) {
- if (index == 0) {
- index = !is_attr ? ic->ic_value.index : (cc->aux.index - 1);
- }
- else {
- index--; /* MJIT passes `cc->aux.index` as `index`. This will be `cc->aux.index - 1` */
- }
+ st_index_t index = !is_attr ? ic->ic_value.index : (cc->aux.index - 1);
if (LIKELY(index < ROBJECT_NUMIV(obj))) {
val = ROBJECT_IVPTR(obj)[index];
}
}
else {
+ st_data_t index;
struct st_table *iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
if (iv_index_tbl) {
@@ -1064,7 +1060,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_
static inline VALUE
vm_getinstancevariable(VALUE obj, ID id, IC ic)
{
- return vm_getivar(obj, id, ic, NULL, 0, FALSE);
+ return vm_getivar(obj, id, ic, NULL, FALSE);
}
static inline void
@@ -1948,7 +1944,7 @@ static VALUE
vm_call_ivar(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
{
cfp->sp -= 1;
- return vm_getivar(calling->recv, cc->me->def->body.attr.id, NULL, cc, 0, TRUE);
+ return vm_getivar(calling->recv, cc->me->def->body.attr.id, NULL, cc, TRUE);
}
static VALUE