On the EagerInitialization VM flag
bertrand.delsart at oracle.com
Thu Dec 19 23:41:28 PST 2013
I was in fact looking at EagerInitialization code when I saw this e-mail
It might be useful at least for some research projects. As long as it is
'develop' flag turned off in the product, I don't see strong reasons to
remove the code... and we may end up finding good ways of using it !
On 20/12/13 01:06, Krystal Mok wrote:
> Hi David,
> Comments inline below:
> On Thu, Dec 19, 2013 at 3:52 PM, David Holmes <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>> wrote:
> On 20/12/2013 12:18 AM, Krystal Mok wrote:
> Hi David,
> Thanks for the reply, David.
> When turned on, EagerInitialization is only applied to those classes
> that doesn't have a <clinit>()V, which is the case for quite some
> classes and interfaces. If implemented correctly, it's supposed
> to be
> semantically safe, because executing a non-existing initializer
> shouldn't cause side effects visible from the Java level (but doing
> linking and verification at the wrong time is potentially
> Oops! My brain insisted this:
> // abort if the the class has a class initializer
> if (this->class_initializer() != NULL) return;
> was there to skip if there wasn't a class initializer! So everything
> I said was wrong.
> This would better be called EagerLinking as it has nothing to do
> with class initialization in the <clinit> sense.
> It is still valid as EagerInitialization, because in the end the class's
> status will be set to "initialized", so that on first actual use of this
> class it'll be magically "initialized" already and doesn't have to do
> all the checking and stuff.
> I believe both loading and linking (and thus verification) can be
> performed eagerly.
> I wasn't intending to purpose removing the flag and its
> but I'd agree if someone did make such proposal.
> - Kris
> On Thu, Dec 19, 2013 at 4:26 PM, David Holmes
> <david.holmes at oracle.com <mailto:david.holmes at oracle.com>
> <mailto:david.holmes at oracle.__com
> <mailto:david.holmes at oracle.com>>> wrote:
> On 14/12/2013 7:56 AM, Krystal Mok wrote:
> Which is of course true, but not what I really cared about.
> I'm just curious of the history of what that flag tried
> to do,
> and then
> why didn't it work. Any pointers or hints would be
> Given its age it is hard to say why it wasn't removed at
> the time
> 4292939 indicated. What it does is force class
> initialization at
> class loading time. This might have been seen as useful at some
> point but it violates the Java language semantics regarding
> class initialization can occur (eager loading is allowed, eager
> initialization is not).
> Given eager initialization is likely to break the carefully
> class initialization sequence I don't really see its
> utility - hence
> the proposal to remove it.
> On Friday, December 13, 2013, Christian Thalinger wrote:
> Well, it’s a develop flag so it cannot be used in the
> product anyway.
> On Dec 13, 2013, at 11:27 AM, Krystal Mok
> <rednaxelafx at gmail.com <mailto:rednaxelafx at gmail.com>
> <mailto:rednaxelafx at gmail.com <mailto:rednaxelafx at gmail.com>>
> <mailto:rednaxelafx at gmail.com>
> <mailto:rednaxelafx at gmail.com
> <mailto:rednaxelafx at gmail.com>>__');>> wrote:
> Hi all,
> Does anybody still remember the history behind the
> -XX:+EagerInitialization flag? It'd be great
> if someone
> knows what the flag was for, and why it was to
> be removed.
> I saw this bug:
> which stated that this flag was going away in
> "the next
> but now it's still in the code.
More information about the hotspot-runtime-dev