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

* vm_insnhelper.c (vm_getivar): use class sequence to check class

identity, instead of pointer + vm state

* vm_insnhelper.c (vm_setivar): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2013-09-05 01:44:36 +00:00
parent b1b395911c
commit ed0e42c30b
2 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,10 @@
Thu Sep 5 10:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* vm_insnhelper.c (vm_getivar): use class sequence to check class
identity, instead of pointer + vm state
* vm_insnhelper.c (vm_setivar): ditto
Thu Sep 5 08:20:58 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (GMP_DIV_DIGITS): New macro.

View file

@ -510,7 +510,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr)
VALUE val = Qundef;
VALUE klass = RBASIC(obj)->klass;
if (LIKELY((!is_attr && (ic->ic_class == klass && ic->ic_vmstat == GET_VM_STATE_VERSION())) ||
if (LIKELY((!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
(is_attr && ci->aux.index > 0))) {
long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index - 1;
long len = ROBJECT_NUMIV(obj);
@ -532,9 +532,8 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr)
val = ptr[index];
}
if (!is_attr) {
ic->ic_class = klass;
ic->ic_value.index = index;
ic->ic_vmstat = GET_VM_STATE_VERSION();
ic->ic_seq = RCLASS_EXT(klass)->seq;
}
else { /* call_info */
ci->aux.index = index + 1;
@ -566,7 +565,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, rb_call_info_t *ci, int is_attr)
st_data_t index;
if (LIKELY(
(!is_attr && ic->ic_class == klass && ic->ic_vmstat == GET_VM_STATE_VERSION()) ||
(!is_attr && ic->ic_seq == RCLASS_EXT(klass)->seq) ||
(is_attr && ci->aux.index > 0))) {
long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index-1;
long len = ROBJECT_NUMIV(obj);
@ -582,9 +581,8 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic, rb_call_info_t *ci, int is_attr)
if (iv_index_tbl && st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
if (!is_attr) {
ic->ic_class = klass;
ic->ic_value.index = index;
ic->ic_vmstat = GET_VM_STATE_VERSION();
ic->ic_seq = RCLASS_EXT(klass)->seq;
}
else {
ci->aux.index = index + 1;