<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 1 janv. 2020 à 20:12, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>

<div id="gmail-m_-2763744102631415467divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi Nicolas,</p>
<p><br>
</p>
<p>this appears to work as well. Could you - or someone else - imagine why Bert added a copy in "<span>Compiler-bf.293"? Don't want to break something else.</span></p>
<p><span><br></span></p></div></div></blockquote><div>I can't speak for Bert, but IMO, either by mimetism with originalArguments, or fear of possible side effects if sharing.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div id="gmail-m_-2763744102631415467divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr"><p><span>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
<div id="gmail-m_-2763744102631415467Signature">
<div id="gmail-m_-2763744102631415467divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2763744102631415467divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>><br>
<b>Gesendet:</b> Dienstag, 31. Dezember 2019 23:59:40<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Christoph,</div>
<div>what about removing the copy in originalReceiver:</div>
<div><br>
</div>
<div>receiver: rcvr arguments: args precedence: p<br>
     receiver := rcvr.<br>
     originalReceiver := rcvr.<br>
     arguments := args.<br>
     originalArguments := arguments copy.<br>
     sizes := Array new: arguments size.<br>
     precedence := p</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le mar. 31 déc. 2019 à 02:08, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<p>Ooooh, my patch was erroneous ... I discovered this while working at a total different thing and it took me several hours to trace recurring VM crashes back to this change ...</p>
<p><br>
</p>
<p>Compare the following before and after loading my commit:</p>
<p></p>
</div>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div>PreferenceWizardMorph compile: (PreferenceWizardMorph sourceCodeAt: #updateWindowBounds).</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div>(PreferenceWizardMorph >> #updateWindowBounds) symbolic edit</div>
</div>
</blockquote>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div></div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">There is a difference!</div>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><img size="12558" id="gmail-m_-2763744102631415467gmail-m_6233605456357787169img725408" style="max-width: 99.9%;" src="cid:16f62a6f627f456b1e51"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">(blue is correct)</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><span style="font-size:12pt">I don't get the full explanation at the moment, but apparently, there *are*</span><span style="font-size:12pt"> </span><span style="font-size:12pt">made some relevant </span><span style="font-size:12pt">transformations</span><span style="font-size:12pt">
 to the receiver, which is offsetting the temp </span><span style="font-size:12pt">index because of the nested closure or something</span><span style="font-size:12pt">. Transformations are more than optimization, I guess.</span><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">The following change appears to fix the current problem:</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><img size="44509" id="gmail-m_-2763744102631415467gmail-m_6233605456357787169img63826" style="max-width: 99.9%;" src="cid:16f62a6f627f456b1e52"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">But I won't commit this to the inbox until I will have made sure that I understand whether and why this is (hopefully) correct. So long, please move <span>Compiler-ct.414 to the Treated Inbox.</span> So
 sorry!</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">
<div><span style="font-size:12pt">> cose over -> close over</span><br>
</div>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">
<div>> throguh -> through</div>
<br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">Thank you, will fix them with my next commit.</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody"><br>
</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">Best,</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169Item.MessagePartBody">Christoph</div>
</div>
</div>
</div>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>>
 im Auftrag von Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>><br>
<b>Gesendet:</b> Dienstag, 31. Dezember 2019 01:04 Uhr<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Ah, yes, here is why:</div>
<div><br>
</div>
<div>Name: Compiler-bf.293<br>
Author: bf<br>
Time: 19 February 2015, 6:22:49.349 pm<br>
UUID: 737af1fb-e8f0-4653-851b-0c1b3ed0f65f<br>
Ancestors: Compiler-topa.292<br>
<br>
Fix deoptimization of ifNil: etc.</div>
<div><br>
</div>
<div>--------</div>
<div><br>
</div>
<div>Forgot to say, your changes in Compiler-ct.414 are correct.</div>
<div>But there are other typos in BlockNode comments, I see at least 2:</div>
<div><br>
</div>
<div>cose over -> close over</div>
<div>throguh -> through<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le mar. 31 déc. 2019 à 00:56, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Oups, I probably missunderstood the question.</div>
<div>You mean why you need to copy the cascadeReceiver...</div>
<div><br>
</div>
<div>Well, it's simple: the rcvr is shared by all cascade message, because we do:</div>
<div><br>
</div>
<div>    parseNode := rcvr.<br>
    (self messagePart: 3 repeat: false)</div>
<div><br>
</div>
<div>So [true] whileTrue is optimized.</div>
<div>Then in #cascade, after #ensureCanCascade: it is #deoptimize(d).</div>
<div>That's when we get the deoptimized rcvr := parseNode cascadeReceiver.</div>
<div><br>
</div>
<div>Then in second message [true] whileFalse, it gets optimized again.</div>
<div>The receiver of second message is deoptimized again, but it's the originalReceiver that gets deoptimized (a copy) not the receiver!</div>
<div>That's a change Bert made to #deoptimize in 2015 for some reason (I guess for some transform, the receiver was changed).</div>
<div><br>
</div>
<div>So your rcvr copy is preserved from re-optimization.</div>
<div><br>
</div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le lun. 30 déc. 2019 à 19:36, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">Hi Christoph,
<div dir="auto">Because sending a message unstack receiver, and replace it with returned object. So we need dup for each cascade.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le lun. 30 déc. 2019 à 19:22, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="auto">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>> <span style="font-size:12pt">As long as you add a test to capture the issue, one that tests both compilation and, if it succeeds, execution, you should add what you see fit.  And yes, trunk is the right place, which means inbox until after the release.</span></p>
<div><br>
</div>
<div>Alright, done, hope you like it :)</div>
<div><br>
</div>
<div>I still don't see why cascadeReceiver is a copy, though ...</div>
<p></p>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Item.MessagePartBody">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper">
<font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divRplyFwdMsg" dir="ltr">
<font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" rel="noreferrer" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von
 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" rel="noreferrer" target="_blank">eliot.miranda@gmail.com</a>><br>
