<div dir="ltr">Hi Levente,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 23, 2016 at 3:09 PM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I found that<br>
- it requires the use of primitive 83 with 3 arguments (aka #perform:with:with:. 2 and 4 argument variants don't trigger the bug)<br>
- its result must be passed immediately as an argument to another method (using a temporary to store the intermediate value won't trigger the error)<br>
- all this has to be evaluated in a block at least twice (the first evaluation won't trigger the bug).<br>
<br>
Here's a smaller example:<br>
<br>
[ '' copyReplaceFrom: 1 to: 0 with: ('' perform: #copyFrom:to: with: 1 with: 0) ] value; value<br>
<br>
I decided to use #copyReplaceFrom:to:with: instead of #,, because the former will raise a debugger due to the invalid arguments.<br>
<br>
Here's a different one:<br>
<br>
[ self haltIf: ({ true } perform: #at:put: with: 1 with: false) ] value; value<br>
<br>
This clearly shows, that first argument of #perform:with:with: stays on the stack somehow.<br>
<br>
Going through the code in the debugger doesn't trigger the bug, which makes me think that the jitted version of #perform:with:with: doesn't pop its first argument from the stack.</blockquote><div><br></div><div> Bingo! Thanks. In fact the primitive fails to pop all but the last argument. I'll have a fix ready soon.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, 23 Feb 2016, Stéphane Rollandin wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a nice one:<br>
<br>
In (seemingly) any 5.0 image, with the latest Spur, type the following in a workspace and printIt a couple of time:<br>
<br>
<br>
(1 to: 3) collect: [:i |<br>
m := ''.<br>
2 timesRepeat: [m := m, ('1234' perform: #copyFrom:to: with: 2 with: 4)].<br>
m]<br>
<br>
<br>
I get kind of randomly either #('234' '' '') or the correct #('234234' '234234' '234234'), or at times #('234234' '' '').<br>
<br>
<br>
Attached is the same code, this time in a method. It is even funkier, since a common answer is then 'copyFrom:to:234', although I sometimes get '234234' ...<br>
<br>
<br>
<br>
Stef<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>