Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.9.3
-
Component/s: Compiler: Optimizing, Instruction Architecture: Intel
-
Labels:None
-
Number of attachments :
Description
Since introducing the typed assembler a latent bug in production Opt 0 builds has been exposed. Here's the stack trace:
[echo] OPT_Compiler failure during compilation of < BootstrapCL, Lorg/jikesrvm/adaptive/controller/VM_ControllerMemory; >.asString ()Ljava/lang/String;
[echo] java.lang.ArrayIndexOutOfBoundsException: 29
[echo] at org.jikesrvm.ia32.VM_RegisterConstants$GPR.lookup(VM_RegisterConstants.java:66)
[echo] at org.jikesrvm.compilers.opt.ia32.OPT_AssemblerBase.getGPMachineRegister(OPT_AssemblerBase.java:221)
[echo] at org.jikesrvm.compilers.opt.ia32.OPT_AssemblerBase.getGPR_Reg(OPT_AssemblerBase.java:281)
[echo] at org.jikesrvm.compilers.opt.ia32.OPT_Assembler.doMOV(OPT_Assembler.java:2123)
[echo] at org.jikesrvm.compilers.opt.ia32.OPT_Assembler.doInst(OPT_Assembler.java:13418)
[echo] at org.jikesrvm.compilers.opt.ia32.OPT_AssemblerBase.generateCode(OPT_AssemblerBase.java:1016)
[echo] at org.jikesrvm.compilers.opt.OPT_ConvertMIRtoMC$AssemblerDriver.perform(OPT_ConvertMIRtoMC.java:100)
[echo] at org.jikesrvm.compilers.opt.OPT_CompilerPhase.performPhase(OPT_CompilerPhase.java:202)
[echo] at org.jikesrvm.compilers.opt.OPT_OptimizationPlanAtomicElement.perform(OPT_OptimizationPlanAtomicElement.java:88)
[echo] at org.jikesrvm.compilers.opt.OPT_OptimizationPlanCompositeElement.perform(OPT_OptimizationPlanCompositeElement.java:141)
[echo] at org.jikesrvm.compilers.opt.OPT_CompilationPlan.execute(OPT_CompilationPlan.java:128)
[echo] at org.jikesrvm.compilers.opt.OPT_Compiler.compile(OPT_Compiler.java:219)
[echo] at org.jikesrvm.compilers.opt.VM_OptimizingBootImageCompiler.compileMethod(VM_OptimizingBootImageCompiler.java:115)
[echo] at org.jikesrvm.compilers.common.VM_BootImageCompiler.compile(VM_BootImageCompiler.java:62)
[echo] at org.jikesrvm.compilers.common.VM_BootImageCompiler.compile(VM_BootImageCompiler.java:66)
[echo] at org.jikesrvm.classloader.VM_NormalMethod.genCode(VM_NormalMethod.java:168)
[echo] at org.jikesrvm.classloader.VM_Method.compile(VM_Method.java:645)
[echo] at org.jikesrvm.classloader.VM_Method.getCurrentEntryCodeArray(VM_Method.java:629)
[echo] at org.jikesrvm.classloader.VM_Class.instantiate(VM_Class.java:1995)
[echo] at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
[echo] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
[echo] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
[echo] at java.lang.Thread.run(Thread.java:619)
[echo] Error compiling method: < BootstrapCL, Lorg/jikesrvm/adaptive/controller/VM_ControllerMemory; >.asString ()Ljava/lang/String;
So the reason for the bug is that it looks like we don't allocate registers for unreachable code. In O0 the unreachable code need not have been removed by branch optimizations. This means when we try to assemble the unreachable code its invalid. It strikes me that we don't want to be compiling unreachable code in O0.