NPE while opt-compiling LogManager.checkAccess during bootimage writing

Description

A NullPointerException occurs during compilation of checkAccesss in LogManager when OpenJDK is used as the host VM (see environment) and the optimizing compiler is used. The opt compiler tries to read the private static final field controlPermission in LogManager and fails:

 

[java] BootImageWriter: compiler arg: O2
[java] Java Result: 101
[echo] BootImageCompiler: init (opt compiler)
[echo] Compiler failure during compilation of < BootstrapCL, Ljava/util/logging/LogManager; >.checkAccess ()V
[echo] java.lang.NullPointerException
[echo] at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:54)
[echo] at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(UnsafeQualifiedObjectFieldAccessorImpl.java:38)
[echo] at java.lang.reflect.Field.get(Field.java:376)
[echo] at org.jikesrvm.compilers.opt.StaticFieldReader.getObjectStaticFieldValue(StaticFieldReader.java:313)
[echo] at org.jikesrvm.compilers.opt.StaticFieldReader.getStaticFieldValue(StaticFieldReader.java:185)
[echo] at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateFrom(BC2IR.java:1598)
[echo] at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateHIR(BC2IR.java:371)
[echo] at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateHIR(BC2IR.java:169)
[echo] at org.jikesrvm.compilers.opt.bc2ir.ConvertBCtoHIR.perform(ConvertBCtoHIR.java:38)
[echo] at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:78)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:129)
[echo] at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:128)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:170)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:113)
[echo] at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:75)
[echo] at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:80)
[echo] at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:178)
[echo] at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:728)
[echo] at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
[echo] at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1436)
[echo] at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:45)
[echo] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
[echo] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
[echo] at java.lang.Thread.run(Thread.java:679)
[echo] Error compiling method: < BootstrapCL, Ljava/util/logging/LogManager; >.checkAccess ()V
[echo] org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
[echo] failure during compilation of < BootstrapCL, Ljava/util/logging/LogManager; >.checkAccess ()V
[echo]
[echo] at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:265)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:184)
[echo] at org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:113)
[echo] at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:75)
[echo] at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:80)
[echo] at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:178)
[echo] at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:728)
[echo] at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
[echo] at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1436)
[echo] at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:45)
[echo] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
[echo] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
[echo] at java.lang.Thread.run(Thread.java:679)

This seems to be a special case; evaluation of other final Object fields does not lead to NPEs. Relevant threads from the mailing list:
http://sourceforge.net/mailarchive/message.php?msg_id=30028305
http://sourceforge.net/mailarchive/message.php?msg_id=30033788

We need to find the root cause and determine if we need to do anything.

Environment

OpenJDK host VM (e.g. Java 7 Update 9+)

Status

Assignee

Erik Brangs

Reporter

Erik Brangs

Labels

None

Components

Fix versions

Affects versions

Priority

Low
Configure