From 00ecff9f7858c1039089525ea5154d0a4e785860 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 20 Oct 2018 10:20:49 +0000 Subject: revert r65213 and r65215 as we didn't agree on the actual implementation yet git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 20361b3a23..3f09991ba2 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -976,21 +976,13 @@ vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr) if (index < ROBJECT_NUMIV(obj)) { val = ROBJECT_IVPTR(obj)[index]; } - if (!is_attr) { /* getinstancevariable */ - if (ic->ic_serial == RUBY_VM_CLASS_SERIAL_UNSET) { - /* set ic_serial only for the first time */ - ic->ic_value.index = index; - ic->ic_serial = RCLASS_SERIAL(RBASIC(obj)->klass); - } - else if (ic->ic_serial != RUBY_VM_CLASS_SERIAL_INVALID) { - /* never use cache for another class, to avoid race condition with MJIT worker - and to reduce the number of JIT cancellations by code generated for IC hit. */ - ic->ic_serial = RUBY_VM_CLASS_SERIAL_INVALID; - } - } - else { /* call_info */ - cc->aux.index = (int)index + 1; - } + if (!is_attr) { + ic->ic_value.index = index; + ic->ic_serial = RCLASS_SERIAL(RBASIC(obj)->klass); + } + else { /* call_info */ + cc->aux.index = (int)index + 1; + } } } } @@ -1039,18 +1031,10 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_ struct st_table *iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj); if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) { - if (!is_attr) { /* setinstancevariable */ - if (ic->ic_serial == RUBY_VM_CLASS_SERIAL_UNSET) { - /* set ic_serial only for the first time */ - ic->ic_value.index = index; - ic->ic_serial = RCLASS_SERIAL(klass); - } - else if (ic->ic_serial != RUBY_VM_CLASS_SERIAL_INVALID) { - /* never use cache for another class, to avoid race condition with MJIT worker - and to reduce the number of JIT cancellations by code generated for IC hit. */ - ic->ic_serial = RUBY_VM_CLASS_SERIAL_INVALID; - } - } + if (!is_attr) { + ic->ic_value.index = index; + ic->ic_serial = RCLASS_SERIAL(klass); + } else if (index >= INT_MAX) { rb_raise(rb_eArgError, "too many instance variables"); } -- cgit v1.2.3