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 /vm_insnhelper.c | |
parent | 5922c954614e5947a548780bb3b894626affe6dd (diff) |
* 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 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index f5f5634d09..b2481834de 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -163,7 +163,7 @@ lep_svar_get(rb_thread_t *th, const VALUE *lep, rb_num_t key) const struct SVAR *const svar = *svar_place; if (NIL_P((VALUE)svar)) return Qnil; - if (nd_type(svar) == NODE_CREF) return Qnil; + if (RB_TYPE_P((VALUE)svar, T_IMEMO) && imemo_type((VALUE)svar) == imemo_cref) return Qnil; switch (key) { case VM_SVAR_LASTLINE: @@ -193,7 +193,7 @@ lep_svar_set(rb_thread_t *th, VALUE *lep, rb_num_t key, VALUE val) svar = *svar_place = (struct SVAR *)NEW_IF(Qnil, Qnil, Qnil); svar->cref = NULL; } - else if (nd_type(svar) == NODE_CREF) { + else if (RB_TYPE_P((VALUE)svar, T_IMEMO) && imemo_type((VALUE)svar) == imemo_cref) { const rb_cref_t *cref = (rb_cref_t *)svar; svar = *svar_place = (struct SVAR *)NEW_IF(Qnil, Qnil, Qnil); RB_OBJ_WRITE(svar, &svar->cref, (VALUE)cref); @@ -261,7 +261,7 @@ lep_cref(const VALUE *ep) if (!svar) { return NULL; } - else if (nd_type(svar) == NODE_CREF) { + else if (RB_TYPE_P((VALUE)svar, T_IMEMO) && imemo_type(svar) == imemo_cref) { return (rb_cref_t *)svar; } else { @@ -300,13 +300,13 @@ rb_vm_rewrite_cref_stack(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_c while (node) { if (CREF_CLASS(node) == old_klass) { - new_node = (rb_cref_t *)NEW_CREF(new_klass); + new_node = vm_cref_new(new_klass, 0, NULL); COPY_CREF_OMOD(new_node, node); CREF_NEXT_SET(new_node, CREF_NEXT(node)); *new_cref_ptr = new_node; return; } - new_node = (rb_cref_t *)NEW_CREF(CREF_CLASS(node)); + new_node = vm_cref_new(CREF_CLASS(node), 0, NULL); COPY_CREF_OMOD(new_node, node); node = CREF_NEXT(node); *new_cref_ptr = new_node; |