<?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: Worlds Apart &#8211; C# and Java</title>
	<atom:link href="http://robubu.com/?feed=rss2&#038;p=28" rel="self" type="application/rss+xml" />
	<link>http://robubu.com/?p=28</link>
	<description>the weblog of Rob Yates</description>
	<lastBuildDate>Sat, 14 Aug 2010 17:34:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Alex Buckley</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9689</link>
		<dc:creator>Alex Buckley</dc:creator>
		<pubDate>Fri, 04 May 2007 03:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9689</guid>
		<description>Re: &quot;C# itself is no more or less designed for these analyses than Java.&quot;

I was mainly thinking of the non-OO control flow analyses when I wrote that. It&#039;s true that C#&#039;s non-virtual default makes CHA redundant for some programs, but 1) CHA is still useful in a CLI JIT due to the possibility of virtual methods, and 2) the default is in no small part for familiarity with C++ than for a desire to avoid CHA per se.</description>
		<content:encoded><![CDATA[<p>Re: &#8220;C# itself is no more or less designed for these analyses than Java.&#8221;</p>
<p>I was mainly thinking of the non-OO control flow analyses when I wrote that. It&#8217;s true that C#&#8217;s non-virtual default makes CHA redundant for some programs, but 1) CHA is still useful in a CLI JIT due to the possibility of virtual methods, and 2) the default is in no small part for familiarity with C++ than for a desire to avoid CHA per se.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robubu - the technical weblog of Rob Yates &#187; Worlds Apart - Why Java needs ahead of time compilation and why C# has it</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9572</link>
		<dc:creator>robubu - the technical weblog of Rob Yates &#187; Worlds Apart - Why Java needs ahead of time compilation and why C# has it</dc:creator>
		<pubDate>Wed, 02 May 2007 18:35:32 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9572</guid>
		<description>[...] So why can&#8217;t Java programs share memory given that shared libraries are a technology that&#8217;s been in widespread use for at least 25 years? It&#8217;s really for two reasons.  The first is that up until this point there has really been no way to define a shared library in Java i.e. here&#8217;s a bunch of code and here is its external interface. JSR294 (modularity for Java) addresses this point.  The second is that Java has no efficient AOT compilation and so unlike most other statically typed languages it can&#8217;t utilize the traditional OS functions to load and share its libraries. I have belabored this point in the other &quot;Worlds Apart&quot; posts here and here, pointing out that this is a key differentiation for CLI implementations such as .net or mono.  Miguel (mono lead) also has an excellent post that provides a good overview of mono&#8217;s AOT support and the rationale behind it. JSR294 could be designed in such a way to provide for efficient AOT, and I belabor this point here. [...]</description>
		<content:encoded><![CDATA[<p>[...] So why can&#8217;t Java programs share memory given that shared libraries are a technology that&#8217;s been in widespread use for at least 25 years? It&#8217;s really for two reasons.  The first is that up until this point there has really been no way to define a shared library in Java i.e. here&#8217;s a bunch of code and here is its external interface. JSR294 (modularity for Java) addresses this point.  The second is that Java has no efficient AOT compilation and so unlike most other statically typed languages it can&#8217;t utilize the traditional OS functions to load and share its libraries. I have belabored this point in the other &quot;Worlds Apart&quot; posts here and here, pointing out that this is a key differentiation for CLI implementations such as .net or mono.  Miguel (mono lead) also has an excellent post that provides a good overview of mono&#8217;s AOT support and the rationale behind it. JSR294 could be designed in such a way to provide for efficient AOT, and I belabor this point here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vitaly Mikheev</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9571</link>
		<dc:creator>Vitaly Mikheev</dc:creator>
		<pubDate>Wed, 02 May 2007 18:26:59 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9571</guid>
		<description>From my personal communication with Sun HotSpot team, I know that the currently implemented  inlining mechanisms are considered well done and do not require any “simplification”

As for AOT  compilers, I can judge only about Excelsior JET and I would say that’s not a big problem. The existing devirtualization techniques work well and the optimizer feels comfortable.  Not sure about GCJ ‘cause I do not know the details.

JSR294 will not simplify inlining virtual calls. Despite the stricter access rules, an application can dynamically load a new class that __belongs__ to a superpackage (the notion introduced by JSR294). It effectively means that a superpackage cannot be considered a “closed sub-world” in which CHA or RTA will get more freedom to work. 

--------

Custom classloaders really make AOT compilation harder (though still possible). The necessity of shipping the original class files along with their optimized counterparts as well as multiple consistency checks often makes AOT compilation impractical for apps that heavily use custom classloading such as Eclipse. 

BUT, there is a hope and it is called… JSR277 ;)

This JSR introduces “deployment modules” as an addition to “development modules” proposed by JSR294. Actually, in most cases custom classloaders are used for two simple purposes:

1.	Unique name spaces for loaded classes 
2.	Version control

For that, the using of _general_ custom classloaders is overkill and complicates things to a great extent. That’s why JSR277 proposes deployment modules that use

a static import policy declared in the module’s manifest
module classloader (one instance per module)

For details, see “Section  8. Execution” of the available public draft of  JSR277. In my opinion, this is definitely a right direction and I would have to join EG ;)

------------
 @Rob (size of AOT compiled code)

Java bytecode had been originally designed for compactness. It has a much higher level than a typical CPU instruction set and takes less space than the equivalent machine code, say, for Intel x86. But Java class files contain not only code. The amount of symbolic information in class files has grown dramatically over the years due to the development of numerous APIs and their package structure. So now there is not a dramatic difference in disk footprint between the original and AOT-compiled forms. As for total download size of AOT-compiled apps, it can be even smaller than the size of the JRE.

http://www.excelsior-usa.com/blog/?p=52

Thanks for your attention – I talk a lot. ;)

--Vitaly</description>
		<content:encoded><![CDATA[<p>From my personal communication with Sun HotSpot team, I know that the currently implemented  inlining mechanisms are considered well done and do not require any “simplification”</p>
<p>As for AOT  compilers, I can judge only about Excelsior JET and I would say that’s not a big problem. The existing devirtualization techniques work well and the optimizer feels comfortable.  Not sure about GCJ ‘cause I do not know the details.</p>
<p>JSR294 will not simplify inlining virtual calls. Despite the stricter access rules, an application can dynamically load a new class that __belongs__ to a superpackage (the notion introduced by JSR294). It effectively means that a superpackage cannot be considered a “closed sub-world” in which CHA or RTA will get more freedom to work. </p>
<p>&#8212;&#8212;&#8211;</p>
<p>Custom classloaders really make AOT compilation harder (though still possible). The necessity of shipping the original class files along with their optimized counterparts as well as multiple consistency checks often makes AOT compilation impractical for apps that heavily use custom classloading such as Eclipse. </p>
<p>BUT, there is a hope and it is called… JSR277 ;)</p>
<p>This JSR introduces “deployment modules” as an addition to “development modules” proposed by JSR294. Actually, in most cases custom classloaders are used for two simple purposes:</p>
<p>1.	Unique name spaces for loaded classes<br />
2.	Version control</p>
<p>For that, the using of _general_ custom classloaders is overkill and complicates things to a great extent. That’s why JSR277 proposes deployment modules that use</p>
<p>a static import policy declared in the module’s manifest<br />
module classloader (one instance per module)</p>
<p>For details, see “Section  8. Execution” of the available public draft of  JSR277. In my opinion, this is definitely a right direction and I would have to join EG ;)</p>
<p>&#8212;&#8212;&#8212;&#8212;<br />
 @Rob (size of AOT compiled code)</p>
<p>Java bytecode had been originally designed for compactness. It has a much higher level than a typical CPU instruction set and takes less space than the equivalent machine code, say, for Intel x86. But Java class files contain not only code. The amount of symbolic information in class files has grown dramatically over the years due to the development of numerous APIs and their package structure. So now there is not a dramatic difference in disk footprint between the original and AOT-compiled forms. As for total download size of AOT-compiled apps, it can be even smaller than the size of the JRE.</p>
<p><a href="http://www.excelsior-usa.com/blog/?p=52" rel="nofollow">http://www.excelsior-usa.com/blog/?p=52</a></p>
<p>Thanks for your attention – I talk a lot. ;)</p>
<p>&#8211;Vitaly</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John "Z-Bo" Zabroski</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9294</link>
		<dc:creator>John "Z-Bo" Zabroski</dc:creator>
		<pubDate>Sun, 29 Apr 2007 12:47:37 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9294</guid>
		<description>@Reinier
