summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 09:51:43 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 09:51:43 +0000
commit35f2714452975d567a966b3e8614a203eac8f099 (patch)
tree556975cb00ac4b40ac198fd128cfa85e2c1bf6cd /compile.c
parent985a8067cda379847bab32b36c3fd8c54740b42e (diff)
merge revision(s) 38292: [Backport #6899]
* compile.c (iseq_compile_each): count flip-flop state in local iseq not in each iseqs, so that the keys can be other than hidden strings. [ruby-core:47253] [Bug #6899] * vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store flip-flop states in an array instead of a hash. * iseq.c (set_relation): main iseq also can has local scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index f4211ed860..74c9ef98f5 100644
--- a/compile.c
+++ b/compile.c
@@ -4844,12 +4844,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *lend = NEW_LABEL(nd_line(node));
LABEL *lfin = NEW_LABEL(nd_line(node));
LABEL *ltrue = NEW_LABEL(nd_line(node));
- VALUE key = rb_sprintf("flipflag/%s-%p-%d",
- RSTRING_PTR(iseq->name), (void *)iseq,
- iseq->compile_data->flip_cnt++);
+ struct iseq_compile_data *data = iseq->local_iseq->compile_data;
+ rb_num_t cnt;
+ VALUE key;
+
+ if (!data) data = iseq->compile_data;
+ cnt = data->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
+ key = INT2FIX(cnt);
- hide_obj(key);
- iseq_add_mark_object_compile_time(iseq, key);
ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0));
ADD_INSNL(ret, nd_line(node), branchif, lend);