NullPointerException in BC2IR when compiling a test case that uses Magic.attemptLong

Description

Running the BC2IR_NPE test run from the attached diff file causes a NPE in BC2IR when trying to access the state of a local variable.

I'm not sure if the test case can be shortened further.

Note that the error disappears if the visibility from the long field is decreased from public to something else.

Compiler failure during compilation of < SystemAppCL, LBC2IR_NPE; >.methodThatCausesNPEInBC2IR ()V
java.lang.NullPointerException
at org.jikesrvm.compilers.opt.bc2ir.BC2IR.getLocal(BC2IR.java:4946)
at org.jikesrvm.compilers.opt.bc2ir.BC2IR.do_aload(BC2IR.java:3029)
at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateFrom(BC2IR.java:538)
at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateHIR(BC2IR.java:371)
at org.jikesrvm.compilers.opt.bc2ir.BC2IR.generateHIR(BC2IR.java:169)
at org.jikesrvm.compilers.opt.bc2ir.ConvertBCtoHIR.perform(ConvertBCtoHIR.java:38)
at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
at org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:78)
at org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:129)
at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:128)
at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:170)
at org.jikesrvm.compilers.common.RuntimeCompiler.optCompile(RuntimeCompiler.java:362)
at org.jikesrvm.compilers.common.RuntimeCompiler.recompileWithOptOnStackSpecialization(RuntimeCompiler.java:491)
at org.jikesrvm.osr.SpecialCompiler.optCompile(SpecialCompiler.java:207)
at org.jikesrvm.osr.SpecialCompiler.recompileState(SpecialCompiler.java:46)
at org.jikesrvm.adaptive.OnStackReplacementPlan.execute(OnStackReplacementPlan.java:120)
at org.jikesrvm.adaptive.recompilation.CompilationThread.run(CompilationThread.java:54)
org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
failure during compilation of < SystemAppCL, LBC2IR_NPE; >.methodThatCausesNPEInBC2IR ()V

at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:265)
at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:184)
at org.jikesrvm.compilers.common.RuntimeCompiler.optCompile(RuntimeCompiler.java:362)
at org.jikesrvm.compilers.common.RuntimeCompiler.recompileWithOptOnStackSpecialization(RuntimeCompiler.java:491)
at org.jikesrvm.osr.SpecialCompiler.optCompile(SpecialCompiler.java:207)
at org.jikesrvm.osr.SpecialCompiler.recompileState(SpecialCompiler.java:46)
at org.jikesrvm.adaptive.OnStackReplacementPlan.execute(OnStackReplacementPlan.java:120)
at org.jikesrvm.adaptive.recompilation.CompilationThread.run(CompilationThread.java:54)
Optimizing compiler (via recompileWithOptOnStackSpecialization): can't optimize "< SystemAppCL, LBC2IR_NPE; >.methodThatCausesNPEInBC2IR ()V" (error was: org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
failure during compilation of < SystemAppCL, LBC2IR_NPE; >.methodThatCausesNPEInBC2IR ()V
)

Thread #12
– Stack –
(0x70e66e68 7651) at [0x70e66e68, 0x64a8a7f4] Lorg/jikesrvm/VM; sysFail(Ljava/lang/StringV at line 2324
(0x70e66ecc 19548) at [0x70e66ecc, 0x64e38dd7] Lorg/jikesrvm/compilers/common/RuntimeCompiler; recompileWithOptOnStackSpecialization(Lorg/jikesrvm/compilers/opt/driver/CompilationPlanLorg/jikesrvm/compilers/common/CompiledMethod; at line 509
(0x70e66f2c 8768) at [0x70e66f2c, 0x64e392c6] Lorg/jikesrvm/osr/SpecialCompiler; optCompile(Lorg/jikesrvm/osr/ExecutionStateLorg/jikesrvm/compilers/common/CompiledMethod; at line 207
(0x70e66f4c 8766) at [0x70e66f4c, 0x64991e01] Lorg/jikesrvm/osr/SpecialCompiler; recompileState(Lorg/jikesrvm/osr/ExecutionState;Z)Lorg/jikesrvm/compilers/common/CompiledMethod; at line 46
(0x70e66fa4 16861) at [0x70e66fa4, 0x64832bc7] Lorg/jikesrvm/adaptive/OnStackReplacementPlan; execute()V at line 120
(0x70e66fc0 10529) at [0x70e66fc0, 0x6500c8da] Lorg/jikesrvm/adaptive/recompilation/CompilationThread; run()V at line 54
(0x70e66ff8 21106) at [0x70e66ff8, 0x0804ff04] Lorg/jikesrvm/scheduler/RVMThread; startoff()V at line 2606

Environment

Probably all (currently reproduced only on x86_64-linux)

Status

Assignee

Unassigned

Reporter

Erik Brangs

Labels

None

Fix versions

Affects versions

Priority

Medium
Configure