Ensure correct boxing in compiled code for OpEq with primitives

Without this change when the operands to an == are a mix of a
reference type and a primitive, the failure to box the primitive
would result in a verifyerror when the compiled code is loaded.

Issue: SPR-12557
This commit is contained in:
Andy Clement
2014-12-18 13:46:55 -08:00
parent 3125ef784c
commit abc3cc4dc4
2 changed files with 20 additions and 1 deletions

View File

@@ -112,7 +112,13 @@ public class OpEQ extends Operator {
}
else {
getLeftOperand().generateCode(mv, cf);
if (leftPrim) {
CodeFlow.insertBoxIfNecessary(mv, leftDesc.charAt(0));
}
getRightOperand().generateCode(mv, cf);
if (rightPrim) {
CodeFlow.insertBoxIfNecessary(mv, rightDesc.charAt(0));
}
Label leftNotNull = new Label();
mv.visitInsn(DUP_X1); // Dup right on the top of the stack
mv.visitJumpInsn(IFNONNULL,leftNotNull);