mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_getivar): check vm state version
to invalidate inline chache (ivar index). fixes Bug #4926. * vm_insnhelper.c (vm_setivar): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8ad06e2604
commit
2e4fb84f7c
2 changed files with 14 additions and 2 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.
|
||||||
|
|
||||||
Fri Jul 1 08:03:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 1 08:03:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* error.c, thread_pthread.c (WRITE_CONST): suppress warnings
|
* error.c, thread_pthread.c (WRITE_CONST): suppress warnings
|
||||||
|
|
|
@ -1265,7 +1265,8 @@ vm_getivar(VALUE obj, ID id, IC ic)
|
||||||
VALUE val = Qundef;
|
VALUE val = Qundef;
|
||||||
VALUE klass = RBASIC(obj)->klass;
|
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 index = ic->ic_value.index;
|
||||||
long len = ROBJECT_NUMIV(obj);
|
long len = ROBJECT_NUMIV(obj);
|
||||||
VALUE *ptr = ROBJECT_IVPTR(obj);
|
VALUE *ptr = ROBJECT_IVPTR(obj);
|
||||||
|
@ -1287,6 +1288,7 @@ vm_getivar(VALUE obj, ID id, IC ic)
|
||||||
}
|
}
|
||||||
ic->ic_class = klass;
|
ic->ic_class = klass;
|
||||||
ic->ic_value.index = index;
|
ic->ic_value.index = index;
|
||||||
|
ic->ic_vmstat = GET_VM_STATE_VERSION();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1320,8 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic)
|
||||||
VALUE klass = RBASIC(obj)->klass;
|
VALUE klass = RBASIC(obj)->klass;
|
||||||
st_data_t index;
|
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 index = ic->ic_value.index;
|
||||||
long len = ROBJECT_NUMIV(obj);
|
long len = ROBJECT_NUMIV(obj);
|
||||||
VALUE *ptr = ROBJECT_IVPTR(obj);
|
VALUE *ptr = ROBJECT_IVPTR(obj);
|
||||||
|
@ -1334,6 +1337,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)) {
|
if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
|
||||||
ic->ic_class = klass;
|
ic->ic_class = klass;
|
||||||
ic->ic_value.index = index;
|
ic->ic_value.index = index;
|
||||||
|
ic->ic_vmstat = GET_VM_STATE_VERSION();
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue