Class MethodCompiler
- java.lang.Object
-
- org.vesalainen.bcc.Assembler
-
- org.vesalainen.bcc.MethodCompiler
-
-
Field Summary
Fields Modifier and Type Field Description private CodeAttributecodeprivate booleancompiledprivate javax.lang.model.element.ExecutableElementdebugMethodprivate booleandumpprivate java.util.List<ExceptionTable>exceptionTableListprotected javax.lang.model.element.ExecutableElementexecutableElementprotected javax.lang.model.type.ExecutableTypeexecutableTypeprivate java.util.List<javax.lang.model.element.VariableElement>localVariablesprivate MethodInfomethodInfoprivate booleanoptimizeprotected SubClasssubClassprivate java.lang.Stringsubroutinestatic java.lang.StringSUBROUTINERETURNADDRESSNAME-
Fields inherited from class org.vesalainen.bcc.Assembler
asm, asmStack, labelMap, labels, out, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, types, WIDEFIXOFFSET, wideIndex
-
Fields inherited from interface org.vesalainen.bcc.OpCode
AALOAD, AASTORE, ACONST_NULL, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, BALOAD, BASTORE, BIPUSH, BREAKPOINT, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, GETFIELD, GETSTATIC, GOTO, GOTO_W, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMPDEP1, IMPDEP2, IMUL, INEG, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, IUSHR, IXOR, JSR, JSR_W, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDC_W, LDC2_W, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NOT_IF_ACMPEQ, NOT_IF_ACMPNE, NOT_IF_ICMPEQ, NOT_IF_ICMPGE, NOT_IF_ICMPGT, NOT_IF_ICMPLE, NOT_IF_ICMPLT, NOT_IF_ICMPNE, NOT_IFEQ, NOT_IFGE, NOT_IFGT, NOT_IFLE, NOT_IFLT, NOT_IFNE, NOT_IFNONNULL, NOT_IFNULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, TABLESWITCH, WIDE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodCompiler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddExceptionHandler(Block block, java.lang.String handler, java.lang.Class<? extends java.lang.Throwable>... catchTypes)Adds an exception handler.voidaddExceptionHandler(Block block, java.lang.String handler, java.util.List<? extends javax.lang.model.type.TypeMirror> thrownTypes)Adds an exception handler.voidaddNewArray(java.lang.String name, java.lang.Class<?> aClass, int size)Create new arrayvoidaddNewArray(java.lang.String name, javax.lang.model.type.TypeMirror type, int size)Create new arrayvoidaddVariable(java.lang.String name, java.lang.Class<?> type)Add new local variablevoidaddVariable(java.lang.String name, javax.lang.model.type.TypeMirror type)Add new local variablevoidanew(java.lang.Class<?> clazz)Create new objectvoidanew(javax.lang.model.element.TypeElement clazz)Create new objectprivate intargumentCount(java.util.List<? extends javax.lang.model.element.VariableElement> parameters)voidassignDefault(java.lang.String name)assign default type for local variable depending on type.voidcheckcast(java.lang.Class<?> objectref)Check whether object is of given typevoidcheckcast(javax.lang.model.element.TypeElement objectref)Check whether object is of given typevoidcheckcast(javax.lang.model.type.TypeMirror type)Check whether object is of given typevoidconvert(java.lang.String fromVariable, javax.lang.model.type.TypeMirror to)Convert a local variable to given type.voiddconst(double value)Push double constant.voidend()Deprecated.Current implementation does nothingvoidendSubroutine()voidfconst(float value)Push float constant.voidfixAddress(java.lang.String name)Labels a current positionjavax.lang.model.element.ExecutableElementgetExecutableElement()voidgetField(java.lang.Class<?> cls, java.lang.String name)Get field from classvoidgetField(java.lang.String name)Get field from this classvoidgetField(javax.lang.model.element.VariableElement field)Fetch field from objectjava.lang.StringgetLocalDescription(int index)return a descriptive text about local variable named name.java.lang.StringgetLocalName(int index)Returns the name of local variable at indexjavax.lang.model.type.TypeMirrorgetLocalType(int index)Returns the type of local variable at indexjavax.lang.model.type.TypeMirrorgetLocalType(java.lang.String name)returns the type of local variable named name.javax.lang.model.element.VariableElementgetLocalVariable(int index)Returns local variable at index.javax.lang.model.element.VariableElementgetLocalVariable(java.lang.String name)intgetLocalVariableIndex(java.lang.String name)java.lang.StringgetMethodDescription()java.lang.StringgetModifiers()java.util.List<? extends javax.lang.model.type.TypeMirror>getParameters()javax.lang.model.type.TypeMirrorgetReturnType()voidgetStaticField(java.lang.Class<?> cls, java.lang.String name)Get field from classvoidgetStaticField(java.lang.String name)Get field from this classvoidgetStaticField(javax.lang.model.element.VariableElement field)Fetch field from objectSubClassgetSubClass()booleanhasLocalVariable(java.lang.String name)Return true if named variable is added.voidiconst(boolean value)Push int constantvoidiconst(int value)Push int constant.protected abstract voidimplement()voidinc(java.lang.String name, int con)Increment local variable or field by constantvoidinvoke(javax.lang.model.element.ExecutableElement method)voidinvokeConstructor(java.lang.Class<?> cls, java.lang.Class<?>... parameters)voidinvokeMethod(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters)voidinvokespecial(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters)Invoke instance method; special handling for superclass, private, and instance initialization method invocationsvoidinvokespecial(javax.lang.model.element.ExecutableElement method)Invoke instance method; special handling for superclass, private, and instance initialization method invocationsvoidinvokestatic(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters)Invoke a class (static) methodvoidinvokestatic(javax.lang.model.element.ExecutableElement method)Invoke a class (static) methodvoidinvokevirtual(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters)Invoke instance method; dispatch based on classIf method is interface calls invokeinterface otherwise calls invokevirtual.voidinvokevirtual(javax.lang.model.element.ExecutableElement method)Invoke instance method; dispatch based on classIf method is interface calls invokeinterface otherwise calls invokevirtual.voidlconst(long value)Push long constant.voidldc(double constant)Push item from runtime constant pool.voidldc(float constant)Push item from runtime constant pool.voidldc(int constant)Push item from runtime constant pool.voidldc(long constant)Push item from runtime constant pool.voidldc(java.lang.Class constant)voidldc(java.lang.String constant)Push item from runtime constant pool.voidload(java.lang.String name)Load from local variable or non-static fieldvoidloadDefault(java.lang.Class<?> type)Load default value to stack depending on typevoidloadDefault(javax.lang.model.type.TypeMirror type)Load default value to stack depending on typeintlocalSize()private intlocalSize(int offset, int length)voidlookupswitch(LookupList list)Compiles lookupswitchvoidnameArgument(java.lang.String name, int index)Names an argumentvoidnameArguments(java.lang.String[] args)voidnewarray(java.lang.Class<?> type, int count)Create new arrayvoidnewarray(javax.lang.model.type.TypeMirror type, int count)Create new arrayvoidoptimizedSwitch(java.lang.String def, LookupList list)Compiles a tableswitch, lookupswitch or if/goto depending on contents of LookupList.voidoptimizedSwitch(LookupList list)Compiles a tableswitch, lookupswitch or if/goto depending on contents of LookupList.voidputField(java.lang.Class<?> cls, java.lang.String name)Set field in classvoidputField(java.lang.String name)Set field in this classvoidputField(javax.lang.model.element.VariableElement field)Set field in objectvoidputStaticField(java.lang.Class<?> cls, java.lang.String name)Set field in classvoidputStaticField(java.lang.String name)Set field in this classvoidputStaticField(javax.lang.model.element.VariableElement field)Set static field in objectvoidresetSubroutine()Reset a started subroutinevoidsetDebug(javax.lang.model.element.ExecutableElement debug)voidsetOptimize(boolean optimize)Set the compiler optimize flag.(package private) voidstartImplement(SubClass subClass, MethodInfo methodInfo)voidstartSubroutine(java.lang.String target)Compiles the subroutine start.voidstore(java.lang.String name)Store into local variable or non-static fieldvoidtableswitch(int low, int high, java.lang.String... symbols)Compiles tableswitchvoidtableswitch(int low, int high, java.util.List<java.lang.String> symbols)Compiles tableswitchvoidtconst(boolean value)voidtconst(byte value)voidtconst(char value)voidtconst(double value)voidtconst(float value)voidtconst(int value)voidtconst(long value)voidtconst(java.lang.Object value)voidtconst(java.lang.String value)voidtinc(java.lang.String name, int con)Increment local variable by constantvoidtload(java.lang.String name)Load from local variablejava.lang.StringtoString()voidtreturn()Return.voidtstore(java.lang.String name)Store into local variablejavax.lang.model.type.TypeMirrortypeForCount(int count)Return a integral class able to support count values-
Methods inherited from class org.vesalainen.bcc.Assembler
aaload, aastore, aconst_null, aload, anew, anewarray, arraylength, astore, athrow, baload, bastore, bipush, caload, castore, checkcast, convert, createBranch, createBranch, d2f, d2i, d2l, d2t, dadd, daload, dastore, dconst, ddiv, dload, dmul, dneg, dstore, dsub, dup, dup_x1, dup_x2, dup2, dup2_x1, dup2_x2, endBlock, f2d, f2i, f2l, f2t, fadd, faload, fastore, fconst, fdiv, fixLabels, fload, fmul, fneg, frem, fstore, fsub, getCode, getfield, getLabel, getstatic, goto_n, goto_w, i2b, i2c, i2d, i2f, i2l, i2s, i2t, iadd, iaload, iand, iastore, idiv, if_icmpeq, if_icmpge, if_icmpgt, if_icmple, if_icmplt, if_icmpne, if_tcmpeq, if_tcmpge, if_tcmpgt, if_tcmple, if_tcmplt, if_tcmpne, ifeq, ifge, ifgt, ifle, iflt, ifne, ifnonnull, ifnull, iinc, iload, imul, instanceo, invokeinterface, invokespecial, invokestatic, invokevirtual, ior, irem, ireturn, ishl, ishr, isReferenced, istore, isub, iushr, ixor, jsr, jsr_w, l2d, l2f, l2i, l2t, labelForAddress, ladd, laload, land, lastore, lconst, ldc_w, ldc2_w, ldiv, lload, lmul, lneg, lookupswitch, lor, lrem, lshl, lshr, lstore, lsub, lushr, lxor, monitorenter, monitorexit, multianewarray, newarray, nop, pop, pop2, position, putfield, putstatic, ret, saload, sastore, setWideIndex, sipush, startBlock, swap, tableswitch, tadd, taload, tand, tastore, tcmp, tcmpg, tcmpl, tcmpl, tconst, tdiv, tinc, tipush, tload, tmul, tneg, tor, trem, treturn, tshl, tshr, tstore, tsub, tushr, txor
-
-
-
-
Field Detail
-
SUBROUTINERETURNADDRESSNAME
public static final java.lang.String SUBROUTINERETURNADDRESSNAME
- See Also:
- Constant Field Values
-
subClass
protected SubClass subClass
-
code
private CodeAttribute code
-
localVariables
private final java.util.List<javax.lang.model.element.VariableElement> localVariables
-
debugMethod
private javax.lang.model.element.ExecutableElement debugMethod
-
compiled
private boolean compiled
-
subroutine
private java.lang.String subroutine
-
optimize
private boolean optimize
-
dump
private boolean dump
-
exceptionTableList
private final java.util.List<ExceptionTable> exceptionTableList
-
methodInfo
private MethodInfo methodInfo
-
executableElement
protected javax.lang.model.element.ExecutableElement executableElement
-
executableType
protected javax.lang.model.type.ExecutableType executableType
-
-
Method Detail
-
startImplement
void startImplement(SubClass subClass, MethodInfo methodInfo) throws java.io.IOException
- Throws:
java.io.IOException
-
getExecutableElement
public javax.lang.model.element.ExecutableElement getExecutableElement()
-
getSubClass
public SubClass getSubClass()
-
getModifiers
public java.lang.String getModifiers()
-
setOptimize
public void setOptimize(boolean optimize)
Set the compiler optimize flag. Affects switches- Parameters:
optimize-
-
getMethodDescription
public java.lang.String getMethodDescription()
-
getParameters
public java.util.List<? extends javax.lang.model.type.TypeMirror> getParameters()
-
getReturnType
public javax.lang.model.type.TypeMirror getReturnType()
-
localSize
public int localSize()
-
localSize
private int localSize(int offset, int length)
-
nameArgument
public final void nameArgument(java.lang.String name, int index)Names an argument- Parameters:
name- Argument nameindex- First argument is 1, this = 0
-
getLocalVariable
public javax.lang.model.element.VariableElement getLocalVariable(int index)
Returns local variable at index. Note! long and double take two positions.- Parameters:
index-- Returns:
-
getLocalVariable
public javax.lang.model.element.VariableElement getLocalVariable(java.lang.String name)
-
getLocalVariableIndex
public int getLocalVariableIndex(java.lang.String name)
-
nameArguments
public void nameArguments(java.lang.String[] args)
-
getLocalName
public java.lang.String getLocalName(int index)
Returns the name of local variable at index- Parameters:
index-- Returns:
-
getLocalType
public javax.lang.model.type.TypeMirror getLocalType(int index)
Returns the type of local variable at index- Parameters:
index-- Returns:
-
getLocalType
public javax.lang.model.type.TypeMirror getLocalType(java.lang.String name)
returns the type of local variable named name.- Parameters:
name-- Returns:
-
hasLocalVariable
public boolean hasLocalVariable(java.lang.String name)
Return true if named variable is added.- Parameters:
name-- Returns:
-
getLocalDescription
public java.lang.String getLocalDescription(int index)
return a descriptive text about local variable named name.- Parameters:
index-- Returns:
-
addVariable
public void addVariable(java.lang.String name, java.lang.Class<?> type)Add new local variable- Parameters:
name-type-
-
addVariable
public void addVariable(java.lang.String name, javax.lang.model.type.TypeMirror type)Add new local variable- Parameters:
name-type-
-
assignDefault
public void assignDefault(java.lang.String name) throws java.io.IOExceptionassign default type for local variable depending on type. (false, 0, null)- Parameters:
name-- Throws:
java.io.IOException
-
loadDefault
public void loadDefault(java.lang.Class<?> type) throws java.io.IOExceptionLoad default value to stack depending on type- Parameters:
type-- Throws:
java.io.IOException
-
loadDefault
public void loadDefault(javax.lang.model.type.TypeMirror type) throws java.io.IOExceptionLoad default value to stack depending on type- Parameters:
type-- Throws:
java.io.IOException
-
startSubroutine
public void startSubroutine(java.lang.String target) throws java.io.IOExceptionCompiles the subroutine start. Use endSubroutine to end that subroutine.- Parameters:
target-- Throws:
java.io.IOException
-
endSubroutine
public void endSubroutine() throws java.io.IOException- Throws:
java.io.IOException
-
resetSubroutine
public void resetSubroutine()
Reset a started subroutine
-
newarray
public void newarray(java.lang.Class<?> type, int count) throws java.io.IOExceptionCreate new arrayStack: ..., count => ..., arrayref
- Parameters:
type- array class eg. String[].classcount- array count- Throws:
java.io.IOException
-
newarray
public void newarray(javax.lang.model.type.TypeMirror type, int count) throws java.io.IOExceptionCreate new arrayStack: ..., => ..., arrayref
- Parameters:
type- array class eg. String[].classcount- array count- Throws:
java.io.IOException
-
typeForCount
public javax.lang.model.type.TypeMirror typeForCount(int count)
Return a integral class able to support count values- Parameters:
count-- Returns:
-
tload
public void tload(java.lang.String name) throws java.io.IOExceptionLoad from local variableStack: ... => ..., value
- Parameters:
name- local variable name- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
load
public void load(java.lang.String name) throws java.io.IOExceptionLoad from local variable or non-static fieldStack: ... => ..., value
- Parameters:
name- local variable name- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
tstore
public void tstore(java.lang.String name) throws java.io.IOExceptionStore into local variableStack: ..., value => ...
- Parameters:
name- local variable name- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
store
public void store(java.lang.String name) throws java.io.IOExceptionStore into local variable or non-static fieldStack: ..., value => ...
- Parameters:
name- local variable name- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
inc
public void inc(java.lang.String name, int con) throws java.io.IOExceptionIncrement local variable or field by constantStack: No change
- Parameters:
name- local variable namecon- signed byte- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
tinc
public void tinc(java.lang.String name, int con) throws java.io.IOExceptionIncrement local variable by constantStack: No change
- Parameters:
name- local variable namecon- signed byte- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
treturn
public void treturn() throws java.io.IOExceptionReturn. If return type is other than void the value at stack is returnedStack: ..., result => ...
- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
setDebug
public void setDebug(javax.lang.model.element.ExecutableElement debug)
-
fixAddress
public void fixAddress(java.lang.String name) throws java.io.IOExceptionLabels a current position- Overrides:
fixAddressin classAssembler- Parameters:
name-- Throws:
java.io.IOException
-
anew
public void anew(java.lang.Class<?> clazz) throws java.io.IOExceptionCreate new objectStack: ... => ..., objectref
- Parameters:
clazz-- Throws:
java.io.IOException
-
anew
public void anew(javax.lang.model.element.TypeElement clazz) throws java.io.IOExceptionCreate new objectStack: ... => ..., objectref
- Parameters:
clazz-- Throws:
java.io.IOException
-
tconst
public void tconst(java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(int value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(boolean value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(char value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(byte value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(long value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(float value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(double value) throws java.io.IOException- Throws:
java.io.IOException
-
tconst
public void tconst(java.lang.String value) throws java.io.IOException- Throws:
java.io.IOException
-
ldc
public void ldc(int constant) throws java.io.IOExceptionPush item from runtime constant pool. Creates new constant if neededStack: ... => ..., value
- Overrides:
ldcin classAssembler- Parameters:
constant- int constant- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
ldc
public void ldc(float constant) throws java.io.IOExceptionPush item from runtime constant pool. Creates new constant if neededStack: ... => ..., value
- Parameters:
constant- float constant- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
ldc
public void ldc(long constant) throws java.io.IOExceptionPush item from runtime constant pool. Creates new constant if neededStack: ... => ..., value
- Parameters:
constant- long constant- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
ldc
public void ldc(double constant) throws java.io.IOExceptionPush item from runtime constant pool. Creates new constant if neededStack: ... => ..., value
- Parameters:
constant- double constant- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
ldc
public void ldc(java.lang.String constant) throws java.io.IOExceptionPush item from runtime constant pool. Creates new constant if neededStack: ... => ..., value
- Parameters:
constant- String constant- Throws:
java.io.IOException- See Also:
nameArgument(java.lang.String,int),addVariable(java.lang.String,java.lang.Class<?>)
-
ldc
public void ldc(java.lang.Class constant) throws java.io.IOException- Throws:
java.io.IOException
-
getField
public void getField(javax.lang.model.element.VariableElement field) throws java.io.IOExceptionFetch field from objectStack: ..., objectref => ..., value
- Parameters:
field-- Throws:
java.io.IOException
-
getStaticField
public void getStaticField(javax.lang.model.element.VariableElement field) throws java.io.IOExceptionFetch field from objectStack: ..., objectref => ..., value
- Parameters:
field-- Throws:
java.io.IOException
-
getField
public void getField(java.lang.Class<?> cls, java.lang.String name) throws java.io.IOExceptionGet field from classStack: ..., => ..., value
- Parameters:
cls-name-- Throws:
java.io.IOException
-
getField
public void getField(java.lang.String name) throws java.io.IOExceptionGet field from this classStack: ..., => ..., value
- Parameters:
name-- Throws:
java.io.IOException
-
getStaticField
public void getStaticField(java.lang.Class<?> cls, java.lang.String name) throws java.io.IOExceptionGet field from classStack: ..., => ..., value
- Parameters:
cls-name-- Throws:
java.io.IOException
-
getStaticField
public void getStaticField(java.lang.String name) throws java.io.IOExceptionGet field from this classStack: ..., => ..., value
- Parameters:
name-- Throws:
java.io.IOException
-
putField
public void putField(javax.lang.model.element.VariableElement field) throws java.io.IOExceptionSet field in objectStack: ..., objectref, value => ...
- Parameters:
field-- Throws:
java.io.IOException
-
putStaticField
public void putStaticField(javax.lang.model.element.VariableElement field) throws java.io.IOExceptionSet static field in objectStack: ..., objectref, value => ...
- Parameters:
field-- Throws:
java.io.IOException
-
putField
public void putField(java.lang.Class<?> cls, java.lang.String name) throws java.io.IOExceptionSet field in classStack: ..., value => ...
- Parameters:
cls-name-- Throws:
java.io.IOException
-
putField
public void putField(java.lang.String name) throws java.io.IOExceptionSet field in this classStack: ..., value => ...
- Parameters:
name-- Throws:
java.io.IOException
-
putStaticField
public void putStaticField(java.lang.Class<?> cls, java.lang.String name) throws java.io.IOExceptionSet field in classStack: ..., value => ...
- Parameters:
cls-name-- Throws:
java.io.IOException
-
putStaticField
public void putStaticField(java.lang.String name) throws java.io.IOExceptionSet field in this classStack: ..., value => ...
- Parameters:
name-- Throws:
java.io.IOException
-
invokeConstructor
public void invokeConstructor(java.lang.Class<?> cls, java.lang.Class<?>... parameters) throws java.io.IOException- Parameters:
cls-parameters-- Throws:
java.io.IOException
-
invokeMethod
public void invokeMethod(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters) throws java.io.IOException- Parameters:
cls-name-parameters-- Throws:
java.io.IOException
-
invoke
public void invoke(javax.lang.model.element.ExecutableElement method) throws java.io.IOException- Parameters:
method-- Throws:
java.io.IOException
-
invokespecial
public void invokespecial(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters) throws java.io.IOExceptionInvoke instance method; special handling for superclass, private, and instance initialization method invocationsStack: ..., objectref, [arg1, [arg2 ...]] => ...
- Parameters:
cls-name-parameters-- Throws:
java.io.IOException
-
invokespecial
public void invokespecial(javax.lang.model.element.ExecutableElement method) throws java.io.IOExceptionInvoke instance method; special handling for superclass, private, and instance initialization method invocationsStack: ..., objectref, [arg1, [arg2 ...]] => ...
- Parameters:
method-- Throws:
java.io.IOException
-
invokevirtual
public void invokevirtual(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters) throws java.io.IOExceptionInvoke instance method; dispatch based on classIf method is interface calls invokeinterface otherwise calls invokevirtual.Stack: ..., objectref, [arg1, [arg2 ...]] => ...
- Parameters:
cls-name-parameters-- Throws:
java.io.IOException
-
invokevirtual
public void invokevirtual(javax.lang.model.element.ExecutableElement method) throws java.io.IOExceptionInvoke instance method; dispatch based on classIf method is interface calls invokeinterface otherwise calls invokevirtual.Stack: ..., objectref, [arg1, [arg2 ...]] => ...
- Parameters:
method-- Throws:
java.io.IOException
-
invokestatic
public void invokestatic(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>... parameters) throws java.io.IOExceptionInvoke a class (static) methodStack: ..., [arg1, [arg2 ...]] => ...
- Parameters:
cls-name-parameters-- Throws:
java.io.IOException
-
invokestatic
public void invokestatic(javax.lang.model.element.ExecutableElement method) throws java.io.IOExceptionInvoke a class (static) methodStack: ..., [arg1, [arg2 ...]] => ...
- Parameters:
method-- Throws:
java.io.IOException
-
argumentCount
private int argumentCount(java.util.List<? extends javax.lang.model.element.VariableElement> parameters)
-
end
public void end() throws java.io.IOExceptionDeprecated.Current implementation does nothing- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
iconst
public void iconst(boolean value) throws java.io.IOExceptionPush int constantStack: ..., => ..., i
- Parameters:
value-- Throws:
java.io.IOException
-
iconst
public void iconst(int value) throws java.io.IOExceptionPush int constant. Uses either iconst or ldc.Stack: ..., => ..., i
-
fconst
public void fconst(float value) throws java.io.IOExceptionPush float constant. Uses either fconst or ldc.Stack: ..., => ..., f
- Parameters:
value-- Throws:
java.io.IOException
-
lconst
public void lconst(long value) throws java.io.IOExceptionPush long constant. Uses either lconst or ldc.Stack: ..., => ..., l
- Parameters:
value-- Throws:
java.io.IOException
-
dconst
public void dconst(double value) throws java.io.IOExceptionPush double constant. Use either dconst or ldc.Stack: ..., => ..., d
- Parameters:
value-- Throws:
java.io.IOException
-
optimizedSwitch
public void optimizedSwitch(LookupList list) throws java.io.IOException
Compiles a tableswitch, lookupswitch or if/goto depending on contents of LookupList.Stack: ..., index => ...,
throws SwitchException if target illegal.
- Parameters:
list-- Throws:
java.io.IOException
-
optimizedSwitch
public void optimizedSwitch(java.lang.String def, LookupList list) throws java.io.IOExceptionCompiles a tableswitch, lookupswitch or if/goto depending on contents of LookupList.Stack: ..., index => ...,
- Parameters:
def-list-- Throws:
java.io.IOException
-
lookupswitch
public void lookupswitch(LookupList list) throws java.io.IOException
Compiles lookupswitchStack: ..., index => ...,
- Parameters:
list-- Throws:
java.io.IOException
-
tableswitch
public void tableswitch(int low, int high, java.util.List<java.lang.String> symbols) throws java.io.IOExceptionCompiles tableswitchStack: ..., index => ...,
- Parameters:
low-high-symbols-- Throws:
java.io.IOException
-
tableswitch
public void tableswitch(int low, int high, java.lang.String... symbols) throws java.io.IOExceptionCompiles tableswitchStack: ..., index => ...,
- Parameters:
low-high-symbols-- Throws:
java.io.IOException
-
addNewArray
public void addNewArray(java.lang.String name, java.lang.Class<?> aClass, int size) throws java.io.IOExceptionCreate new arrayStack: ..., count => ..., arrayref
- Parameters:
name-aClass-size-- Throws:
java.io.IOException
-
addNewArray
public void addNewArray(java.lang.String name, javax.lang.model.type.TypeMirror type, int size) throws java.io.IOExceptionCreate new arrayStack: ..., count => ..., arrayref
- Parameters:
name-type-size-- Throws:
java.io.IOException
-
checkcast
public void checkcast(java.lang.Class<?> objectref) throws java.io.IOExceptionCheck whether object is of given typeStack: ..., objectref => ..., objectref
- Parameters:
objectref-- Throws:
java.io.IOException
-
checkcast
public void checkcast(javax.lang.model.element.TypeElement objectref) throws java.io.IOExceptionCheck whether object is of given typeStack: ..., objectref => ..., objectref
- Parameters:
objectref-- Throws:
java.io.IOException
-
checkcast
public void checkcast(javax.lang.model.type.TypeMirror type) throws java.io.IOExceptionCheck whether object is of given typeStack: ..., objectref => ..., objectref
- Parameters:
type-- Throws:
java.io.IOException
-
convert
public void convert(java.lang.String fromVariable, javax.lang.model.type.TypeMirror to) throws java.io.IOException, IllegalConversionExceptionConvert a local variable to given type. (if it is possible)Stack: ..., => ..., objectref
- Parameters:
fromVariable-to-- Throws:
java.io.IOExceptionIllegalConversionException
-
addExceptionHandler
public void addExceptionHandler(Block block, java.lang.String handler, java.lang.Class<? extends java.lang.Throwable>... catchTypes)
Adds an exception handler. If one of catchTypes is thrown inside block the execution continues at handler address. Thrown object is pushed in stack.- Parameters:
block-handler-catchTypes- Throwable objects which are caught. If none is present then all throwables are caught. Note! This is not the same as finally!
-
addExceptionHandler
public void addExceptionHandler(Block block, java.lang.String handler, java.util.List<? extends javax.lang.model.type.TypeMirror> thrownTypes)
Adds an exception handler. If one of catchTypes is thrown inside block the execution continues at handler address. Thrown object is pushed in stack.- Parameters:
block-handler-thrownTypes- Throwable objects which are caught. If none is present then all throwables are caught. Note! This is not the same as finally!
-
implement
protected abstract void implement() throws java.io.IOException- Throws:
java.io.IOException
-
-