<div dir="ltr"><div>It was just a wild guess, because I did not look at the code nor any other detail.</div><div>If you already analyzed it, I trust you, you are more advanced than me on the subject :)</div><div>Fixing the Decompiler might be a bit more involved the way it is written now...</div><div>But with your fast progress and fearless diving in lower level details, I think you can do it :)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 22 févr. 2020 à 18:44, 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_-6788210665508682193divtagdefaultwrapper" 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>> <span style="font-size:12pt">could it be for the case when there is no otherwise?</span></p>
<div><br>
</div>
<div>In this case, a "self caseError" will be generated (though this is no correct behavior either IMO, see
<a href="http://forum.world.st/Problems-with-caseError-tp5111930p5112255.html" target="_blank">
Problems with #caseError</a>). I don't see how this should affect the jumps or returns before the otherwise part ...</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<p></p>
<div id="gmail-m_-6788210665508682193Signature">
<div id="gmail-m_-6788210665508682193divtagdefaultwrapper" 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_-6788210665508682193divRplyFwdMsg" 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> Samstag, 22. Februar 2020 18:36:01<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Question regarding compilation of #caseOf:[otherwise:] messages</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Christoph,</div>
<div>could it be for the case when there is no otherwise?<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le sam. 22 févr. 2020 à 18:24, 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_-6788210665508682193gmail-m_1478490010520619400divtagdefaultwrapper" 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><br>
</p>
<p>this a question regarding the Compiler's implementation. I spent some time on it but could not yet find a satisfying explanation. Maybe someone of you can help me?<br>
</p>
<p><br>
</p>
<p>Let's look into MessageNode >> #<span>emitCodeForCase:encoder:value:, which contains the following passage:</span></p>
<p><span></span></p>
<div><br>
</div>
<p></p>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<p><span></span></p>
<div>(isLast and: [allReturn]) ifTrue:</div>
<p></p>
<p><span></span></p>
<div><span style="white-space:pre-wrap"></span>    [self emitCodeForJump: elseSize encoder: encoder]</div>
<p></p>
</blockquote>
<p><span></span></p>
<div></div>
<p></p>
<p><span><br>
</span></p>
<p><span>Btw, the equivalent in #sizeCodeForCase:value: is:</span></p>
<p><span><br>
</span></p>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<p><span><span>(isLast and: [allReturn]) ifTrue: [thenSize := thenSize + (self sizeCode: encoder forJump: elseSize)].</span></span></p>
</blockquote>
<p><span><span><br>
</span></span></p>
<p><span><span>In the bytecode of a method, this will look like this:</span></span></p>
<p><span><span><br>
</span></span></p>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<p><span><span></span></span></p>
<div>89 <23> pushConstant: 2</div>
<p></p>
<p><span><span></span></span></p>
<div>90 <88> dup</div>
<p></p>
<p><span><span></span></span></p>
<div>91 <76> pushConstant: 1</div>
<p></p>
<p><span><span></span></span></p>
<div>92 <B6> send: =</div>
<p></p>
<p><span><span></span></span></p>
<div>93 <9A> jumpFalse: 97</div>
<p></p>
<p><span><span></span></span></p>
<div>94 <87> pop</div>
<p></p>
<p><span><span></span></span></p>
<div>95 <22> pushConstant: #one</div>
<p></p>
<p><span><span></span></span></p>
<div>96 <7C> returnTop</div>
<p></p>
<p><span><span></span></span></p>
<div>97 <77> pushConstant: 2</div>
<p></p>
<p><span><span></span></span></p>
<div>98 <B6> send: =</div>
<p></p>
<p><span><span></span></span></p>
<div>99 <9A> jumpFalse: 103</div>
<p></p>
<p><span><span></span></span></p>
<div>100 <21> pushConstant: #two</div>
<p></p>
<p><span><span></span></span></p>
<div>101 <7C> returnTop</div>
<p></p>
<p><span><span></span></span></p>
<div><b><span style="background-color:rgb(255,255,0)">102 <90> jumpTo: 104 "here!"</span></b></div>
<p></p>
<p><span><span></span></span></p>
<div>103 <20> pushConstant: 42</div>
<p></p>
<p><span><span></span></span></p>
<div>104 <87> pop</div>
<p></p>
</blockquote>
<p><span><span><br>
</span></span></p>
<p><span><span>I cannot see when this jump would be ever reached.</span></span></p>
<p><span style="font-size:12pt"><b>Case 1:</b> Any </span><span style="font-size:12pt">case is selected, and because allReturn is true, its inlined value block is guaranteed to #returnTop and thus not to reach the last jump (in the above example, this happens
 in </span><span style="font-size:12pt">pc101).</span><br>
</p>
<p><span><span><b>Case 2:</b> No case is selected, so the execution will jump straightly to the inlined otherwiseBlock (this is pc99 in the example).</span></span></p>
<p><span style="font-size:12pt">For what purpose do we need this jump (ex: pc102)? Should we maybe remove it?</span><br>
</p>
<p><span><span><br>
</span></span></p>
<p><span><span>Are there any special situations in which #returns is true but there is any code path that does *not* return? Some weird exception handling trick, for example?</span></span></p>
<p><span><span>Or was the dubious jump just designed as a fallback to catch any hypothetic failures in any other component of the compiler system?</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>I removed the generation of this jump for testing and could not investigate any anomalies so far. All compiler tests are passing - except of a number of Decompiler tests, which probably would need to be updated as well.</span></span></p>
<p><span style="font-size:12pt">Please find a minimum changeset in the attachment that demonstrates my question.</span><br>
</p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span><span>I am looking forward to your replies!</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>Best,</span></span></p>
<p><span><span>Christoph</span></span></p>
<div id="gmail-m_-6788210665508682193gmail-m_1478490010520619400Signature">
<div id="gmail-m_-6788210665508682193gmail-m_1478490010520619400divtagdefaultwrapper" 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>
</div>
<br>
</blockquote>
</div>
</div>
</div>

<br>
</blockquote></div>