https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17097754782012-11-04T10:19:59ZRuby Issue Tracking SystemBackport193 - Backport #6899: Flip flop operator broken in IRB (1.9.3, win/osx)https://bugs.ruby-lang.org/issues/6899?journal_id=323222012-11-04T10:19:59Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>nobu (Nobuyoshi Nakada)</i></li><li><strong>Target version</strong> set to <i>2.0.0</i></li></ul><p>Confirmed. Good catch! A simplified example:</p>
<p>$ ruby -e 'eval("x = 1; " + "if x==1..x==2;end;" * 1000000)'<br>
-e:1:in <code>eval': method </code>eql?' called on hidden T_STRING object (0x000000210d9488 flags=0x2805 klass=0x0) (NotImplementedError)<br>
from -e:1:in <code>eval' from -e:1:in </code>'</p>
<p>I guess that this is caused by the "hidden string" for flipflop's internal variable name.<br>
The following patch stops the exception, though it makes the string visible for ObjectSpace.<br>
Nobu, what do you think?</p>
<p>diff --git a/compile.c b/compile.c<br>
index 16bfcef..3924948 100644<br>
--- a/compile.c<br>
+++ b/compile.c<br>
@@ -4965,7 +4965,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)<br>
RSTRING_PTR(iseq->location.label), (void *)iseq,<br>
iseq->compile_data->flip_cnt++);</p>
<ul>
<li>hide_obj(key);</li>
</ul>
<ul>
<li>rb_obj_freeze(key);<br>
iseq_add_mark_object_compile_time(iseq, key);<br>
ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0));<br>
ADD_INSNL(ret, nd_line(node), branchif, lend);</li>
</ul>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Backport193 - Backport #6899: Flip flop operator broken in IRB (1.9.3, win/osx)https://bugs.ruby-lang.org/issues/6899?journal_id=342192012-11-30T21:59:14ZAnonymous
<ul></ul><p>I'm experiencing this issue on ruby-1.9.3p327 during test suite run on armv7:</p>
<ol start="31">
<li>Failure:<br>
test_literal_in_conditional(TestParse) [/builddir/build/BUILD/ruby-1.9.3-p327/test/ruby/test_parse.rb:787]:<br>
Exception raised:<br>
<#<NotImplementedError: method `eql?' called on hidden T_STRING object (0x4d72e38 flags=0x2805 klass=0x0)>>.</li>
</ol>
<p>The above patch fixes the issue.</p> Backport193 - Backport #6899: Flip flop operator broken in IRB (1.9.3, win/osx)https://bugs.ruby-lang.org/issues/6899?journal_id=345782012-12-10T15:11:21Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r38292.<br>
Matthias, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>compile.c, vm_insnhelper.c: flip-flop without hidden string key</p>
<ul>
<li>compile.c (iseq_compile_each): count flip-flop state in local iseq<br>
not in each iseqs, so that the keys can be other than hidden<br>
strings. <a href="/issues/6899">[ruby-core:47253]</a> [Bug <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Flip flop operator broken in IRB (1.9.3, win/osx) (Closed)" href="https://bugs.ruby-lang.org/issues/6899">#6899</a>]</li>
<li>vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store<br>
flip-flop states in an array instead of a hash.</li>
<li>iseq.c (set_relation): main iseq also can has local scope.</li>
</ul> Backport193 - Backport #6899: Flip flop operator broken in IRB (1.9.3, win/osx)https://bugs.ruby-lang.org/issues/6899?journal_id=345792012-12-10T15:25:25Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport193</i></li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>nobu (Nobuyoshi Nakada)</i> to <i>usa (Usaku NAKAMURA)</i></li><li><strong>Target version</strong> deleted (<del><i>2.0.0</i></del>)</li></ul> Backport193 - Backport #6899: Flip flop operator broken in IRB (1.9.3, win/osx)https://bugs.ruby-lang.org/issues/6899?journal_id=346042012-12-11T18:51:47Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>This issue was solved with changeset r38317.<br>
Matthias, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>merge revision(s) 38292: [Backport <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Flip flop operator broken in IRB (1.9.3, win/osx) (Closed)" href="https://bugs.ruby-lang.org/issues/6899">#6899</a>]</p>
<pre><code>* 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. <a href="/issues/6899">[ruby-core:47253]</a> [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.
</code></pre>