<b>Gesendet:</b> Montag, 30. Dezember 2019 17:51:36<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Christoph, Hi Nicolas,</div>
<div dir="ltr"><br>
<blockquote type="cite">On Dec 30, 2019, at 5:28 AM, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" rel="noreferrer" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>Hi Eliot,</p>
<p><br>
</p>
<p>Of course, a changeset that defers the optimization of ParseNodes until a cascade can be precluded would be perfect - also with respect to the compiler performance. I would be very interested to read such a changeset!</p>
<p><br>
</p>
<p>However, if we can't patch this quickly, would you consider my proposal an appropriate workaround? Should we maybe include it into Trunk, just for 5.3, until we have the perfect solution from Nicolas?</p>
</div>
</div>
</blockquote>
<div><br>
</div>
As long as you add a test to capture the issue, one that tests both compilation and, if it succeeds, execution, you should add what you see fit.  And yes, trunk is the right place, which means inbox until after the release.
<div><br>
</div>
<div>That suggests we switch over to a variation of inbox for the release process.  We could provide releasebox or done such (I would call it release) and only commit things good for the release.  But in thinking about it it’s a bad idea.  It means a lot of
 work to change ones working images from trunk to releasebox and back.  However, if in 5.3 we provided a bulk change operation for the Monticello browser I’d consider it.  Has anything like this been discussed? (we should change subject to continue...)<br>
<blockquote type="cite">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Item.MessagePartBody">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divtagdefaultwrapper">
<font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065divRplyFwdMsg" dir="ltr">
<font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" rel="noreferrer" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von
 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" rel="noreferrer" target="_blank">eliot.miranda@gmail.com</a>><br>
