ClassCastException in OPT_Simplifier when running antlr DaCapo

Description

It looks to me like perhaps the problem is that the code is assuming that Integer is the only intLike boxed type. Maybe this is true, but I would have expected cases for Boolean, Byte, Short, and Char somewhere in this logic as well as they are all intLike types.

Snippet of stackdump from http://jikesrvm.anu.edu.au/cattrack/results/rvmx86lnx32.anu.edu.au/sanity.826/development/default/dacapo/antlr

OPT_Compiler failure during compilation of < SystemAppCL, Lantlr/preprocessor/Tool; >.processArguments ([Ljava/lang/StringV
java.lang.ClassCastException
at org.jikesrvm.compilers.opt.OPT_Simplifier.boxConstantObjectAsOperand(OPT_Simplifier.java:3178)
at org.jikesrvm.compilers.opt.OPT_Simplifier.call(OPT_Simplifier.java:3132)
at org.jikesrvm.compilers.opt.OPT_Simplifier.simplify(OPT_Simplifier.java:508)
at org.jikesrvm.compilers.opt.OPT_Simple.foldConstants(OPT_Simple.java:573)
at org.jikesrvm.compilers.opt.OPT_Simple.perform(OPT_Simple.java:199)
at org.jikesrvm.compilers.opt.OPT_ExpandRuntimeServices.perform(OPT_ExpandRuntimeServices.java:379)
at org.jikesrvm.compilers.opt.OPT_CompilerPhase.performPhase(OPT_CompilerPhase.java:202)
at org.jikesrvm.compilers.opt.OPT_OptimizationPlanAtomicElement.perform(OPT_OptimizationPlanAtomicElement.java:88)
at org.jikesrvm.compilers.opt.OPT_OptimizationPlanCompositeElement.perform(OPT_OptimizationPlanCompositeElement.java:141)
at org.jikesrvm.compilers.opt.OPT_CompilationPlan.execute(OPT_CompilationPlan.java:107)
at org.jikesrvm.compilers.opt.OPT_Compiler.compile(OPT_Compiler.java:219)
at org.jikesrvm.compilers.common.VM_RuntimeCompiler.optCompile(VM_RuntimeCompiler.java:358)
at org.jikesrvm.compilers.common.VM_RuntimeCompiler.recompileWithOpt(VM_RuntimeCompiler.java:537)
at org.jikesrvm.adaptive.controller.VM_ControllerPlan.doRecompile(VM_ControllerPlan.java:179)
at org.jikesrvm.adaptive.recompilation.VM_CompilationThread.run(VM_CompilationThread.java:53)
org.jikesrvm.compilers.opt.OPT_OptimizingCompilerException: ERROR produced in module:OPT_Compiler
failure during compilation of < SystemAppCL, Lantlr/preprocessor/Tool; >.processArguments ([Ljava/lang/StringV

at org.jikesrvm.compilers.opt.OPT_Compiler.fail(OPT_Compiler.java:314)
at org.jikesrvm.compilers.opt.OPT_Compiler.compile(OPT_Compiler.java:233)
at org.jikesrvm.compilers.common.VM_RuntimeCompiler.optCompile(VM_RuntimeCompiler.java:358)
at org.jikesrvm.compilers.common.VM_RuntimeCompiler.recompileWithOpt(VM_RuntimeCompiler.java:537)
at org.jikesrvm.adaptive.controller.VM_ControllerPlan.doRecompile(VM_ControllerPlan.java:179)
at org.jikesrvm.adaptive.recompilation.VM_CompilationThread.run(VM_CompilationThread.java:53)
Optimizing compiler (via recompileWithOpt): can't optimize "< SystemAppCL, Lantlr/preprocessor/Tool; >.processArguments ([Ljava/lang/StringV" (error was: org.jikesrvm.compilers.opt.OPT_OptimizingCompilerException: ERROR produced in module:OPT_Compiler
failure during compilation of < SystemAppCL, Lantlr/preprocessor/Tool; >.processArguments ([Ljava/lang/StringV
)

– Stack –
at [0x6b2e7f44] Lorg/jikesrvm/compilers/common/VM_RuntimeCompiler; recompileWithOpt(Lorg/jikesrvm/compilers/opt/OPT_CompilationPlanI at line 557
at [0x6b2e7fbc] Lorg/jikesrvm/adaptive/controller/VM_ControllerPlan; doRecompile()Lorg/jikesrvm/compilers/common/VM_CompiledMethod; at line 179
at [0x6b2e7fd8] Lorg/jikesrvm/adaptive/recompilation/VM_CompilationThread; run()V at line 53
at [0x6b2e8000] Lorg/jikesrvm/scheduler/VM_Thread; startoff()V at line 606

The code in question in OPT_Simplifier is:

/**

  • Package up an object as a constant operand

  • @param x the object to package

  • @param t the type of the object (needed to differentiate primitive from numeric types..)

  • @return the constant operand
    */
    private static OPT_ConstantOperand boxConstantObjectAsOperand(Object x, VM_TypeReference t){
    if (VM.VerifyAssertions) VM._assert(!t.isUnboxedType());
    if (t.isIntLikeType()) {
    return IC((Integer)x);
    } else if (t.isLongType()) {
    return LC((Long)x);
    } else if (t.isFloatType()) {
    return FC((Float)x);
    } else if (t.isDoubleType()) {
    return DC((Double)x);
    } else if (x instanceof String) {
    // Handle as object constant but make sure to use interned String
    x = ((String)x).intern();
    return new OPT_ObjectConstantOperand(x, Offset.zero());
    } else if (x instanceof Class) {
    // Handle as object constant
    return new OPT_ObjectConstantOperand(x, Offset.zero());
    } else {
    return new OPT_ObjectConstantOperand(x, Offset.zero());
    }
    }

Environment

None

Status

Assignee

Ian Rogers

Reporter

DaveG

Labels

None

Components

Fix versions

Priority

Low
Configure