diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-11 10:36:17 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-11 10:36:17 +0000 |
commit | 0952b43b9be23688702368f6fcae3fde2dd69fb5 (patch) | |
tree | 6086aac025130e9f85eb74dc446d0336bfed545b /internal.h | |
parent | 5922c954614e5947a548780bb3b894626affe6dd (diff) | |
download | ruby-0952b43b9be23688702368f6fcae3fde2dd69fb5.tar.gz |
* include/ruby/ruby.h: introduce new type T_IMEMO.
T_IMEMO is Internal Memo type, internal use only.
T_IMEMO has same purpose of NODE_MEMO.
To insert T_IMEMO, type numbers are modified a little.
* internal.h: define struct RIMemo. Each RIMemo objects
has imemo_type. We can observe it by the imemo_type() function.
* gc.c (rb_imemo_new): added.
* node.h: remove NODE_CREF and NEW_CREF().
* node.c (rb_gc_mark_node): ditto.
* vm.c (vm_cref_new): use rb_imem_new().
* vm_eval.c: ditto.
* vm_eval.c (eval_string_with_cref):
* vm_eval.c (rb_type_str):
* vm_insnhelper.c: use RIMemo objects for CREF.
* ext/objspace/objspace.c: support T_IMEMO.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/internal.h b/internal.h index 372cf5daba..9172fb1892 100644 --- a/internal.h +++ b/internal.h @@ -513,15 +513,44 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super) RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super); return super; } +/* IMEMO: Internal memo object */ + +/* FL_USER0, FL_USER1, FL_USER2: type */ +#define FL_IMEMO_MARK_V0 FL_USER6 +#define FL_IMEMO_MARK_V1 FL_USER3 +#define FL_IMEMO_MARK_V2 FL_USER4 +#define FL_IMEMO_MARK_V3 FL_USER5 + +struct RIMemo { + VALUE flags; + VALUE v0; + VALUE v1; + VALUE v2; + VALUE v3; +}; + +enum imemo_type { + imemo_none, + imemo_cref, + imemo_mask = 0x07 +}; + +static inline enum imemo_type +imemo_type(VALUE imemo) +{ + return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask; +} + +VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0); /* CREF */ typedef struct rb_cref_struct { VALUE flags; - VALUE refinements; - VALUE klass; + const VALUE refinements; + const VALUE klass; VALUE visi; - struct rb_cref_struct *next; + struct rb_cref_struct * const next; } rb_cref_t; #define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15) |