<br><br><div class="gmail_quote">2011/1/13 Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu">leves@elte.hu</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, 13 Jan 2011, Nicolas Cellier wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Follow up on unused temps :<br>
<br>
Wanna play with temps ? Try this :<br>
<br>
testUnusedVariable<br>
        self<br>
                compiling: &#39;griffle | goo | ^nil&#39;<br>
                shouldRaise: UnusedVariable;<br>
                compiling: &#39;griffle | | ^[ | goo | ]&#39;<br>
                shouldRaise: UnusedVariable;<br>
                compiling: &#39;griffle | | [ | goo | goo := nil. goo] yourself. ^[ | goo | ]&#39;<br>
                shouldRaise: UnusedVariable;<br>
                compiling: &#39;griffle | | [ | goo | ] yourself. ^[ | goo | goo := nil. goo]&#39;<br>
                shouldRaise: UnusedVariable<br>
<br>
What happens is that Parser.scopeTable has a single entry for &#39;goo&#39;.<br>
Consequently, the last registered goo wins.<br>
In the 3rd case, the last goo is unused, so hasRef = false, so<br>
UnusedVariable is raised.<br>
In the 4th case, the last goo nowHasRef, and we don&#39;t get any UnusedVariable.<br>
<br>
Until we get a scopeTable mapping each temp of each block, we gonna<br>
live in trouble.<br>
</blockquote>
<br></div>
Right. I&#39;d probably create a separate class for the Encoder&#39;s scopeTable, because it&#39;s accessed in various ways from several places and it&#39;s hard to see what change will have side effects in the current code. But I&#39;m a total newbie in this area, so I may be wrong.<br>
</blockquote><div><br></div><div>That&#39;s a good idea.  One goal for anyone who tries to do anything in this area is to collapse optimized temps.  e.g. in the following</div><div><br></div><div>    1 to: self size do: [:i| ...].</div>
<div>     1 to: self size do: [:j| ...]</div><div><br></div><div>or</div>    1 to: self size do: [:i| ...].<br>    1 to: self size do: [:i| ...].</div><div class="gmail_quote"><br></div><div class="gmail_quote">the current scope table makes it really hard to use the same temp slot for either i and j or both i&#39;s.  Since these temps are out of scope after their blocks their temps should be reused.  But the compiler keeps the in-scope/out-of-scope info in the temp nodes themselves, so this can&#39;t be done.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Collapsing temps of different names is probably not feasible because there&#39;s no way to add teh necessary scope information to the debugger temp names string and so no way of saying &quot;temp #T is called &#39;i&#39; from bytecode M to bytecode N but is called &#39;j&#39; from bytecode O to bytecode P&quot;.  But collapsing temps with the same name is straight-forward and judging by all the code I&#39;ve eyeballed in working on the closure compiler I&#39;d say it was worth it, not least because certain large methods would limbo under the 56 slot max temp limit which wouldn&#39;t otherwise.  remember that GeniePlugin method that couldn&#39;t be compiled until it was refactored.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">2¢</div><div class="gmail_quote">Eliot</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888">


Levente</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Nicolas<br>
<br>
2011/1/12 Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2011/1/12 Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 12 Jan 2011, Chris Muller wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;ve just posted a new beta image at:<br>
<br>
 <a href="ftp://ftp.squeak.org/4.2/" target="_blank">ftp://ftp.squeak.org/4.2/</a><br>
<br>
This one does not have wrecked PackageInfo&#39;s, and has most (but not<br>
all) of the aesthetic changes for 4.2.<br>
<br>
The test suite is looking better:<br>
<br>
&#39;CompilerExceptionsTest&gt;&gt;#testUnusedVariable<br>
</blockquote>
<br>
This one is new, I&#39;d be happy if someone could have a look at it.<br>
<br>
</blockquote>
<br>
This is due to latest improvements from Eliot.<br>
Now the BlockNode have their own tempsMark (set by<br>
Parser&gt;&gt;#temporaryBlockVariablesFor:).<br>
The Parser only records top level tempsMark in Parser&gt;&gt;#temporaries.<br>
<br>
If you look at the code in Parser&gt;&gt;#removeUnusedTemps, you see some<br>
defensive programming<br>
       ((tempsMark between: 1 and: str size)<br>
               and: [(str at: tempsMark) = $|]) ifFalse: [^ self].<br>
<br>
But hey, the top level does not have any tempsMark, so the method<br>
prematurely returns without checking for some unused in the blocks.<br>
self<br>
       justTriedCompiling: &#39;griffle | | ^[ | goo | ]&#39;<br>
       andItCorrectlyRaised: UnusedVariable.<br>
<br>
Shall we remove the tempsMark protection ?<br>
<br>
Nicolas<br>
<br>
</blockquote>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br>