Package org.codehaus.groovy.classgen.asm
Class BinaryFloatExpressionHelper
java.lang.Object
org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
org.codehaus.groovy.classgen.asm.BinaryFloatExpressionHelper
Binary expression helper specialized for
float operations.-
Field Summary
Fields inherited from class org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
stdCompareCodes -
Constructor Summary
ConstructorsConstructorDescriptionBinaryFloatExpressionHelper(WriterController controller) Creates afloat-specialized binary expression helper. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoubleTwoOperands(org.objectweb.asm.MethodVisitor mv) Duplicates the two operands already on the operand stack.protected intgetBitwiseOperationBytecode(int type) Returns the bitwise opcode for the supplied token.protected intprotected intgetCompareCode(int type) Returns the compare opcode for a comparison operator.protected ClassNodeprotected ClassNodeprotected intgetShiftOperationBytecode(int type) Returns the shift opcode for the supplied token.protected intgetStandardOperationBytecode(int type) Returns the arithmetic opcode for the supplied token.protected voidremoveTwoOperands(org.objectweb.asm.MethodVisitor mv) Removes the two operands already on the operand stack.protected booleanwriteBitwiseOp(int type, boolean simulate) writes some the bitwise operations.protected voidwriteMinusMinus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix decrement.protected voidwritePlusPlus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix increment.protected booleanwriteShiftOp(int type, boolean simulate) Write shifting operations.Methods inherited from class org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
arrayGet, arraySet, getArrayGetCaller, getArrayGetResultType, getArraySetCaller, getController, setArraySetAndGet, supportsDivision, write, writeDivision, writePostOrPrefixMethod, writeSpaceship, writeStdCompare, writeStdOperators
-
Constructor Details
-
BinaryFloatExpressionHelper
Creates afloat-specialized binary expression helper.- Parameters:
controller- the active writer controller
-
-
Method Details
-
doubleTwoOperands
protected void doubleTwoOperands(org.objectweb.asm.MethodVisitor mv) Duplicates the two operands already on the operand stack.- Specified by:
doubleTwoOperandsin classBinaryExpressionWriter- Parameters:
mv- the current method visitor
-
writeBitwiseOp
protected boolean writeBitwiseOp(int type, boolean simulate) writes some the bitwise operations. type is one of BITWISE_OR, BITWISE_AND, BITWISE_XOR- Overrides:
writeBitwiseOpin classBinaryExpressionWriter- Parameters:
type- the token type- Returns:
- true if a successful bitwise operation write
-
getBitwiseOperationBytecode
protected int getBitwiseOperationBytecode(int type) Returns the bitwise opcode for the supplied token.- Specified by:
getBitwiseOperationBytecodein classBinaryExpressionWriter- Parameters:
type- the normalized token index- Returns:
- the ASM opcode
-
getCompareCode
protected int getCompareCode()- Specified by:
getCompareCodein classBinaryExpressionWriter- Returns:
- the ASM compare opcode used by this primitive type
-
getCompareCode
protected int getCompareCode(int type) Returns the compare opcode for a comparison operator. The default isBinaryExpressionWriter.getCompareCode(); a floating-point type overrides it so that a NaN operand makes the comparison false.FCMPL yields -1 and FCMPG yields 1 for a NaN operand, so FCMPL is used for
>and>=and FCMPG otherwise; either way the comparison is false, as in Java (JLS 15.20.1).- Overrides:
getCompareCodein classBinaryExpressionWriter- Parameters:
type- the token type of the comparison operator- Returns:
- the ASM compare opcode
-
getNormalOpResultType
- Specified by:
getNormalOpResultTypein classBinaryExpressionWriter- Returns:
- the result type for normal arithmetic operations
-
writeShiftOp
protected boolean writeShiftOp(int type, boolean simulate) Write shifting operations. Type is one of LEFT_SHIFT, RIGHT_SHIFT, or RIGHT_SHIFT_UNSIGNED- Overrides:
writeShiftOpin classBinaryExpressionWriter- Parameters:
type- the token type- Returns:
- true on a successful shift operation write
-
getShiftOperationBytecode
protected int getShiftOperationBytecode(int type) Returns the shift opcode for the supplied token.- Specified by:
getShiftOperationBytecodein classBinaryExpressionWriter- Parameters:
type- the normalized token index- Returns:
- the ASM opcode
-
getStandardOperationBytecode
protected int getStandardOperationBytecode(int type) Returns the arithmetic opcode for the supplied token.- Specified by:
getStandardOperationBytecodein classBinaryExpressionWriter- Parameters:
type- the normalized token index- Returns:
- the ASM opcode
-
removeTwoOperands
protected void removeTwoOperands(org.objectweb.asm.MethodVisitor mv) Removes the two operands already on the operand stack.- Specified by:
removeTwoOperandsin classBinaryExpressionWriter- Parameters:
mv- the current method visitor
-
writeMinusMinus
protected void writeMinusMinus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix decrement.- Specified by:
writeMinusMinusin classBinaryExpressionWriter- Parameters:
mv- the current method visitor
-
writePlusPlus
protected void writePlusPlus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix increment.- Specified by:
writePlusPlusin classBinaryExpressionWriter- Parameters:
mv- the current method visitor
-
getDevisionOpResultType
- Specified by:
getDevisionOpResultTypein classBinaryExpressionWriter- Returns:
- the result type for division operations
-