diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 8 |
3 files changed, 15 insertions, 3 deletions
@@ -1,3 +1,11 @@ +Fri Jul 1 08:21:28 2011 Koichi Sasada <ko1@atdot.net> + + * vm_insnhelper.c (vm_getivar): check vm state version + to invalidate inline chache (ivar index). + fixes Bug #4926. + + * vm_insnhelper.c (vm_setivar): ditto. + Wed Feb 1 09:50:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * doc/re.rdoc (Repetition): fix typo. reported by Ori Avtalion @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 313 +#define RUBY_PATCHLEVEL 314 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index d760d17e96..59e979a57a 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1255,7 +1255,8 @@ vm_getivar(VALUE obj, ID id, IC ic) VALUE val = Qundef; VALUE klass = RBASIC(obj)->klass; - if (ic->ic_class == klass) { + if (LIKELY(ic->ic_class == klass && + ic->ic_vmstat == GET_VM_STATE_VERSION())) { long index = ic->ic_value.index; long len = ROBJECT_NUMIV(obj); VALUE *ptr = ROBJECT_IVPTR(obj); @@ -1277,6 +1278,7 @@ vm_getivar(VALUE obj, ID id, IC ic) } ic->ic_class = klass; ic->ic_value.index = index; + ic->ic_vmstat = GET_VM_STATE_VERSION(); } } } @@ -1309,7 +1311,8 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic) VALUE klass = RBASIC(obj)->klass; st_data_t index; - if (ic->ic_class == klass) { + if (LIKELY(ic->ic_class == klass && + ic->ic_vmstat == GET_VM_STATE_VERSION())) { long index = ic->ic_value.index; long len = ROBJECT_NUMIV(obj); VALUE *ptr = ROBJECT_IVPTR(obj); @@ -1325,6 +1328,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic) if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) { ic->ic_class = klass; ic->ic_value.index = index; + ic->ic_vmstat = GET_VM_STATE_VERSION(); } /* fall through */ } |