generator.emit(OpCode.ARRAYLENGTH);
return;
}
case IsNull: {
final Label ifNonNull = generator.defineLabel();
final Label exit = generator.defineLabel();
generator.emit(OpCode.IFNONNULL, ifNonNull);
generator.emitBoolean(true);
generator.emitGoto(exit);
generator.markLabel(ifNonNull);
generator.emitBoolean(false);
generator.markLabel(exit);
return;
}
case IsNotNull: {
final Label ifNull = generator.defineLabel();
final Label exit = generator.defineLabel();
generator.emit(OpCode.IFNULL, ifNull);
generator.emitBoolean(true);
generator.emitGoto(exit);
generator.markLabel(ifNull);
generator.emitBoolean(false);
generator.markLabel(exit);
return;
}
}
final Type unboxedType = TypeUtils.getUnderlyingPrimitiveOrSelf(operandType);
if (operandIsBoxed) {
generator.emitUnbox(operandType);
}
switch (op) {
case Not:
case OnesComplement: {
switch (unboxedType.getKind()) {
case BOOLEAN: {
final Label ifTrue = generator.defineLabel();
final Label exit = generator.defineLabel();
generator.emitBoolean(false);
generator.emit(OpCode.IF_ICMPNE, ifTrue);
generator.emitBoolean(true);
generator.emitGoto(exit);
generator.markLabel(ifTrue);
generator.emitBoolean(false);
generator.markLabel(exit);
break;
}
case BYTE:
case SHORT:
case INT: {
generator.emitInteger(-1);
generator.emit(OpCode.IXOR);
break;
}
case LONG: {
generator.emitLong(-1L);
generator.emit(OpCode.LXOR);
break;
}
case CHAR: {
generator.emitInteger(-1);
generator.emit(OpCode.IXOR);
break;
}
default: {
throw Error.unaryOperatorNotDefined(op, unboxedType);
}
}
break;
}
case IsFalse: {
final Label ifTrue = generator.defineLabel();
final Label exit = generator.defineLabel();
generator.emitBoolean(false);
generator.emit(OpCode.IF_ICMPNE, ifTrue);
generator.emitBoolean(true);
generator.emitGoto(exit);
generator.markLabel(ifTrue);
generator.emitBoolean(false);
generator.markLabel(exit);
// Not an arithmetic operation -> no conversion
return;
}
case IsTrue: {
final Label ifFalse = generator.defineLabel();
final Label exit = generator.defineLabel();
generator.emitBoolean(false);
generator.emit(OpCode.IF_ICMPEQ, ifFalse);
generator.emitBoolean(true);
generator.emitGoto(exit);