<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx</link><description>I'll be doing a series of articles on how the x86 CLR JIT compiler works and the different optimizations it does for you. Whenever a method is about to be executed for the first time, the VM realizes it doesn't have native code for it, and invokes the</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247849</link><pubDate>Tue, 26 Oct 2004 15:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247849</guid><dc:creator>Lorenzo Dematte</dc:creator><description>Very interesting. What algorithm did you chose for registry allocation? Why is necessary control flow analisys? I think this phase could be done by the compiler that emits MSIL</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247855</link><pubDate>Tue, 26 Oct 2004 16:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247855</guid><dc:creator>Andrew Shuttlewood</dc:creator><description>How long does all this take?&lt;br&gt;&lt;br&gt;I imagine that some bits are faster than others, and you're only working with a single method, but I imagine it still has an impact of a kind.&lt;br&gt;&lt;br&gt;Is there a good guide to .NET IL? I'm (probably far too much) familiar with Java bytecode, and I'm curious as to how .NET differs radically.&lt;br&gt;&lt;br&gt;Another question, do you process method by method, class by class, or assembly by assembly?&lt;br&gt;&lt;br&gt;Sorry, I'm just very curious :)</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247862</link><pubDate>Tue, 26 Oct 2004 16:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247862</guid><dc:creator>Andreas Häber</dc:creator><description>Andrew: Checkout &lt;a target="_new" href="http://weblogs.asp.net/kennykerr/category/7140.aspx"&gt;http://weblogs.asp.net/kennykerr/category/7140.aspx&lt;/a&gt; for a quick intro to MSIL.</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247864</link><pubDate>Tue, 26 Oct 2004 16:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247864</guid><dc:creator>Panos Theofanopoulos</dc:creator><description>Some background before the actual question&lt;br&gt;&lt;br&gt;Constants (const in C#) are used only by the&lt;br&gt;compiler, using the value they have at compile &lt;br&gt;time, so a change in some constants is leaving &lt;br&gt;us with a version problem (we must recompile &lt;br&gt;all depended assemblies)&lt;br&gt;&lt;br&gt;Default parameters having the same version &lt;br&gt;problem as the caller actually use the compile &lt;br&gt;time values.&lt;br&gt;The solution that C# team is providing is &lt;br&gt;overloads, this is actually a semi-workaround, &lt;br&gt;since they don't capture the developer's &lt;br&gt;intention (which is just some default values) &lt;br&gt;and they are maintenance problem (we must &lt;br&gt;synchronize the attribute's definitions and xml&lt;br&gt;documentation of the method)&lt;br&gt;&lt;br&gt;&lt;br&gt;Now the question :)&lt;br&gt;&lt;br&gt;How difficult is to add the constant resolution&lt;br&gt;in the first steps of JITing ?&lt;br&gt;&lt;br&gt;&lt;br&gt;That will solve problem #1 and if the default &lt;br&gt;parameters values could be encoded as some &lt;br&gt;internal constants (so the caller use them &lt;br&gt;instead of the actual values) will solve #2 &lt;br&gt;also&lt;br&gt;&lt;br&gt;I think that JITter already does much more &lt;br&gt;complicated things, than a simple Find and Replace&lt;br&gt;&lt;br&gt;Regards&lt;br&gt;</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247872</link><pubDate>Tue, 26 Oct 2004 17:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247872</guid><dc:creator>Dmitriy Zaslavskiy</dc:creator><description>David, could you comments on the differences in JIT and NGEN in v2</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247910</link><pubDate>Tue, 26 Oct 2004 18:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247910</guid><dc:creator>Eric Wilson</dc:creator><description>To Panos Theofanopoulos:  Why not just use public read-only fields instead of public constants?  With read-only fields, I am pretty sure that the compiler does not just hoist the value out at compile time.</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247914</link><pubDate>Tue, 26 Oct 2004 18:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247914</guid><dc:creator>Eric Wilson</dc:creator><description>I'm confused why the JIT does heavy-weight optimizations like common sub-expression elimination.  Shouldn't those be done by the compiler? I can understand the range check optimization because the JIT and CLR already have special understanding of these types.</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#247950</link><pubDate>Tue, 26 Oct 2004 19:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:247950</guid><dc:creator>David Notario</dc:creator><description>Lorenzo:&lt;br&gt;&lt;br&gt;The IL doesn't have information about control flow and liveness. Certainly, some compilers do it to remove dead code, but because IL doesnt have it, we need to recompute it.&lt;br&gt;&lt;br&gt;Andrew: Jitting is per method&lt;br&gt;&lt;br&gt;</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#248007</link><pubDate>Tue, 26 Oct 2004 21:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248007</guid><dc:creator>Luc Cluitmans</dc:creator><description>David, can you comment on differences between JITters for different CPUs, and differences between JIT in different framework versions?&lt;br&gt;&lt;br&gt;I have noticed a few times that, when doing performance tests (in C#) to decide what architectural principles to use for a problem, and trying two different approaches, one approach may be faster on the Intel (P4) processor in the desktop at my office, while the other approach was faster on my AMD (Athlon XP+) processor in my computer at home.&lt;br&gt;&lt;br&gt;Describing the whole test I happened to do this morning leads a bit too far here, but I tried two approaches to a signal processing problem. Both versions were about equally intensive on floating point calculations, but one focussed on employing virtual method calls to get a 'cleaner' architecture, while the other approach tried to trick the JIT into optimizing the code as much as possible by using nonvirtual methods (called from a large code-generated method instead of a simple loop) and using method arguments (backed by local variables) instead of explicit state variables.&lt;br&gt;I was surprised that on 3 out of 4 test situations (AMD vs Intel and .Net 1.1 vs. .Net 2.0.40607) the 'clean' solution was actually (much) faster than the 'optimized' one.&lt;br&gt;&lt;br&gt;Can you give guidelines on what things to do or not to do to let the JIT do its work optimally? I am thinking about things like the effect of 'sealing' a class, virtual vs. nonvirtual methods, interfaces vs. delegates, passing data to a method as fields in its class vs passing the data as method arguments, the implications of 'ref' and 'out' parameters, etc...&lt;br&gt;</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#248058</link><pubDate>Tue, 26 Oct 2004 22:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248058</guid><dc:creator>Omer van Kloeten</dc:creator><description>Simple, quick question: According to the times it takes for the JIT engine to emit a method, what is better: many small methods (these stages occur more often and the optimizations are scarse) or few large methods (these stages occur fewer times, but optimizations are heavier)?</description></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#248093</link><pubDate>Tue, 26 Oct 2004 23:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248093</guid><dc:creator>Panos Theofanopoulos</dc:creator><description>Eric : And what's the use of const then ? :)&lt;br&gt;&lt;br&gt;The answer is that the static field's value (even if it's readonly) cannot be &amp;quot;inlined&amp;quot; by the JITter&lt;br&gt;&lt;br&gt;by inlining i mean the following&lt;br&gt;&lt;br&gt;class AsmA {&lt;br&gt; public const int myConst = 4;&lt;br&gt;}&lt;br&gt;&lt;br&gt;the statement&lt;br&gt; return 4 / AsmA.myConst;&lt;br&gt;&lt;br&gt;will generate a&lt;br&gt;  MOV EAX,1&lt;br&gt;&lt;br&gt;and the statement&lt;br&gt;&lt;br&gt;return a / AsmA.myConst&lt;br&gt;&lt;br&gt;test        eax,eax &lt;br&gt;jns         positive&lt;br&gt;add         eax,3 &lt;br&gt;positive:&lt;br&gt;  sar         eax,2 &lt;br&gt;</description></item><item><title>David Starts Blogging</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#248641</link><pubDate>Wed, 27 Oct 2004 21:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248641</guid><dc:creator>.Net Security Blog</dc:creator><description /></item><item><title>re: The CLR x86 JIT, an overview</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#250193</link><pubDate>Sun, 31 Oct 2004 17:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250193</guid><dc:creator>Daniel Moth</dc:creator><description>Great Stuff! I know you have stated upfront the x86 focus, but I would be interested in any info you have with regards to JITing and the Compact Framework.</description></item><item><title>Don't Deny SkipVerification</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#393756</link><pubDate>Fri, 11 Mar 2005 04:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:393756</guid><dc:creator>.Net Security Blog</dc:creator><description /></item><item><title>Release IS NOT Debug: 64bit Optimizations and C# Method Inlining in Release Build Call Stacks</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#5678813</link><pubDate>Thu, 25 Oct 2007 23:48:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5678813</guid><dc:creator>ASPInsiders</dc:creator><description>&lt;p&gt;Just a reminder: Release builds are not Debug builds. Seems obvious, but it's worth saying again. Release&lt;/p&gt;
</description></item><item><title> David Notario s WebLog The CLR x86 JIT an overview | Green Tea Fat Burner</title><link>http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx#9740989</link><pubDate>Sat, 13 Jun 2009 04:25:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9740989</guid><dc:creator> David Notario s WebLog The CLR x86 JIT an overview | Green Tea Fat Burner</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://greenteafatburner.info/story.php?id=5587"&gt;http://greenteafatburner.info/story.php?id=5587&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>