<b>Gesendet:</b> Sonntag, 29. Dezember 2019 21:01:04<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">Hi Christoph,</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Dec 29, 2019 at 11:51 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" rel="noreferrer" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<p>Hi Eliot, thank you very much for the detailed and interesting explanation! I think I got a rough idea of the blockExtent concept; certainly, it will become more clear as I continue to work with it.</p>
<p><br>
</p>
<p>Concretely to this bug, I suppose that optimized blocks don't need their own blockExtent, because they store all their temps directly on their declaring context, don't they?<br>
</p>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Exactly.  They're just basic blocks and jumps, within either proper methods or proper blocks.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<p><span style="font-size:10pt">This would explain the following outputs:</span></p>
<span style="font-size:10pt"></span>
<p></p>
<span style="font-size:10pt"></span></div>
<span style="font-size:10pt"></span>
<blockquote style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<span style="font-size:10pt"></span>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span>
<div><span style="font-size:10pt">[|x| x:=true] whileFalse. "will be </span><span style="font-size:10pt">optimized"</span></div>
<span style="font-size:10pt"></span></div>
<span style="font-size:10pt"></span>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span>
<div><span style="font-size:10pt">thisContext tempNames. </span><span style="background-color:rgb(190,190,190);font-size:10pt">#('x')</span></div>
<span style="font-size:10pt"></span></div>
<span style="font-size:10pt"></span></blockquote>
<span style="font-size:10pt">  compared to:</span><br>
<blockquote style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<span style="font-size:10pt"></span>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span>
<div><span style="font-size:10pt">[|x| x:=true] yourself whileFalse. "wont be optimized"</span></div>
<span style="font-size:10pt"></span></div>
<span style="font-size:10pt"></span>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span>
<div><span style="font-size:10pt">thisContext tempNames </span><span style="background-color:rgb(190,190,190);font-size:10pt">#()</span></div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Exactly.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<blockquote style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span></div>
<span style="font-size:10pt"></span></blockquote>
<span style="font-size:10pt"></span>
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<span style="font-size:10pt"></span>
<div><span style="background-color:rgb(190,190,190)"></span></div>
<span style="font-size:10pt"></span>
<p></p>
<span style="font-size:10pt"></span>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Signature">
<span style="font-size:10pt"></span>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:10pt"></span>
<div name="divtagdefaultwrapper"><span style="font-size:10pt"></span>
<div><span style="font-size:10pt"></span>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
<span style="font-size:12pt">So I would say that blockExtent may indeed be nil, </span>
<b style="font-size:12pt">I would at least note this fact in BlockNode >> #blockExtent.</b><span style="font-size:12pt">
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>And feel free to take as much of my explanation, with rewrites, and add it to the relevant parts of the bytecode compiler.  I like discursive doc like this in class comments, but that implies that a pointer to the class comment from a method is the right
 thing to do (as in "See the class comment in ...").</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
<span style="font-size:12pt">However, #computeCopiedValues: is called by #</span><span style="font-size:12pt">constructClosureCreationNode:, and a closure should be only created of non-optimized BlockNodes. Equally, the senders of #reindexingLocalsDo:encoder:
 should be only activated in case of a non-optimized BlockNode ... So better forget the rest of my first changeset, sigh.</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Right.  So what maybe happening is that the system is realizing that it can't inline the block because it is being used in a cascade.  So the attempt to optimize it in the first place should fail.  We should only consider for optimization blocks that are
 sent one of the inline messages, *but not in a cascade*.  This is probably why Nicolas expects we should have already fixed this bug. Nicolas if I neglected to integrate your fix I apologize.  I invite you to commit straight to trunk; maybe ask Christoph for
 review?.</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
