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

* insns.def: unify ic_constant_serial and ic_class_serial into one field

ic_serial. This is possible because these fields are only ever used
  exclusively with each other.

* insns.def: ditto
* vm_core.h: ditto
* vm_insnhelper.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2013-11-09 03:46:48 +00:00
parent 8b0771b014
commit 1546fb6c00
4 changed files with 17 additions and 8 deletions

View file

@ -1,3 +1,13 @@
Sat Nov 9 12:45:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* insns.def: unify ic_constant_serial and ic_class_serial into one field
ic_serial. This is possible because these fields are only ever used
exclusively with each other.
* insns.def: ditto
* vm_core.h: ditto
* vm_insnhelper.c: ditto
Sat Nov 9 12:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* class.c: unify names of vm state version counters to 'serial'.

View file

@ -1183,7 +1183,7 @@ getinlinecache
()
(VALUE val)
{
if (ic->ic_constant_serial == GET_CONSTANT_SERIAL()) {
if (ic->ic_serial == GET_CONSTANT_SERIAL()) {
val = ic->ic_value.value;
JUMP(dst);
}
@ -1208,7 +1208,7 @@ setinlinecache
rb_iseq_add_mark_object(GET_ISEQ(), val);
}
ic->ic_value.value = val;
ic->ic_constant_serial = GET_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
ic->ic_serial = GET_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
ruby_vm_const_missing_count = 0;
}

View file

@ -131,8 +131,7 @@ typedef struct rb_compile_option_struct rb_compile_option_t;
struct iseq_inline_cache_entry {
rb_serial_t ic_constant_serial;
rb_serial_t ic_class_serial;
rb_serial_t ic_serial;
union {
size_t index;
VALUE value;

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_serial == RCLASS_EXT(klass)->class_serial) ||
if (LIKELY((!is_attr && ic->ic_serial == RCLASS_EXT(klass)->class_serial) ||
(is_attr && ci->aux.index > 0))) {
long index = !is_attr ? (long)ic->ic_value.index : ci->aux.index - 1;
long len = ROBJECT_NUMIV(obj);
@ -533,7 +533,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr)
}
if (!is_attr) {
ic->ic_value.index = index;
ic->ic_class_serial = RCLASS_EXT(klass)->class_serial;
ic->ic_serial = RCLASS_EXT(klass)->class_serial;
}
else { /* call_info */
ci->aux.index = index + 1;
@ -565,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_serial == RCLASS_EXT(klass)->class_serial) ||
(!is_attr && ic->ic_serial == RCLASS_EXT(klass)->class_serial) ||
(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,7 +582,7 @@ 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_value.index = index;
ic->ic_class_serial = RCLASS_EXT(klass)->class_serial;
ic->ic_serial = RCLASS_EXT(klass)->class_serial;
}
else {
ci->aux.index = index + 1;