|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.go.trove.classfile.FilteredCodeAssembler
| Field Summary | |
protected CodeAssembler |
mAssembler
|
| Constructor Summary | |
FilteredCodeAssembler(CodeAssembler assembler)
|
|
| Method Summary | |
void |
arrayLength()
Generates code for an arraylength instruction. |
void |
branch(Location location)
Generates code that performs an unconditional branch to the specified location. |
void |
breakpoint()
Generates a breakpoint instruction for use in a debugging environment. |
void |
checkCast(TypeDescriptor type)
Generates code that performs an object cast operation. |
void |
convert(java.lang.Class fromType,
java.lang.Class toType)
Generates code that converts the value of a primitive type already on the stack. |
Label |
createLabel()
Creates a label, whose location must be set. |
LocalVariable |
createLocalVariable(java.lang.String name,
TypeDescriptor type)
Creates a LocalVariable reference from a name and type. |
void |
dup()
Generates code for the dup instruction. |
void |
dup2()
Generates code for the dup2 instruction. |
void |
dup2X1()
Generates code for the dup2_x1 instruction. |
void |
dup2X2()
Generates code for the dup2_x2 instruction. |
void |
dupX1()
Generates code for the dup_x1 instruction. |
void |
dupX2()
Generates code for the dup_x2 instruction. |
void |
exceptionHandler(Location startLocation,
Location endLocation,
java.lang.String catchClassName)
Sets up an exception handler located here, the location of the next code to be generated. |
LocalVariable[] |
getParameters()
Returns LocalVariable references for all the parameters passed into the method being assembled, not including any "this" reference. |
void |
ifComparisonBranch(Location location,
java.lang.String choice)
Generates code the performs a conditional branch based on a comparison between two int values on the stack. |
void |
ifEqualBranch(Location location,
boolean choice)
Generates code that performs a conditional branch based on the value of two object references on the stack. |
void |
ifNullBranch(Location location,
boolean choice)
Generates code that performs a conditional branch based on the value of an object on the stack. |
void |
ifZeroComparisonBranch(Location location,
java.lang.String choice)
Generates code the performs a conditional branch based on a comparison between an int value on the stack and zero. |
void |
instanceOf(TypeDescriptor type)
Generates code that performs an instanceof operation. |
void |
integerIncrement(LocalVariable local,
int amount)
Generates code that increments a local integer variable by a signed constant amount. |
void |
invokeConstructor(java.lang.String className,
TypeDescriptor[] params)
Generates code to invoke a class constructor in any class. |
void |
invokeConstructor(TypeDescriptor[] params)
Generates code to invoke a class constructor in this class. |
void |
invokeInterface(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke an interface method in any class. |
void |
invokePrivate(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a private method in this class. |
void |
invokeStatic(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a static method in any class. |
void |
invokeStatic(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a static method in this class. |
void |
invokeSuper(java.lang.String superClassName,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a method in the super class. |
void |
invokeSuperConstructor(TypeDescriptor[] params)
Generates code to invoke a super class constructor. |
void |
invokeVirtual(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a virtual method in any class. |
void |
invokeVirtual(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
Generates code to invoke a virtual method in this class. |
void |
jsr(Location location)
Generates code that performs a subroutine branch to the specified location. |
void |
loadConstant(boolean value)
Generates code that loads a constant boolean value onto the stack. |
void |
loadConstant(double value)
Generates code that loads a constant double value onto the stack. |
void |
loadConstant(float value)
Generates code that loads a constant float value onto the stack. |
void |
loadConstant(int value)
Generates code that loads a constant int, char, short or byte value onto the stack. |
void |
loadConstant(long value)
Generates code that loads a constant long value onto the stack. |
void |
loadConstant(java.lang.String value)
Generates code that loads a constant string value onto the stack. |
void |
loadField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
Generates code that loads a value from a field from any class. |
void |
loadField(java.lang.String fieldName,
TypeDescriptor type)
Generates code that loads a value from a field from this class. |
void |
loadFromArray(java.lang.Class type)
Generates code that loads a value from an array. |
void |
loadLocal(LocalVariable local)
Generates code that loads a local variable onto the stack. |
void |
loadStaticField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
Generates code that loads a value from a static field from any class. |
void |
loadStaticField(java.lang.String fieldName,
TypeDescriptor type)
Generates code that loads a value from a static field from this class. |
void |
loadThis()
Loads a reference to "this" onto the stack. |
void |
mapLineNumber(int lineNumber)
Map the location of the next code to be generated to a line number in source code. |
void |
math(byte opcode)
Generates code for either a unary or binary math operation on one or two values pushed on the stack. |
void |
monitorEnter()
Generates code to enter the monitor on an object loaded on the stack. |
void |
monitorExit()
Generates code to exit the monitor on an object loaded on the stack. |
void |
newObject(TypeDescriptor type)
Generates code to create a new object. |
void |
nop()
Generates an instruction that does nothing. |
void |
pop()
Generates code for the pop instruction. |
void |
pop2()
Generates code for the pop2 instruction. |
void |
ret(LocalVariable local)
Generates code that returns from a subroutine invoked by jsr. |
void |
returnValue(java.lang.Class type)
Generates code that returns an object or primitive type. |
void |
returnVoid()
Generates code that returns void. |
void |
storeField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
Generates code that stores a value into a field from any class. |
void |
storeField(java.lang.String fieldName,
TypeDescriptor type)
Generates code that stores a value into a field from this class. |
void |
storeLocal(LocalVariable local)
Generates code that pops a value off of the stack into a local variable. |
void |
storeStaticField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
Generates code that stores a value into a field from any class. |
void |
storeStaticField(java.lang.String fieldName,
TypeDescriptor type)
Generates code that stores a value into a field from this class. |
void |
storeToArray(java.lang.Class type)
Generates code that stores a value to an array. |
void |
swap()
Generates code for the swap instruction. |
void |
swap2()
Generates code for a swap2 instruction. |
void |
switchBranch(int[] cases,
Location[] locations,
Location defaultLocation)
Generates code for a switch statement. |
void |
throwObject()
Generates code that throws an exception. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final CodeAssembler mAssembler
| Constructor Detail |
public FilteredCodeAssembler(CodeAssembler assembler)
| Method Detail |
public LocalVariable[] getParameters()
CodeAssemblerThe names of the LocalVariables returned by this method are initially set to null. It is encouraged that a name be provided.
getParameters in interface CodeAssembler
public LocalVariable createLocalVariable(java.lang.String name,
TypeDescriptor type)
CodeAssemblercreateLocalVariable in interface CodeAssemblercom.go.trove.classfile.CodeAssemblername - Optional name for the LocalVariable.type - The type of data that the requested LocalVariable can
store.public Label createLabel()
CodeAssemblerCodeBuilder builder; ... Label label = builder.createLabel().setLocation();
createLabel in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerLabel.setLocation()
public void exceptionHandler(Location startLocation,
Location endLocation,
java.lang.String catchClassName)
CodeAssemblerexceptionHandler in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerstartLocation - Location at the start of the section of
code to be wrapped by an exception handler.endLocation - Location directly after the end of the
section of code.catchClassName - The name of the type of exception to be caught;
if null, then catch every object.public void mapLineNumber(int lineNumber)
CodeAssemblermapLineNumber in interface CodeAssemblerpublic void loadConstant(java.lang.String value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadConstant(boolean value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadConstant(int value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadConstant(long value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadConstant(float value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadConstant(double value)
CodeAssemblerloadConstant in interface CodeAssemblerpublic void loadLocal(LocalVariable local)
CodeAssemblerloadLocal in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocal - The local variable referencepublic void loadThis()
CodeAssemblerloadThis in interface CodeAssemblerpublic void storeLocal(LocalVariable local)
CodeAssemblerstoreLocal in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocal - The local variable referencepublic void loadFromArray(java.lang.Class type)
CodeAssemblerThe type doesn't need to be an exact match for objects. Object.class works fine for all objects. For primitive types, use the class that matches that type. For an int the type is int.class.
loadFromArray in interface CodeAssemblercom.go.trove.classfile.CodeAssemblertype - The type of data stored in the array.public void storeToArray(java.lang.Class type)
CodeAssemblerThe type doesn't need to be an exact match for objects. Object.class works fine for all objects. For primitive types, use the class that matches that type. For an int the type is int.class.
storeToArray in interface CodeAssemblercom.go.trove.classfile.CodeAssemblertype - The type of data stored in the array.
public void loadField(java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerloadField in interface CodeAssembler
public void loadField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerloadField in interface CodeAssembler
public void loadStaticField(java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerloadStaticField in interface CodeAssembler
public void loadStaticField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerloadStaticField in interface CodeAssembler
public void storeField(java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerstoreField in interface CodeAssembler
public void storeField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerstoreField in interface CodeAssembler
public void storeStaticField(java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerstoreStaticField in interface CodeAssembler
public void storeStaticField(java.lang.String className,
java.lang.String fieldName,
TypeDescriptor type)
CodeAssemblerstoreStaticField in interface CodeAssemblerpublic void returnVoid()
CodeAssemblerreturnVoid in interface CodeAssemblerpublic void returnValue(java.lang.Class type)
CodeAssemblerThe type doesn't need to be an exact match for objects. Object.class works fine for all objects. For primitive types, use the class that matches that type. For an int the type is int.class.
returnValue in interface CodeAssembler
public void convert(java.lang.Class fromType,
java.lang.Class toType)
CodeAssemblerconvert in interface CodeAssembler
public void invokeVirtual(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeVirtual in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokeVirtual(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeVirtual in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokeStatic(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeStatic in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokeStatic(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeStatic in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokeInterface(java.lang.String className,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeInterface in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokePrivate(java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokePrivate in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.
public void invokeSuper(java.lang.String superClassName,
java.lang.String methodName,
TypeDescriptor ret,
TypeDescriptor[] params)
CodeAssemblerinvokeSuper in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerret - May be null if method returns void.params - May be null if method takes no parameters.public void invokeConstructor(TypeDescriptor[] params)
CodeAssemblerinvokeConstructor in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerparams - May be null if constructor takes no parameters.
public void invokeConstructor(java.lang.String className,
TypeDescriptor[] params)
CodeAssemblerinvokeConstructor in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerparams - May be null if constructor takes no parameters.public void invokeSuperConstructor(TypeDescriptor[] params)
CodeAssemblerinvokeSuperConstructor in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerparams - May be null if constructor takes no parameters.public void newObject(TypeDescriptor type)
CodeAssemblernewObject in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerCodeAssembler.invokeConstructor(com.go.trove.classfile.TypeDescriptor[])public void dup()
CodeAssemblerdup in interface CodeAssemblerpublic void dupX1()
CodeAssemblerdupX1 in interface CodeAssemblerpublic void dupX2()
CodeAssemblerdupX2 in interface CodeAssemblerpublic void dup2()
CodeAssemblerdup2 in interface CodeAssemblerpublic void dup2X1()
CodeAssemblerdup2X1 in interface CodeAssemblerpublic void dup2X2()
CodeAssemblerdup2X2 in interface CodeAssemblerpublic void pop()
CodeAssemblerpop in interface CodeAssemblerpublic void pop2()
CodeAssemblerpop2 in interface CodeAssemblerpublic void swap()
CodeAssemblerswap in interface CodeAssemblerpublic void swap2()
CodeAssemblerswap2 in interface CodeAssemblerpublic void branch(Location location)
CodeAssemblerbranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocation - The location to branch to
public void ifNullBranch(Location location,
boolean choice)
CodeAssemblerifNullBranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocation - The location to branch tochoice - If true, do branch when null, else branch when not null
public void ifEqualBranch(Location location,
boolean choice)
CodeAssemblerifEqualBranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocation - The location to branch tochoice - If true, branch when equal, else branch when not equal
public void ifZeroComparisonBranch(Location location,
java.lang.String choice)
throws java.lang.IllegalArgumentException
CodeAssemblerifZeroComparisonBranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocation - The location to branch tochoice - One of "==", "!=", "<", ">=", ">" or "<="java.lang.IllegalArgumentException - When the choice is not valid
public void ifComparisonBranch(Location location,
java.lang.String choice)
throws java.lang.IllegalArgumentException
CodeAssemblerifComparisonBranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocation - The location to branch tochoice - One of "==", "!=", "<", ">=", ">" or "<="java.lang.IllegalArgumentException - When the choice is not valid
public void switchBranch(int[] cases,
Location[] locations,
Location defaultLocation)
CodeAssemblerThe key value to switch on must already be on the stack when this instruction executes.
switchBranch in interface CodeAssemblercom.go.trove.classfile.CodeAssemblercases - The values to match on. The array length must be the same
as for locations.locations - The locations to branch to for each case.
The array length must be the same as for cases.defaultLocation - The location to branch to if the key on
the stack was not matched.public void jsr(Location location)
CodeAssemblerjsr in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerLocation - The location to branch topublic void ret(LocalVariable local)
CodeAssemblerret in interface CodeAssemblercom.go.trove.classfile.CodeAssemblerlocal - The local variable reference that contains the return
address. The local variable must be of an object type.public void math(byte opcode)
CodeAssemblerPass in an opcode from the the Opcode class. The only valid math opcodes are:
IADD, ISUB, IMUL, IDIV, IREM, INEG, IAND, IOR, IXOR, ISHL, ISHR, IUSHR LADD, LSUB, LMUL, LDIV, LREM, LNEG, LAND, LOR, LXOR, LSHL, LSHR, LUSHR FADD, FSUB, FMUL, FDIV, FREM, FNEG DADD, DSUB, DMUL, DDIV, DREM, DNEG LCMP FCMPG, FCMPL DCMPG, DCMPLA not operation (~) is performed by doing a loadConstant with either -1 or -1L followed by math(Opcode.IXOR) or math(Opcode.LXOR).
math in interface CodeAssemblercom.go.trove.classfile.CodeAssembleropcode - An opcode from the Opcode class.java.lang.IllegalArgumentException - When the opcode selected is not
a math operation.Opcodepublic void arrayLength()
CodeAssemblerarrayLength in interface CodeAssemblerpublic void throwObject()
CodeAssemblerthrowObject in interface CodeAssemblerpublic void checkCast(TypeDescriptor type)
CodeAssemblercheckCast in interface CodeAssemblerpublic void instanceOf(TypeDescriptor type)
CodeAssemblerinstanceOf in interface CodeAssembler
public void integerIncrement(LocalVariable local,
int amount)
CodeAssemblerintegerIncrement in interface CodeAssemblerpublic void monitorEnter()
CodeAssemblermonitorEnter in interface CodeAssemblerpublic void monitorExit()
CodeAssemblermonitorExit in interface CodeAssemblerpublic void nop()
CodeAssemblernop in interface CodeAssemblerpublic void breakpoint()
CodeAssemblerbreakpoint in interface CodeAssembler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||