diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-10 06:11:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-10 06:11:16 +0000 |
commit | c9b4b78085ee07fa6cae4a267fa5dff80d6351a4 (patch) | |
tree | 402919e6009d329366415466247888ea44af3aa4 /compile.c | |
parent | 2ffc29e8644f2aff66f373573299b33618b145f7 (diff) | |
download | ruby-c9b4b78085ee07fa6cae4a267fa5dff80d6351a4.tar.gz |
compile.c, vm_insnhelper.c: flip-flop without hidden string key
* 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/trunk@38292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -4977,12 +4977,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->location.label), (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); |