OBJECT Object::get_ivar(STATE, OBJECT sym) {
- OBJECT val;
- LookupTable* tbl;
-
/* Implements the external ivars table for objects that don't
have their own space for ivars. */
if(!reference_p()) {
@@ -436,19 +433,16 @@ namespace rubinius {
return Qnil;
}
- /* It's a tuple, use csm */
- if(Tuple* tup = try_as<Tuple>(((NormalObject*)this)->instance_variables)) {
- return Hash::csm_find(state, tup, sym);
- }
-
- tbl = try_as<LookupTable>(((NormalObject*)this)->instance_variables);
+ OBJECT ivars = ((NormalObject*)this)->instance_variables;
- /* No table, no ivar! */
- if(!tbl) return Qnil;
+ /* It's a CompactLookupTable */
+ if(CompactLookupTable* tbl = try_as<CompactLookupTable>(ivars)) {
+ return tbl->fetch(state, sym);
+ } else if(LookupTable* tbl = try_as<LookupTable>(ivars)) {
+ if(tbl) return tbl->fetch(state, sym);
+ }
- /* It's a normal hash, no problem. */
- val = tbl->fetch(state, sym);
- return val;
+ return Qnil;
}