<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tamarin Tracing Internals IV: Trace Optimization</title>
	<atom:link href="http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/</link>
	<description>Just another Blog.mozilla.com weblog</description>
	<lastBuildDate>Wed, 25 Jan 2012 23:29:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Indonesia Furniture Handicraft Wholesale Marketplace</title>
		<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/comment-page-1/#comment-20992</link>
		<dc:creator>Indonesia Furniture Handicraft Wholesale Marketplace</dc:creator>
		<pubDate>Sat, 05 Jun 2010 04:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/?p=17#comment-20992</guid>
		<description>Thanks for this, I&#039;m still learning about what you share here.</description>
		<content:encoded><![CDATA[<p>Thanks for this, I&#8217;m still learning about what you share here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dce results</title>
		<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/comment-page-1/#comment-606</link>
		<dc:creator>dce results</dc:creator>
		<pubDate>Thu, 19 Jun 2008 19:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/?p=17#comment-606</guid>
		<description>[...] for this is mostly in the nanojit/ directory. Keep in mind that a trace is always straight-line codehttp://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/Prep roundup: Fagbemi dominates at sectionals Marshfield News HeraldEAU CLAIRE -- Oladipo Fagbemi [...]</description>
		<content:encoded><![CDATA[<p>[...] for this is mostly in the nanojit/ directory. Keep in mind that a trace is always straight-line codehttp://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/Prep roundup: Fagbemi dominates at sectionals Marshfield News HeraldEAU CLAIRE &#8212; Oladipo Fagbemi [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmandelin</title>
		<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/comment-page-1/#comment-538</link>
		<dc:creator>dmandelin</dc:creator>
		<pubDate>Fri, 30 May 2008 18:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/?p=17#comment-538</guid>
		<description>Cool. I think the spill code is hard to understand just because there aren&#039;t standard algorithms for it (vs. say, CSE), so I don&#039;t have much of a starting idea of how it works. One thing I did notice about the design of the register allocator is that it tries to assign the same register to a result as the one it will get used in later, which tends to save copies. This is nice-coalescing can also avoid those copies but I think is much too expensive for TT.

Thanks for the tip, although what tripped me the most at first was that you have to read the code generation code backward-but I&#039;m getting used to that now.</description>
		<content:encoded><![CDATA[<p>Cool. I think the spill code is hard to understand just because there aren&#8217;t standard algorithms for it (vs. say, CSE), so I don&#8217;t have much of a starting idea of how it works. One thing I did notice about the design of the register allocator is that it tries to assign the same register to a result as the one it will get used in later, which tends to save copies. This is nice-coalescing can also avoid those copies but I think is much too expensive for TT.</p>
<p>Thanks for the tip, although what tripped me the most at first was that you have to read the code generation code backward-but I&#8217;m getting used to that now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Reitmaier</title>
		<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/comment-page-1/#comment-535</link>
		<dc:creator>Rick Reitmaier</dc:creator>
		<pubDate>Fri, 30 May 2008 16:01:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/?p=17#comment-535</guid>
		<description>Compiling LIR bottom-up has a number of advantages (like you&#039;ve
mentioned) and we think it makes for a smaller assembler, which 
is a major factor for TT.  

Like you&#039;ve highlighted walking through the Assembler code can be a bit 
confusing.  Another way of thinking about it is that the current set of 
Reservation&#039;s forms a contract that must be met by downstream code 
(i.e. code already generated).
 
For example we&#039;ve generated :

   add eax,ebx

Now if we want to use eax we have to make sure it gets
loaded, so we rematerialize it, like so

   mov eax,ebp[-8]
   add eax,ebx

Now we&#039;re free to use eax for another instruction:

    sub eax,ebx
    mov eax,ebp[-8]
    add eax,ebx

A really nice part of this flow is that we don&#039;t have to worry 
about how eax in the sub gets populated (likewise when we 
generated the add, we didn&#039;t know that eax would be loaded 
from the stack).  

This approach tends to produce reasonable code, in that 
remats typically happen close to uses without additional 
book-keeping or extra passes, and spills (if needed) happen 
at the point when the value is produced.

tip: reading the code as its generated (i.e. backwards) can 
be easily accomplished by modifying the 1st if statement in 
Assembler::output() to : 
	if (0 &amp;&amp; _outputCache)</description>
		<content:encoded><![CDATA[<p>Compiling LIR bottom-up has a number of advantages (like you&#8217;ve<br />
mentioned) and we think it makes for a smaller assembler, which<br />
is a major factor for TT.  </p>
<p>Like you&#8217;ve highlighted walking through the Assembler code can be a bit<br />
confusing.  Another way of thinking about it is that the current set of<br />
Reservation&#8217;s forms a contract that must be met by downstream code<br />
(i.e. code already generated).</p>
<p>For example we&#8217;ve generated :</p>
<p>   add eax,ebx</p>
<p>Now if we want to use eax we have to make sure it gets<br />
loaded, so we rematerialize it, like so</p>
<p>   mov eax,ebp[-8]<br />
   add eax,ebx</p>
<p>Now we&#8217;re free to use eax for another instruction:</p>
<p>    sub eax,ebx<br />
    mov eax,ebp[-8]<br />
    add eax,ebx</p>
<p>A really nice part of this flow is that we don&#8217;t have to worry<br />
about how eax in the sub gets populated (likewise when we<br />
generated the add, we didn&#8217;t know that eax would be loaded<br />
from the stack).  </p>
<p>This approach tends to produce reasonable code, in that<br />
remats typically happen close to uses without additional<br />
book-keeping or extra passes, and spills (if needed) happen<br />
at the point when the value is produced.</p>
<p>tip: reading the code as its generated (i.e. backwards) can<br />
be easily accomplished by modifying the 1st if statement in<br />
Assembler::output() to :<br />
	if (0 &amp;&amp; _outputCache)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://blog.mozilla.com/dmandelin/2008/05/28/tamarin-tracing-internals-iv-trace-optimization/comment-page-1/#comment-529</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Thu, 29 May 2008 06:56:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/?p=17#comment-529</guid>
		<description>I think a lot of the configuration values (XJUMPS, BLKS, EXITS) are a result of Ed and his team experimenting with different strategies to contain the code explosion through tail duplication, and to steer what gets recorded and extended when. 

If you set the XJUMPS limit to 2, for example, you &quot;outerlined&quot; traces (folding of the outer nested loop into the inner loop), which we use a lot in our trees to deal with simple nested loop.

Without having looked at the code recently, I would assume MAX_EXITS might be an attempted to limit tail duplication as a result of trying to inline outer method scopes. If you start recording in method f and you backtrack into the outer scope (method) g, that transition back into the outer scope (return) might spawn a number of side exits (one for each other scope f can be called from). Since TT does support recording into outer scopes (which we do not in Hotpath), they have to somehow limit this growth.</description>
		<content:encoded><![CDATA[<p>I think a lot of the configuration values (XJUMPS, BLKS, EXITS) are a result of Ed and his team experimenting with different strategies to contain the code explosion through tail duplication, and to steer what gets recorded and extended when. </p>
<p>If you set the XJUMPS limit to 2, for example, you &#8220;outerlined&#8221; traces (folding of the outer nested loop into the inner loop), which we use a lot in our trees to deal with simple nested loop.</p>
<p>Without having looked at the code recently, I would assume MAX_EXITS might be an attempted to limit tail duplication as a result of trying to inline outer method scopes. If you start recording in method f and you backtrack into the outer scope (method) g, that transition back into the outer scope (return) might spawn a number of side exits (one for each other scope f can be called from). Since TT does support recording into outer scopes (which we do not in Hotpath), they have to somehow limit this growth.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

