* include/ruby/ruby.h (RObject): add iv_index_tbl for shortcut of

RCLASS_IV_INDEX_TBL(rb_obj_class(obj)).
  (ROBJECT_IV_INDEX_TBL): defined.

* object.c (init_copy): initialize iv_index_tbl in struct RObject.

* variable.c (ivar_get): use ROBJECT_IV_INDEX_TBL.
  (rb_ivar_defined): ditto.
  (obj_ivar_each): ditto.
  (rb_obj_remove_instance_variable): ditto.
  (rb_ivar_set): update iv_index_tbl in struct RObject.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-02-13 11:52:46 +00:00
parent f09eb27660
commit 8f842d71e9
4 changed files with 56 additions and 26 deletions

View file

@ -398,6 +398,7 @@ struct RObject {
struct {
long len;
VALUE *ptr;
struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
} heap;
VALUE ary[ROBJECT_EMBED_LEN_MAX];
} as;
@ -411,6 +412,10 @@ struct RObject {
((RBASIC(o)->flags & ROBJECT_EMBED) ? \
ROBJECT(o)->as.ary : \
ROBJECT(o)->as.heap.ptr)
#define ROBJECT_IV_INDEX_TBL(o) \
((RBASIC(o)->flags & ROBJECT_EMBED) ? \
RCLASS_IV_INDEX_TBL(rb_obj_class(o)) : \
ROBJECT(o)->as.heap.iv_index_tbl)
struct RValues {
struct RBasic basic;