private void jitBinary(SingleCondition singleCondition) { Expression left = singleCondition.getLeft(); Expression right = singleCondition.getRight(); Class<?> commonType = singleCondition.getOperation().needsSameType() ? findCommonClass( left.getType(), !left.canBeNull(), right.getType(), !right.canBeNull()) : null; if (commonType == Object.class && singleCondition.getOperation().isComparison()) { commonType = Comparable.class; } if (commonType != null && commonType.isPrimitive()) { jitPrimitiveBinary(singleCondition, left, right, commonType); } else { jitObjectBinary(singleCondition, left, right, commonType); } }
private void jitPrimitiveBinary( SingleCondition singleCondition, Expression left, Expression right, Class<?> type) { if (isFixed(right) && right.canBeNull()) { // a primitive cannot be null mv.visitInsn(singleCondition.getOperation() == BooleanOperator.NE ? ICONST_1 : ICONST_0); return; } Label nullArg = new Label(); ensureNotNullArgs(left, right, nullArg); jitExpression(left, type); castExpressionResultToPrimitive(left, type); jitExpression(right, type); castExpressionResultToPrimitive(right, type); jitPrimitiveOperation(singleCondition.getOperation(), type); Label nonNullArg = new Label(); mv.visitJumpInsn(GOTO, nonNullArg); mv.visitLabel(nullArg); mv.visitInsn(ICONST_0); mv.visitLabel(nonNullArg); }