diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-13 20:02:19 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-13 20:02:19 +0000 |
commit | 32a96472648fac55ae5651f404de4c75e697409c (patch) | |
tree | 4fab0e3ff9178fe160fe61fc63e1c4569286aa0b /vm_eval.c | |
parent | b73e900f50e74504c48f05811dbfb2aabdf40cdc (diff) | |
download | ruby-32a96472648fac55ae5651f404de4c75e697409c.tar.gz |
* refactoring CREF related code.
* eval_intern.h: remove unused setter functions.
CREF_CLASS_SET()
CREF_NEXT_SET()
CREF_SCOPE_VISI_COPY()
* eval_intern.h: rename flags:
* NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL
* NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED
and use IMEMO_FL_USER1/2.
* vm.c (vm_cref_new): accept push_by_eval parameter.
* vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref().
* vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter.
* vm_insnhelper.h: remove unused macros:
COPY_CREF_OMOD() and COPY_CREF().
* vm_eval.c, insns.def: catch up this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -1272,7 +1272,6 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_ volatile int parse_in_eval; volatile int mild_compile_error; rb_cref_t *orig_cref; - VALUE crefval; volatile VALUE file; volatile int line; @@ -1339,16 +1338,13 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_ if (!cref && base_block->iseq) { if (NIL_P(scope)) { orig_cref = rb_vm_get_cref(base_block->ep); - cref = vm_cref_new(Qnil, METHOD_VISI_PUBLIC, NULL); - crefval = (VALUE) cref; - COPY_CREF(cref, orig_cref); + cref = vm_cref_dup(orig_cref); } else { cref = rb_vm_get_cref(base_block->ep); } } vm_set_eval_stack(th, iseq, cref, base_block); - RB_GC_GUARD(crefval); if (0) { /* for debug */ VALUE disasm = rb_iseq_disasm(iseq); @@ -1595,8 +1591,7 @@ yield_under(VALUE under, VALUE self, VALUE values) block.self = self; VM_CF_LEP(th->cfp)[0] = VM_ENVVAL_BLOCK_PTR(&block); } - cref = vm_cref_push(th, under, blockptr); - CREF_PUSHED_BY_EVAL_SET(cref); + cref = vm_cref_push(th, under, blockptr, TRUE); if (values == Qundef) { return vm_yield_with_cref(th, 1, &self, cref); @@ -1618,8 +1613,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements) block.self = refinement; VM_CF_LEP(th->cfp)[0] = VM_ENVVAL_BLOCK_PTR(&block); } - cref = vm_cref_push(th, refinement, blockptr); - CREF_PUSHED_BY_EVAL_SET(cref); + cref = vm_cref_push(th, refinement, blockptr, TRUE); CREF_REFINEMENTS_SET(cref, refinements); return vm_yield_with_cref(th, 0, NULL, cref); @@ -1629,13 +1623,8 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements) static VALUE eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line) { - rb_cref_t *cref = vm_cref_push(GET_THREAD(), under, NULL); - - if (SPECIAL_CONST_P(self) && !NIL_P(under)) { - CREF_PUSHED_BY_EVAL_SET(cref); - } + rb_cref_t *cref = vm_cref_push(GET_THREAD(), under, NULL, SPECIAL_CONST_P(self) && !NIL_P(under)); SafeStringValue(src); - return eval_string_with_cref(self, src, Qnil, cref, file, line); } |