@What I’d like to see more of, instead, is language keywords which specify INTENT, regardless of the compilation benefits thereof.

Syntax for rule-based systems on top of programming languages?  Rule number one: Avoid accidental complexity at all costs.  This is why the Macker project is not as practical as I wish.  In addition, this concept of &quot;intent&quot; conflates how-to and what-to.

@Rob Yates

Your view-point is interesting.  I always thought Java had the right idea with the &quot;final&quot; keyword.  I like when people challenge what I consider right.  To me, &quot;final&quot; is used very effectively in Java to communicate that once something is defined, it cannot be changed.

@Ricky Clarkson

A static method does not depend on instance variables, whereas methods with other storage classes do.  A static method depends only on the arguments passed into it.  Since it does not have these dependencies, a static method remains available until the end of program execution.</description>
		<content:encoded><![CDATA[<p>@Reinier<br />
@What I’d like to see more of, instead, is language keywords which specify INTENT, regardless of the compilation benefits thereof.</p>
<p>Syntax for rule-based systems on top of programming languages?  Rule number one: Avoid accidental complexity at all costs.  This is why the Macker project is not as practical as I wish.  In addition, this concept of &#8220;intent&#8221; conflates how-to and what-to.</p>
<p>@Rob Yates</p>
<p>Your view-point is interesting.  I always thought Java had the right idea with the &#8220;final&#8221; keyword.  I like when people challenge what I consider right.  To me, &#8220;final&#8221; is used very effectively in Java to communicate that once something is defined, it cannot be changed.</p>
<p>@Ricky Clarkson</p>
<p>A static method does not depend on instance variables, whereas methods with other storage classes do.  A static method depends only on the arguments passed into it.  Since it does not have these dependencies, a static method remains available until the end of program execution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Clarkson</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9201</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Sat, 28 Apr 2007 14:20:15 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9201</guid>
		<description>Not a performance consideration, just a style one - why would you have a non-virtual method at all, rather than making it static?  Is that just because it&#039;s more convenient to write b.doThis(a) than doThis(b,a)?</description>
		<content:encoded><![CDATA[<p>Not a performance consideration, just a style one &#8211; why would you have a non-virtual method at all, rather than making it static?  Is that just because it&#8217;s more convenient to write b.doThis(a) than doThis(b,a)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Yates</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9194</link>
		<dc:creator>Rob Yates</dc:creator>
		<pubDate>Sat, 28 Apr 2007 13:22:36 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9194</guid>
		<description>Fabrizio,

so .NET does not have custom classloaders it has &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/8ffc3x75.aspx&quot; rel=&quot;nofollow&quot;&gt;dynamic assemblies&lt;/a&gt; instead.

Patrick,

I am making no claims as to the performance advantage of one over the other.  I think the performance is actually pretty similar, I just think it interesting that CLI (with the benefit of hindsight) chose a totally different approach to JVMs.

Reinier,

you hit the nail on the head, what I would like the JSR294 expert group to consider is ensuring that classloading rules for modules allow a module to be declared static (i.e. custom classloaders are not used and compilers can determine the class hierarchy within a given module so that, for example, RTA can be used within a module).  Of course I would also prefer static modules to be the default.  As you point out most java code does not require the dynamism.

Vitaly makes a good point, but I wonder how efficiently guarded inlines are when trying to compile something like Tomcat or even Websphere with all its dependencies into DLLs / Shared Objects.  One of the criticisms I have heard leveled at AOT compilation for Java is that the size of the executable gets significantly larger than the corresponding jar.  I imagine that having the redundant code paths with guarded inline compounds this problem.

Again my main point here is that JSR294 can bring efficient simple AOT to the Java platform.  I just hope we take the opportunity.</description>
		<content:encoded><![CDATA[<p>Fabrizio,</p>
<p>so .NET does not have custom classloaders it has <a href="http://msdn2.microsoft.com/en-us/library/8ffc3x75.aspx" rel="nofollow">dynamic assemblies</a> instead.</p>
<p>Patrick,</p>
<p>I am making no claims as to the performance advantage of one over the other.  I think the performance is actually pretty similar, I just think it interesting that CLI (with the benefit of hindsight) chose a totally different approach to JVMs.</p>
<p>Reinier,</p>
<p>you hit the nail on the head, what I would like the JSR294 expert group to consider is ensuring that classloading rules for modules allow a module to be declared static (i.e. custom classloaders are not used and compilers can determine the class hierarchy within a given module so that, for example, RTA can be used within a module).  Of course I would also prefer static modules to be the default.  As you point out most java code does not require the dynamism.</p>
<p>Vitaly makes a good point, but I wonder how efficiently guarded inlines are when trying to compile something like Tomcat or even Websphere with all its dependencies into DLLs / Shared Objects.  One of the criticisms I have heard leveled at AOT compilation for Java is that the size of the executable gets significantly larger than the corresponding jar.  I imagine that having the redundant code paths with guarded inline compounds this problem.</p>
<p>Again my main point here is that JSR294 can bring efficient simple AOT to the Java platform.  I just hope we take the opportunity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabrizio Giudici</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9168</link>
		<dc:creator>Fabrizio Giudici</dc:creator>
		<pubDate>Sat, 28 Apr 2007 07:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9168</guid>
		<description>Interesting stuff. I&#039;d only put a question, just to learn better something about .NET (which I basically don&#039;t know): it sounds like .NET can&#039;t have custom classloaders. Right?</description>
		<content:encoded><![CDATA[<p>Interesting stuff. I&#8217;d only put a question, just to learn better something about .NET (which I basically don&#8217;t know): it sounds like .NET can&#8217;t have custom classloaders. Right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Wright</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9167</link>
		<dc:creator>Patrick Wright</dc:creator>
		<pubDate>Sat, 28 Apr 2007 07:00:15 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9167</guid>
		<description>Interesting discussion. In the Java world, the strong tendency these days is not to use &quot;final&quot; as a compiler optimization hint, but rather as a programmatic control--to control negative or unintended side-effects when classes aren&#039;t designed for subclassing, or variables shouldn&#039;t be re-initialized. In most cases, people design for extensibility and take advantage of being able to modify, extend, swap, classes and methods at runtime; it&#039;s a big part of the platform. Maybe I haven&#039;t seen the performance numbers you&#039;re looking at, but nothing that I have seen makes any of the JVM implementations out to be a slouch. Patrick</description>
		<content:encoded><![CDATA[<p>Interesting discussion. In the Java world, the strong tendency these days is not to use &#8220;final&#8221; as a compiler optimization hint, but rather as a programmatic control&#8211;to control negative or unintended side-effects when classes aren&#8217;t designed for subclassing, or variables shouldn&#8217;t be re-initialized. In most cases, people design for extensibility and take advantage of being able to modify, extend, swap, classes and methods at runtime; it&#8217;s a big part of the platform. Maybe I haven&#8217;t seen the performance numbers you&#8217;re looking at, but nothing that I have seen makes any of the JVM implementations out to be a slouch. Patrick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reinier Zwitserloot</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9133</link>
		<dc:creator>Reinier Zwitserloot</dc:creator>
		<pubDate>Sat, 28 Apr 2007 00:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9133</guid>
		<description>First off, thanks, Vitaly, for such an in-depth commentary on the issue :-P

Actually, I think this is a great argument for why C# is bass ackwards.

In theory (and Vitaly&#039;s comment and the tail end of your blog post explore how to turn this into &quot;in practice&quot;) you can reduce the overhead of &#039;assumed virtual&#039; to insignificance.

This isn&#039;t the only time I caught C# making design decisions that are loosely equivalent to &#039;optimizing early&#039;. Right now it makes a lot of sense because the techniques to automate a certain step are currently too hazy or just too difficult to get right, but eventually, it might happen. In that case, don&#039;t even allow programmers to specify this and lay down the rules, locking the entire platform into that rule for perpetuity, backwards compatibility being the holy grail that it is in both C# and especially in Java land.

What I&#039;d like to see more of, instead, is language keywords which specify INTENT, regardless of the compilation benefits thereof. One could for example make a case that every method declaration should specify explicitly whether or not it is simply supplying an alternative implementation (e.g. overriding a definition of an implemented interface or extended class), or creating a new definition, and whether or not this implementation is designed to be extended, or not. Not a very good case, but there&#039;s a case there. Right now neither java or C# really do this, they simply occupy opposite opinions of the same fence: there&#039;s a keyword to specify one behaviour, and ommiting it automatically means it&#039;s the other behaviour, and there&#039;s no keyword that can be supplied to clarify the default. Java and C# both follow this, they&#039;ve just got the default switched around. Neither is more expressive in communicating intent than the other on the surface.

to add another perspective (or maybe this is what you were driving at): Let&#039;s say you have a module (JSR294 based or OSGI) where, for the entire codebase, no custom classloaders are even defined, and no classes are loaded dynamically through reflection (actually covers the majority of java software out there, for good reason). It should be simple to annotate this code analysis factoid. The hotspot compiler will have to do a lot less work to determine the safety of inlining anything based on that knowledge.</description>
		<content:encoded><![CDATA[<p>First off, thanks, Vitaly, for such an in-depth commentary on the issue :-P</p>
<p>Actually, I think this is a great argument for why C# is bass ackwards.</p>
<p>In theory (and Vitaly&#8217;s comment and the tail end of your blog post explore how to turn this into &#8220;in practice&#8221;) you can reduce the overhead of &#8216;assumed virtual&#8217; to insignificance.</p>
<p>This isn&#8217;t the only time I caught C# making design decisions that are loosely equivalent to &#8216;optimizing early&#8217;. Right now it makes a lot of sense because the techniques to automate a certain step are currently too hazy or just too difficult to get right, but eventually, it might happen. In that case, don&#8217;t even allow programmers to specify this and lay down the rules, locking the entire platform into that rule for perpetuity, backwards compatibility being the holy grail that it is in both C# and especially in Java land.</p>
<p>What I&#8217;d like to see more of, instead, is language keywords which specify INTENT, regardless of the compilation benefits thereof. One could for example make a case that every method declaration should specify explicitly whether or not it is simply supplying an alternative implementation (e.g. overriding a definition of an implemented interface or extended class), or creating a new definition, and whether or not this implementation is designed to be extended, or not. Not a very good case, but there&#8217;s a case there. Right now neither java or C# really do this, they simply occupy opposite opinions of the same fence: there&#8217;s a keyword to specify one behaviour, and ommiting it automatically means it&#8217;s the other behaviour, and there&#8217;s no keyword that can be supplied to clarify the default. Java and C# both follow this, they&#8217;ve just got the default switched around. Neither is more expressive in communicating intent than the other on the surface.</p>
<p>to add another perspective (or maybe this is what you were driving at): Let&#8217;s say you have a module (JSR294 based or OSGI) where, for the entire codebase, no custom classloaders are even defined, and no classes are loaded dynamically through reflection (actually covers the majority of java software out there, for good reason). It should be simple to annotate this code analysis factoid. The hotspot compiler will have to do a lot less work to determine the safety of inlining anything based on that knowledge.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vitaly Mikheev</title>
		<link>http://robubu.com/?p=28&#038;cpage=1#comment-9092</link>
		<dc:creator>Vitaly Mikheev</dc:creator>
		<pubDate>Fri, 27 Apr 2007 12:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://robubu.com/?p=28#comment-9092</guid>
		<description>Hi Rob,

thanks for an interesting post.

I know a little bit of AOT compilation for Java because I&#039;m the CTO for Excelsior, the maker of Excelsior JET. ;)

Let me add a few notes to what you said.

INLINE

Both RTA &amp; CHA are possible with AOT compilation provided the guarded inline is used. A simple check 
is followed by inlined body and the virtual call is put on another branch and considered &quot;cold&quot; code. Note that this check is required anyway (even if a final method is inlined) because the receiver (&quot;this&quot;) must be checked for null before the body is executed. 

Though guarded inline is not as effective as direct one (the merge point in the control flow kills the info that would come from the inlined body), it is still very effective because, for example, method accessors (set/get) work virtually as fast as they would do if inlined directly. 

Note also that many JVMs with dynamic compilers also employ guarded inline to avoid expensive recompilation immediately after speculative assumptions on the virtual call target fail. Later, they can re-optimize the method according to the &quot;new reality&quot;. ;)

Custom classloaders are irrelevant to inlining because even a standard classloader (system or application one) can be used to load a derived class with the method of interest overridden.

   &gt;&gt;Java&#039;s custom classloaders mean that the class hierarchy
   &gt;&gt;can only be determined at runtime.

This can be done with a standard classloader too.


CUSTOM CLASSLOADERS

  &gt;&gt;This is due to a custom classloaders ability to load 
  &gt;&gt;classes from anywhere on the classpath at any time.

And not only on the classpath - in general, from anywhere up to creating bytecodes (literally, array of bytes) at run-time. 

In theory, custom classloaders hinders AOT compilation but it&#039;s still possible. For example, Excelsior JET Runtime comes with a Caching JIT that caches the results of dynamic compilation. We also provide the JIT Cache Optimizer that, in essence, applies the main AOT compiler to the JIT cache to use the power and resource freedom of a static compiler. After that, on the next app launch the optimized cache works much better. ;)

This way, Java applications using custom classloaders can be AOT-compiled. 

The downside is that checking consistency of the JIT cache (a must for Java compatibility) imposes some start-up overheads and requires the presence of original class files to decide if the cache is up to date or should be (partially) rejected. 

There is yet another approach to resolve this issue - a reasearh work done at IBM back in 2000-2001. Just search for &quot;QuickSilver and Midkiff&quot; 

----------

JSR-294 could make things simpler provided it will not substantially revised and get accepted within the JCP process, which is not a simple procedure. ;)

Thanks,
--Vitaly</description>
		<content:encoded><![CDATA[<p>Hi Rob,</p>
<p>thanks for an interesting post.</p>
<p>I know a little bit of AOT compilation for Java because I&#8217;m the CTO for Excelsior, the maker of Excelsior JET. ;)</p>
<p>Let me add a few notes to what you said.</p>
<p>INLINE</p>
<p>Both RTA &amp; CHA are possible with AOT compilation provided the guarded inline is used. A simple check<br />
is followed by inlined body and the virtual call is put on another branch and considered &#8220;cold&#8221; code. Note that this check is required anyway (even if a final method is inlined) because the receiver (&#8220;this&#8221;) must be checked for null before the body is executed. </p>
<p>Though guarded inline is not as effective as direct one (the merge point in the control flow kills the info that would come from the inlined body), it is still very effective because, for example, method accessors (set/get) work virtually as fast as they would do if inlined directly. </p>
<p>Note also that many JVMs with dynamic compilers also employ guarded inline to avoid expensive recompilation immediately after speculative assumptions on the virtual call target fail. Later, they can re-optimize the method according to the &#8220;new reality&#8221;. ;)</p>
<p>Custom classloaders are irrelevant to inlining because even a standard classloader (system or application one) can be used to load a derived class with the method of interest overridden.</p>
<p>   &gt;&gt;Java&#8217;s custom classloaders mean that the class hierarchy<br />
   &gt;&gt;can only be determined at runtime.</p>
<p>This can be done with a standard classloader too.</p>
<p>CUSTOM CLASSLOADERS</p>
<p>  &gt;&gt;This is due to a custom classloaders ability to load<br />
  &gt;&gt;classes from anywhere on the classpath at any time.</p>
<p>And not only on the classpath &#8211; in general, from anywhere up to creating bytecodes (literally, array of bytes) at run-time. </p>
<p>In theory, custom classloaders hinders AOT compilation but it&#8217;s still possible. For example, Excelsior JET Runtime comes with a Caching JIT that caches the results of dynamic compilation. We also provide the JIT Cache Optimizer that, in essence, applies the main AOT compiler to the JIT cache to use the power and resource freedom of a static compiler. After that, on the next app launch the optimized cache works much better. ;)</p>
<p>This way, Java applications using custom classloaders can be AOT-compiled. </p>
<p>The downside is that checking consistency of the JIT cache (a must for Java compatibility) imposes some start-up overheads and requires the presence of original class files to decide if the cache is up to date or should be (partially) rejected. </p>
<p>There is yet another approach to resolve this issue &#8211; a reasearh work done at IBM back in 2000-2001. Just search for &#8220;QuickSilver and Midkiff&#8221; </p>
<p>&#8212;&#8212;&#8212;-</p>
<p>JSR-294 could make things simpler provided it will not substantially revised and get accepted within the JCP process, which is not a simple procedure. ;)</p>
<p>Thanks,<br />
&#8211;Vitaly</p>
]]></content:encoded>
	</item>
</channel>
</rss>
