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
This commit is contained in:
parent
41c42afdda
commit
3409690957
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
Fri Dec 20 14:00:01 2013 Aman Gupta <ruby@tmm1.net>
|
||||
|
||||
* 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
|
||||
|
||||
Fri Dec 20 07:07:35 2013 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rubygems: Update to RubyGems master 03d6ae7. Changes include:
|
||||
|
@ -13,6 +13,6 @@ typedef struct rb_deprecated_classext_struct {
|
||||
|
||||
#undef RCLASS_SUPER(c)
|
||||
#define RCLASS_EXT(c) ((rb_deprecated_classext_t *)RCLASS(c)->ptr)
|
||||
#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super)
|
||||
#define RCLASS_SUPER(c) (RCLASS(c)->super)
|
||||
|
||||
#endif /* RUBY_BACKWARD_CLASSEXT_H */
|
||||
|
@ -789,9 +789,9 @@ typedef struct rb_classext_struct rb_classext_t;
|
||||
|
||||
struct RClass {
|
||||
struct RBasic basic;
|
||||
VALUE super;
|
||||
rb_classext_t *ptr;
|
||||
struct method_table_wrapper *m_tbl_wrapper;
|
||||
struct st_table *iv_index_tbl;
|
||||
};
|
||||
#define RCLASS_SUPER(c) rb_class_get_superclass(c)
|
||||
#define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user