diff --git a/ChangeLog b/ChangeLog index 0bababfd87..6ecf2bc0e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sun Sep 13 02:08:43 2009 Koichi Sasada + + * vm_core.h: change members of iseq_inline_cache_entry. + make cache value members to one union member "ic_value". + + * insns.def: ditto. + + * vm_insnhelper.c: ditto. + Sun Sep 13 01:15:49 2009 Tanaka Akira * lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling. diff --git a/insns.def b/insns.def index 4acbcef1cb..3b52527e2e 100644 --- a/insns.def +++ b/insns.def @@ -1174,7 +1174,7 @@ getinlinecache (VALUE val) { if (ic->ic_vmstat == GET_VM_STATE_VERSION()) { - val = ic->ic_value; + val = ic->ic_value.value; JUMP(dst); } else { @@ -1195,12 +1195,12 @@ onceinlinecache (VALUE val) { if (ic->ic_vmstat) { - val = ic->ic_value; + val = ic->ic_value.value; JUMP(dst); } else { /* none */ - ic->ic_value = Qundef; + ic->ic_value.value = Qundef; val = Qnil; } } @@ -1218,10 +1218,10 @@ setinlinecache { IC ic = GET_CONST_INLINE_CACHE(dst); - if (ic->ic_value == Qundef) { + if (ic->ic_value.value == Qundef) { rb_ary_push(GET_ISEQ()->mark_ary, val); } - ic->ic_value = val; + ic->ic_value.value = val; ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count; ruby_vm_const_missing_count = 0; } diff --git a/vm_core.h b/vm_core.h index 9728e98a6b..6c7624193a 100644 --- a/vm_core.h +++ b/vm_core.h @@ -112,9 +112,11 @@ typedef struct rb_compile_option_struct { struct iseq_inline_cache_entry { long ic_vmstat; VALUE ic_class; - VALUE ic_value; - rb_method_entry_t *ic_method; -#define ic_index ic_vmstat + union { + VALUE value; + rb_method_entry_t *method; + long index; + } ic_value; }; #if 1 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index b00b2464dd..3020756d6c 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1196,7 +1196,7 @@ vm_getivar(VALUE obj, ID id, IC ic) VALUE klass = RBASIC(obj)->klass; if (ic->ic_class == klass) { - long index = ic->ic_index; + long index = ic->ic_value.index; long len = ROBJECT_NUMIV(obj); VALUE *ptr = ROBJECT_IVPTR(obj); @@ -1216,7 +1216,7 @@ vm_getivar(VALUE obj, ID id, IC ic) val = ptr[index]; } ic->ic_class = klass; - ic->ic_index = index; + ic->ic_value.index = index; } } } @@ -1250,7 +1250,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, IC ic) st_data_t index; if (ic->ic_class == klass) { - long index = ic->ic_index; + long index = ic->ic_value.index; long len = ROBJECT_NUMIV(obj); VALUE *ptr = ROBJECT_IVPTR(obj); @@ -1264,7 +1264,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_index = index; + ic->ic_value.index = index; } /* fall through */ } @@ -1282,12 +1282,12 @@ vm_method_search(VALUE id, VALUE klass, IC ic) #if OPT_INLINE_METHOD_CACHE if (LIKELY(klass == ic->ic_class) && LIKELY(GET_VM_STATE_VERSION() == ic->ic_vmstat)) { - me = ic->ic_method; + me = ic->ic_value.method; } else { me = rb_method_entry(klass, id); ic->ic_class = klass; - ic->ic_method = me; + ic->ic_value.method = me; ic->ic_vmstat = GET_VM_STATE_VERSION(); } #else