The program:
class test {
public static void main(String[] args) {
Integer[] x = new Integer[]{1,2};
System.out.println(foo

);
}
private static int foo (Object x) {
if (x instanceof Integer[]) {
return ((int[])x)[1];
} else {
return 0;
}
}
}
should compile and fail with a class cast exception, for the opt compiler we fail with:
./dist/prototype-opt_x86_64-linux/rvm org.jikesrvm.tools.oth.OptTestHarness -methodOpt test main -
Compiling 0 methods baseline
Compiling 1 methods opt
t17a([Ljava/lang/Integer;,x,p): < BootstrapCL, [I > is not assignable with < BootstrapCL, [Ljava/lang/Integer; >
– Stack –
at
[0x716b0af4] Lorg/jikesrvm/VM; sysFail(Ljava/lang/String;)V at line 2113
at
[0x716b0b14] Lorg/jikesrvm/VM; _assertionFailure(Ljava/lang/String;Ljava/lang/String;)V at line 624
at
[0x716b0b3c] Lorg/jikesrvm/VM; _assert(ZLjava/lang/String;Ljava/lang/String;)V at line 607
at
[0x716b0b64] Lorg/jikesrvm/VM; _assert(ZLjava/lang/String;)V at line 597
at
[0x716b0b90] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; assertIsType(Lorg/jikesrvm/compilers/opt/ir/operand/Operand;Lorg/jikesrvm/classloader/TypeReference;)V at line 3465
at
[0x716b0be8] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateFrom(I)V at line 592
at
[0x716b0c08] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateHIR()V at line 364
at
[0x716b0c24] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateHIR(Lorg/jikesrvm/compilers/opt/bc2ir/GenerationContext;)V at line 177
at
[0x716b0c94] Lorg/jikesrvm/compilers/opt/inlining/Inliner; execute(Lorg/jikesrvm/compilers/opt/inlining/InlineDecision;Lorg/jikesrvm/compilers/opt/bc2ir/GenerationContext;Lorg/jikesrvm/compilers/opt/ir/ExceptionHandlerBasicBlockBag;Lorg/jikesrvm/compilers/opt/ir/Instruction;)Lorg/jikesrvm/compilers/opt/bc2ir/GenerationContext; at line 449
at
[0x716b0cd8] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; maybeInlineMethod(Lorg/jikesrvm/compilers/opt/inlining/InlineDecision;Lorg/jikesrvm/compilers/opt/ir/Instruction;)Z at line 4622
at
[0x716b0d30] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateFrom(I)V at line 1975
at
[0x716b0d50] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateHIR()V at line 364
at
[0x716b0d6c] Lorg/jikesrvm/compilers/opt/bc2ir/BC2IR; generateHIR(Lorg/jikesrvm/compilers/opt/bc2ir/GenerationContext;)V at line 177
at
[0x716b0d90] Lorg/jikesrvm/compilers/opt/bc2ir/ConvertBCtoHIR; perform(Lorg/jikesrvm/compilers/opt/ir/IR;)V at line 36
at
[0x716b0db4] Lorg/jikesrvm/compilers/opt/driver/CompilerPhase; performPhase(Lorg/jikesrvm/compilers/opt/ir/IR;)V at line 205
at
[0x716b0df4] Lorg/jikesrvm/compilers/opt/driver/OptimizationPlanAtomicElement; perform(Lorg/jikesrvm/compilers/opt/ir/IR;)V at line 89
at
[0x716b0e28] Lorg/jikesrvm/compilers/opt/driver/OptimizationPlanCompositeElement; perform(Lorg/jikesrvm/compilers/opt/ir/IR;)V at line 143
at
[0x716b0e5c] Lorg/jikesrvm/compilers/opt/driver/CompilationPlan; execute()Lorg/jikesrvm/compilers/opt/ir/IR; at line 131
at
[0x716b0e84] Lorg/jikesrvm/compilers/opt/driver/OptimizingCompiler; compile(Lorg/jikesrvm/compilers/opt/driver/CompilationPlan;)Lorg/jikesrvm/compilers/common/CompiledMethod; at line 224
at
[0x716b0eb4] Lorg/jikesrvm/tools/oth/OptTestHarness; compileMethodsInVector()V at line 363
at
[0x716b0ed8] Lorg/jikesrvm/tools/oth/OptTestHarness; executeCommand()V at line 382
at
[0x716b0ef0] Lorg/jikesrvm/tools/oth/OptTestHarness; main([Ljava/lang/String;)V at line 434
at
[0x716b0f08] <invisible method>
at
[0x716b0f7c] Lorg/jikesrvm/runtime/Reflection; invoke(Lorg/jikesrvm/classloader/RVMMethod;Ljava/lang/Object;[Ljava/lang/Object;Z)Ljava/lang/Object; at line 132
at
[0x716b0fb8] Lorg/jikesrvm/scheduler/MainThread; run()V at line 200
at
[0x716b0fe0] Lorg/jikesrvm/scheduler/RVMThread; run()V at line 595
at
[0x716b1000] Lorg/jikesrvm/scheduler/RVMThread; startoff()V at line 620