RFR(S) 8146201: [AOT] Class static initializers that are not pure should not be executed during static compilation

dean.long at oracle.com dean.long at oracle.com
Mon Mar 19 22:39:53 UTC 2018

Hi Vladimir.  Thanks for looking at it.

On 3/19/18 2:16 PM, Vladimir Kozlov wrote:
> Changes are fine I think but I don't see changes for AOT code 
> mentioned in bug report:
> http://hg.openjdk.java.net/jdk/hs/file/00992d4e8a23/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java#l158 

withEagerResolving(true) by itself is not the problem, except that it 
used to imply "eager initialization" as well.  Now, we allow 
HotSpotClassInitializationPlugin to override the default eagerResolving 
--> implies eagerInitializing behavior, so that for AOT we can have 
eagerResolving == true and eagerInitializing == false.

My first idea was to add withEagerInitializing() to 
GraphBuilderConfiguration, but I decided to go with just the 
HotSpotClassInitializationPlugin changes instead.


> Thanks,
> Vladimir
> On 3/19/18 1:32 PM, dean.long at oracle.com wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8146201
>> http://cr.openjdk.java.net/~dlong/8146201/webrev
>> Previously, jaotc would run static initializers on classes it 
>> accessed during compilation, which is undesirable if those 
>> initializers are not pure.  This change does not attempt to identify 
>> if an initializer is pure.  Instead, the compiler avoids triggering 
>> any initialization at all, while still doing eager resolution and 
>> linking.  The upstream Graal changes have been pushed here:
>> https://github.com/oracle/graal/commit/8411a80308c4dea31b05897c3bbb1c8e642fdd67 
>> where a new HotSpotLazyInitializationTest test was also added.
>> dl

More information about the hotspot-compiler-dev mailing list