Package org.codehaus.groovy.classgen.asm
Class BinaryBooleanExpressionHelper
java.lang.Object
org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
org.codehaus.groovy.classgen.asm.BinaryIntExpressionHelper
org.codehaus.groovy.classgen.asm.BinaryBooleanExpressionHelper
Binary write operations specialised for Booleans
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a boolean-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 ClassNodeprotected 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 booleanwriteDivision(boolean simulate) Writes a division operation for the current primitive type.protected voidwriteMinusMinus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix decrement.protected voidwritePlusPlus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix increment.booleanwritePostOrPrefixMethod(int operation, boolean simulate) Attempts to write a postfix or prefix increment/decrement operation.protected booleanwriteStdOperators(int type, boolean simulate) Writes a standard arithmetic operator for the current primitive type.Methods inherited from class org.codehaus.groovy.classgen.asm.BinaryIntExpressionHelper
getBitwiseOperationBytecode, getCompareCode, supportsDivision, writeSpaceship, writeStdCompareMethods inherited from class org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
arrayGet, arraySet, getArrayGetCaller, getArraySetCaller, getController, setArraySetAndGet, write, writeBitwiseOp, writeShiftOp
-
Constructor Details
-
BinaryBooleanExpressionHelper
Creates a boolean-specialized binary expression helper.- Parameters:
wc- the active writer controller
-
-
Method Details
-
getArrayGetResultType
- Overrides:
getArrayGetResultTypein classBinaryExpressionWriter- Returns:
- the result type produced by
BinaryExpressionWriter.getArrayGetCaller()
-
writePostOrPrefixMethod
public boolean writePostOrPrefixMethod(int operation, boolean simulate) Attempts to write a postfix or prefix increment/decrement operation.- Overrides:
writePostOrPrefixMethodin classBinaryExpressionWriter- Parameters:
operation- the token typesimulate- whether to probe support without emitting bytecode- Returns:
trueif the operation is supported
-
writeStdOperators
protected boolean writeStdOperators(int type, boolean simulate) Writes a standard arithmetic operator for the current primitive type.- Overrides:
writeStdOperatorsin classBinaryExpressionWriter- Parameters:
type- the token typesimulate- whether to probe support without emitting bytecode- Returns:
trueif the operation is supported
-
writeDivision
protected boolean writeDivision(boolean simulate) Writes a division operation for the current primitive type.- Overrides:
writeDivisionin classBinaryExpressionWriter- Parameters:
simulate- whether to probe support without emitting bytecode- Returns:
trueif division is supported
-
getNormalOpResultType
- Overrides:
getNormalOpResultTypein classBinaryIntExpressionHelper- Returns:
- the result type for normal arithmetic operations
-
getDevisionOpResultType
- Overrides:
getDevisionOpResultTypein classBinaryIntExpressionHelper- Returns:
- the result type for division operations
-
getShiftOperationBytecode
protected int getShiftOperationBytecode(int type) Returns the shift opcode for the supplied token.- Overrides:
getShiftOperationBytecodein classBinaryIntExpressionHelper- Parameters:
type- the normalized token index- Returns:
- the ASM opcode
-
getStandardOperationBytecode
protected int getStandardOperationBytecode(int type) Returns the arithmetic opcode for the supplied token.- Overrides:
getStandardOperationBytecodein classBinaryIntExpressionHelper- 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.- Overrides:
removeTwoOperandsin classBinaryIntExpressionHelper- Parameters:
mv- the current method visitor
-
writePlusPlus
protected void writePlusPlus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix increment.- Overrides:
writePlusPlusin classBinaryIntExpressionHelper- Parameters:
mv- the current method visitor
-
writeMinusMinus
protected void writeMinusMinus(org.objectweb.asm.MethodVisitor mv) Emits a prefix/postfix decrement.- Overrides:
writeMinusMinusin classBinaryIntExpressionHelper- Parameters:
mv- the current method visitor
-
doubleTwoOperands
protected void doubleTwoOperands(org.objectweb.asm.MethodVisitor mv) Duplicates the two operands already on the operand stack.- Overrides:
doubleTwoOperandsin classBinaryIntExpressionHelper- Parameters:
mv- the current method visitor
-