It is interesting that in the example, the receiver BlockNode keeps flagged as optimized (whereas the byte code produces a separate closure):</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<blockquote style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
<div>[self confirm: #foo]</div>
<div><span style="white-space:pre-wrap"></span><span style="white-space:pre-wrap"></span>whileTrue;</div>
<div><span style="white-space:pre-wrap"></span><span style="white-space:pre-wrap"></span>whileFalse</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Right.  I would guess that the block is marked as being optimizable when the whileTrue is processed, but everything goes pear shaped when the whileFalse is processed.  What we need to do is forestall the optimization caused by processing the whileTrue
 send iff the whileTrue is part of a cascade (which is probably exactly what Nicolas' as-yet-unintegrated changes effect).</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<blockquote style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<br>
</div>
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<span style="font-size:12pt"><span style="color:rgb(117,123,128)"><span style="color:rgb(0,0,0)">First, t</span><span style="color:rgb(0,0,0)">he compiler reads the </span><span style="color:rgb(0,0,0)">first message only ("[self confirm: #foo] whileTrue") and </span><span style="color:rgb(0,0,0)">optimizes
 it, and only then finds the second message and discards the optimized bytecode. (See </span><span style="color:rgb(0,0,0)">Parser >> #cascade, </span><span style="color:rgb(0,0,0)">#messagePart:repeat, MessageNode >> </span><span style="color:rgb(0,0,0)">#</span><span style="color:rgb(0,0,0)">receiver:selector:arguments:precedence:from:,
 #transform:.)</span></span></span><br>
</div>
<span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt"></span>
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<span style="color:rgb(0,0,0)">But it does not reset the optimized flag of the BlockNode! To me, this appears to be the actual bug!</span></div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>You have it.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr">
<div dir="ltr" style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
There is #ensureCanCascade: which should specifically solve this problem by resetting the optimized flag. However, during creation of MessageNode, originalReceiver is assigned a copy of the actual receiver. This leads to the problem that while in each temporary
 MessageNode, the receiver block is deoptimized, the tempvar rcrv in #cascade holds the copied original receiver which never got deoptimized. For what purpose do we copy the receiver into originalReceiver?</div>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Did I explain this understandable? :-)</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt">
<div dir="ltr" style="font-size:12pt"><b>By applying the following single patch, I can fix the problem:</b></div>
<div dir="ltr" style="font-size:12pt"><br>
</div>
</div>
<blockquote style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div dir="ltr" style="font-size:12pt">
<div dir="ltr" style="font-size:12pt">
<div>Parser >> #cascade</div>
<div><span style="white-space:pre-wrap"></span>" {; message} => CascadeNode."</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap">
<div><span style="color:rgb(0,111,201)">- <strike>| rcvr msgs |</strike></span></div>
<div><span style="color:rgb(255,0,0)">+ </span><span style="font-size:12pt;color:rgb(255,0,0)"></span><span style="font-size:12pt;color:rgb(255,0,0)">| rcvr
<span style="color:rgb(255,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap">
cascadeR</span><span style="color:rgb(255,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap">cvr
</span>msgs|</span><br>
</div>
</span></div>
<div><span style="font-size:12pt;white-space:pre-wrap"></span><span style="font-size:12pt">parseNode canCascade ifFalse:</span><br>
</div>
<div><span style="white-space:pre-wrap"></span>[^self expected: 'Cascading not'].</div>
<div><span style="white-space:pre-wrap"></span>parseNode ensureCanCascade: encoder.</div>
<div><span style="white-space:pre-wrap"></span>rcvr := parseNode cascadeReceiver.</div>
<div><span style="color:rgb(255,0,0)">+ </span><span style="white-space:pre-wrap;color:rgb(255,0,0)">
</span><span style="color:rgb(255,0,0)">cascadeRcvr := rcvr copy.</span></div>
<div><span style="white-space:pre-wrap"></span>msgs := OrderedCollection with: parseNode.</div>
<div><span style="white-space:pre-wrap"></span>[self match: #semicolon]</div>
<div><span style="white-space:pre-wrap"></span>whileTrue: </div>
<div><span style="white-space:pre-wrap"></span>[parseNode := rcvr.</div>
<div><span style="white-space:pre-wrap"></span>(self messagePart: 3 repeat: false)</div>
<div><span style="white-space:pre-wrap"></span>ifFalse: [^self expected: 'Cascade'].</div>
<div><span style="white-space:pre-wrap"></span>parseNode canCascade ifFalse:</div>
<div><span style="white-space:pre-wrap"></span>[^self expected: '<- No special messages'].</div>
<div><span style="white-space:pre-wrap"></span>parseNode ensureCanCascade: encoder.</div>
<div><span style="white-space:pre-wrap"></span>parseNode cascadeReceiver.</div>
<div><span style="white-space:pre-wrap"></span>msgs addLast: parseNode].</div>
<div><span style="white-space:pre-wrap;color:rgb(0,111,201)">- <strike>parseNode := CascadeNode new receiver: rcvr messages: msgs</strike></span></div>
<div><span style="color:rgb(255,0,0)">+ </span><span style="white-space:pre-wrap;color:rgb(255,0,0)">
</span><span style="color:rgb(255,0,0)">parseNode := CascadeNode new receiver: cascadeRcvr messages: msgs</span></div>
</div>
</div>
</blockquote>
<br>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
All relevant tests pass (but I don't know how good their coverage is).</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Is there any need for respecting possible side-effects on rcvr that might occur while creating the next cascade message (via #messagePart:repeat:)?</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
If not, how would you think about this change? :-)</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
(Sorry for the long text, I did my best to maximize the compression ratio!)</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Um, it's a pleasure to read your writing, so don't worry about being prolix.  I can hardly complain ;-)</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Best,</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Christoph</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divRplyFwdMsg" dir="ltr">
<font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" rel="noreferrer" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von
 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" rel="noreferrer" target="_blank">eliot.miranda@gmail.com</a>><br>
<b>Gesendet:</b> Sonntag, 29. Dezember 2019 16:59 Uhr<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>Hi Christoph,
<div dir="ltr"><br>
<blockquote type="cite">On Dec 28, 2019, at 6:53 AM, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" rel="noreferrer" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>Hi all! :-)</p>
<p><b><br>
</b></p>
<p><b>Steps to reproduce:</b></p>
<p>Do it:</p>
<p></p>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div>[true]</div>
<div><span style="white-space:pre-wrap"></span>whileTrue;</div>
<div><span style="white-space:pre-wrap"></span>whileFalse</div>
</blockquote>
<div></div>
<div><br>
</div>
<div><b>Expected behavior:</b></div>
<div>The script is compiled and executed (and an infinite loop occurs).</div>
<div><br>
</div>
<div><b>Actual behavior:</b></div>
<div>
<div><pastedImage.png></div>
<br>
</div>
<div><br>
</div>
<div><b>Further investigations:</b></div>
<div>In #<span>analyseTempsWithin:rootNode:assignmentPools:, the inner BlockNode [true] is not computed a blockExtent, because it is optimized.</span></div>
<div><span>This leads to a nil key in the ByteCodeEncoder's blockExtentsToLocals.</span></div>
<div><span>A fast solution would be to skip nil blockExtents in #<span>noteBlockExtent:hasLocals:, but that's a dirty workaround.</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span><b>Similar bug:</b></span></span></div>
<div><span><span>Try to do:</span></span></div>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div><span><span>
<div>Object newSubclass compile:  'iWontCompile: foo</div>
</span></span></div>
<div><span><span>
<div><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span>foo.</div>
</span></span></div>
<div><span><span>
<div><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span>[true]</div>
</span></span></div>
<div><span><span>
<div><span style="white-space:pre-wrap"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span></span>whileTrue;</div>
</span></span></div>
<div><span><span>
<div><span style="white-space:pre-wrap"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span></span>whileFalse'</div>
</span></span></div>
</blockquote>
<div><span><span>
<div></div>
<div></div>
<div></div>
</span></span></div>
<div>Fails with:</div>
<div>
<div><pastedImage.png></div>
<br>
</div>
<div>Again, the problem is that blockExtent isNil.</div>
<div><br>
</div>
<div><b>Workaround:</b></div>
<div>Send #yourself to the block before sending the cascade. This prevents the receiver from being optimized.</div>
<div><br>
</div>
<div>Please note that this problem does not only occur in case of special blocks. For example, <span style="font-size:12pt">[Sensor anyButtonPressed] </span><span style="font-size:12pt">whileTrue; </span><span style="font-size:12pt">whileFalse fails as well.</span></div>
<div><br>
</div>
<div><br>
</div>
<div>How to fix this appropriately? I'm not sure whether I understand the whole idea of blockExtent so far.
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
blockExtents are the model of blocks that the compiler uses to analyze temporary references so that temporaries are either local or remote.  Local temporaries are temporaries on a Context’s own stack.  Remote temporaries are temporaries stored in an array which
 is on a Context’s own stack.
<div><br>
</div>
<div>The local/remote distinction is to ensure that a Context _never_ has to reference another Context’s stack to access an outer temporary.  Why? In the VM Contexts serve as proxies for active stack frames, with most stack frames not having a context unless
 the programmer accesses it by accessing some other context’s sender. This optimization is key to the VM’s performance. Cog is fast because it does context-to-stack mapping and creates contexts lazily.</div>
<div><br>
</div>
<div>If the execution model (defined by the bytecode set) for temporary access implements access to outer temporaries via direct access to outer contexts stacks then there are two states an outer context can be in. The common case is that an outer context is
 associated with a stack frame and the temporaries exist in the stack frame; any slots in the context object are stale. But if the block is long lived and runs after its enclosing context has been returned from then the temporaries will be in the context. 
 To keep the slots in the vm text up-to-date the stack frame slots must be copied to the context in return, and *before* the stack frame is torn down. Every outer temp access must check what state the outer context is in. This is what Peter Deutsch’s first
 bytecode set for HPS (objectworks 2.5) did (with the optimization that an outer context would be converted into having a stack frame if it didn’t, so that temporary access only deals with the common case). And the cost and complexity is very high.  (Forgive
 the deep dive).</div>
<div><br>
</div>
<div>The alternative, that I introduced in VW 5i, and that has been in Cog from the start is to never have contexts access outer temps directly.  This is done using a standard closure implementation model from lisp.  Any outer temporary which cannot possibly
 change during the execution of an inner block is copied into the closure and copied onto the block context/frame stack where it is effectively read only (an r-value). These are called “copied values”. </div>
<div><br>
</div>
<div>Any outer temp which is written to in the block or possibly modified after being closed over (ie assigned to lexically after the block) must be put in an array (an indirection vector). Since the temporary holding the indirection vector itself is not written
 to after initialization indirection vectors are always copied values.</div>
<div><br>
</div>
<div>So for example in inject:into: nextValue ends up in an indirection vector but aBlock is a copied value (look at the bytecode for the method; I’m on my phone).  Now the VMs context-to-stack mapping is greatly simplified (no need to intercept returns, no
 need to check outer temp access) and _much_ faster (and less buggy, known from hash experience with HPS).</div>
<div><br>
</div>
<div>But to do this the bytecode compiler must identify when closed over temporaries can be treated as copied values or put in indirection vectors.  Block extents model block nesting and allow the bytecode compiler to check whenever a temporary is read if it
 is being read in an inner block (ie is being closed over), and check whenever a temporary is being written if it is being written to in an inner block, or, if it has been closed over is being written to after a block that closed over it.  In either of these
 two cases, written to during the block and that write needing to be visible in the outer context, or written to after being closed over and that write needing to be visible within the block, the temp must live in an indirection vector.</div>
<div><br>
</div>
<div>Christoph, you *have* to understand this to be able to be effective in working in the execution machinery (eg the runUntil... debugger machinery).  If you do not understand this then the fault is mine (ENTIRELY!), and the fault is that my explanation doesn’t
 make sense. So take as long as you need and ask yourself if you do or do not understand it.  If you don’t, please ask questions and I’ll try my best to explain things better.  I introduced this machinery and it is my responsibility for it not to be a burden.
  This is a case of moving complexity out of the VM into the image, and is justified on performance and reliability grounds.  But it is a severe cognitive burden on those using the bytecode compiler where, yo at the Smalltalk level, it seems they accessing
 outer temporaries directly is simple and all the block extent machinery horribly complex.  I assure you that the block extent machinery is trivial compared to the support required in the vm to implement direct access to outer temps as efficiently as possible
 ;which is way less efficiently than our current architecture allows).<br>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>According to the documentation comment, it should be okay to be nil; however, the #blockExtent comment does not mention this fact.</div>
<div>Please see the attached changeset for an approach to fix the issue. All tests from KernelTests-Methods and most tests from Test-Compiler pass it, except of the testAllNodePCs* which time out in my fresh image. It would be great to hear if this is the right
 way to solve the bug, or just extending a workaround :-)</div>
</div>
</div>
</blockquote>
<div><br>
</div>
I’ll take a look some time today.  But I’d be much happier if you can understand the long winded explanation above and answer your own question.  Great bug though :-)</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div><span style="font-size:12pt">Best,</span></div>
<div>Christoph</div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Signature">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessagePartBody">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318divtagdefaultwrapper">
<font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-2763744102631415467gmail-m_6233605456357787169gmail-m_8801983662900154649m_-1738851141944188428gmail-m_-202516598625828273m_3999269292781078065gmail-m_4238390054683553318Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<div><bugfix compiling block cascades.2.cs></div>
<span></span><br>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<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>
<span></span><br>
</div>
</blockquote>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</div>

<br>
</blockquote></div></div>