summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-20 05:10:07 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-20 05:10:07 +0000
commit3409690957ae57822ef18189c006068476c035ff (patch)
treea120872626eaeeb748c18c1b2b07e0dc642253db /internal.h
parent41c42afddab5173c281fd1b6a8af2f522c540cc8 (diff)
ruby.h: swap iv_index_tbl and super for struct RClass
* include/ruby/ruby.h (struct RClass): add super, remove iv_index_tbl. since RCLASS_SUPER() is commonly used inside while loops, we move it back inside struct RClass to improve cache hits. this provides a small improvement (1%) in hotspots like rb_obj_is_kind_of() * internal.h (struct rb_classext_struct): remove super, add iv_index_table * internal.h (RCLASS_SUPER): update for new location * internal.h (RCLASS_SET_SUPER): ditto * internal.h (RCLASS_IV_INDEX_TBL): ditto * object.c (rb_class_get_superclass): ditto * include/ruby/backward/classext.h (RCLASS_SUPER): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal.h b/internal.h
index d01f6cf6ec..338929ba8b 100644
--- a/internal.h
+++ b/internal.h
@@ -262,7 +262,7 @@ typedef unsigned long rb_serial_t;
#endif
struct rb_classext_struct {
- VALUE super;
+ struct st_table *iv_index_tbl;
struct st_table *iv_tbl;
struct st_table *const_tbl;
rb_subclass_entry_t *subclasses;
@@ -293,7 +293,7 @@ void rb_class_remove_from_super_subclasses(VALUE);
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
#define RCLASS_M_TBL_WRAPPER(c) (RCLASS(c)->m_tbl_wrapper)
#define RCLASS_M_TBL(c) (RCLASS_M_TBL_WRAPPER(c) ? RCLASS_M_TBL_WRAPPER(c)->tbl : 0)
-#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
+#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
#define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
@@ -312,7 +312,7 @@ RCLASS_M_TBL_INIT(VALUE c)
static inline VALUE
RCLASS_SUPER(VALUE klass)
{
- return RCLASS_EXT(klass)->super;
+ return RCLASS(klass)->super;
}
static inline VALUE
@@ -322,7 +322,7 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
rb_class_remove_from_super_subclasses(klass);
rb_class_subclass_add(super, klass);
}
- OBJ_WRITE(klass, &RCLASS_EXT(klass)->super, super);
+ OBJ_WRITE(klass, &RCLASS(klass)->super, super);
return super;
}