mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/intern.h: export rb_ivar_foreach.
* include/ruby/ruby.h: modify struct RObject and RClass for optimizing T_OBJECT space. [ruby-dev:31853] (ROBJECT_LEN, ROBJECT_PTR) (RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RCLASS_IV_INDEX_TBL) (RMODULE_IV_TBL, RMODULE_M_TBL, RMODULE_SUPER): abstract accessor defined. * variable.c: support the modified RObject and RClass. * object.c: ditto. * class.c: ditto. * gc.c: ditto. * marshal.c: ditto. * eval_method.ci: use the abstract accessor. * insns.def: ditto. * proc.c: ditto. * struct.c: ditto. * eval.c: ditto. * error.c: ditto. * vm.c: ditto. * insnhelper.ci: ditto. * ext/digest/digest.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
041fbcbf50
commit
5c0e68c39c
17 changed files with 448 additions and 193 deletions
|
@ -402,10 +402,26 @@ struct RBasic {
|
|||
VALUE klass;
|
||||
};
|
||||
|
||||
#define ROBJECT_EMBED_LEN_MAX 3
|
||||
struct RObject {
|
||||
struct RBasic basic;
|
||||
struct st_table *iv_tbl;
|
||||
union {
|
||||
struct {
|
||||
long len;
|
||||
VALUE *ptr;
|
||||
} heap;
|
||||
VALUE ary[ROBJECT_EMBED_LEN_MAX];
|
||||
} as;
|
||||
};
|
||||
#define ROBJECT_EMBED FL_USER1
|
||||
#define ROBJECT_LEN(o) \
|
||||
((RBASIC(o)->flags & ROBJECT_EMBED) ? \
|
||||
ROBJECT_EMBED_LEN_MAX : \
|
||||
ROBJECT(o)->as.heap.len)
|
||||
#define ROBJECT_PTR(o) \
|
||||
((RBASIC(o)->flags & ROBJECT_EMBED) ? \
|
||||
ROBJECT(o)->as.ary : \
|
||||
ROBJECT(o)->as.heap.ptr)
|
||||
|
||||
struct RValues {
|
||||
struct RBasic basic;
|
||||
|
@ -414,12 +430,24 @@ struct RValues {
|
|||
VALUE v3;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct st_table *iv_tbl;
|
||||
VALUE super;
|
||||
} rb_classext_t;
|
||||
|
||||
struct RClass {
|
||||
struct RBasic basic;
|
||||
struct st_table *iv_tbl;
|
||||
rb_classext_t *ptr;
|
||||
struct st_table *m_tbl;
|
||||
VALUE super;
|
||||
struct st_table *iv_index_tbl;
|
||||
};
|
||||
#define RCLASS_IV_TBL(c) (RCLASS(c)->ptr->iv_tbl)
|
||||
#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
||||
#define RCLASS_SUPER(c) (RCLASS(c)->ptr->super)
|
||||
#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
|
||||
#define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
|
||||
#define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
|
||||
#define RMODULE_SUPER(m) RCLASS_SUPER(m)
|
||||
|
||||
struct RFloat {
|
||||
struct RBasic basic;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue