Class Code
- All Implemented Interfaces:
BCEntity,VisitAcceptor
ListIterator class. Note that the size and index
information of the code block will change as opcodes are added.
Code blocks are usually obtained from a BCMethod, but can also
be constructed via the default constructor. Blocks created this way can
be used to provide template instructions to the various search/replace
methods in this class.
The code class contains methods named after most JVM instructions, each
of which adds the matching opcode to the code block at the
current iterator position. It also contains generic versions of various
JVM instructions whose opcodes are not set until their properties are set
with additional information. Almost all instruction types are able to
'morph' their opcode on the fly as the arguments to the instruction change.
Thus the developer can initially call, for example, the aload
opcode, but later change the type to load to int and the
opcode will automatically morph to the iload opcode.
- Author:
- Abe White
-
Constructor Summary
ConstructorsConstructorDescriptionCode()The public constructor is for creating template code modules that produceInstructions used in matching through the varioussearchandreplacemethods. -
Method Summary
Modifier and TypeMethodDescriptionaaload()Load an object array value onto the stack; theaaloadopcode.aastore()Store an object value from the stack into an array; theaastoreopcode.voidacceptVisit(BCVisitor visit) Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.add(Instruction ins) Adds a copy of the given instruction.Add an exception handler to this code block.addExceptionHandler(ExceptionHandler handler) Import the given exception handler from another code block.addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, Class catchType) Add an exception handler to this code block.addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, String catchType) Add an exception handler to this code block.addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, BCClass catchType) Add an exception handler to this code block.voidafter(int index) Place the iterator after the given list index.voidafter(Instruction ins) Position the iterator just after the given instruction.voidSet the position of the instruction iterator to after the last opcode.aload()Load an object local variable onto the stack.anew()Create a new instance of an object; thenewopcode.Create a new instance of an object array; theanewopcode.areturn()Return an object from a method; theareturnopcode.Get the length of an array on the stack; thearraylengthopcode.astore()Store an object value from the stack into a local variable.athrow()Throw an exception; theathrowopcode.baload()Load a byte array value onto the stack; thebaloadopcode.bastore()Store a byte value from the stack into an array; thebastoreopcode.voidbefore(int index) Place the iterator before the given list index.voidbefore(Instruction ins) Position the iterator just before the given instruction.voidReset the position of the instruction iterator to the first opcode.voidCalculate and set the number of locals needed based on the instructions used and the parameters of the method this code block is a part of.voidCalculate and set the maximum stack depth needed for the instructions used.caload()Load a char array value onto the stack; thecaloadopcode.castore()Store a char value from the stack into an array; thecastoreopcode.Cast an object on the stack to another type; thecheckcastopcode.Load a class constant onto the stack.voidClear all exception handlers.constant()Load some constant onto the stack.convert()Convert the top stack value to another type.dadd()Add the top two stack double values; thedaddopcode.daload()Load a double array value onto the stack; thedaloadopcode.dastore()Store a double value from the stack into an array; thedastoreopcode.dcmpg()Compare the top two stack values; thedcmpgopcode.dcmpl()Compare the top two stack values; thedcmplopcode.ddiv()Divide the top two stack double values; theddivopcode.dload()Load a double local variable onto the stack.dmul()Multiply the top two stack double values; thedmulopcode.dneg()Negate the top stack double value; thednegopcode.drem()Take the remainder of the top two double stack values; thedremopcode.dreturn()Return a double from a method; thedreturnopcode.dstore()Store a double value from the stack into a local variable.dsub()Subtract the top two stack double values; thedsubopcode.dup()Thedupopcode.dup2()Thedup2opcode.dup2x1()Thedup2x1opcode.dup2x2()Thedup2x2opcode.dupx1()Thedupx1opcode.dupx2()Thedupx2opcode.fadd()Add the top two stack float values; thefaddopcode.faload()Load a float array value onto the stack; thefaloadopcode.fastore()Store a float value from the stack into an array; thefastoreopcode.fcmpg()Compare the top two stack values; thefcmpgopcode.fcmpl()Compare the top two stack values; thefcmplopcode.fdiv()Divide the top two stack float values; thefdivopcode.fload()Load a float local variable onto the stack.fmul()Multiply the top two stack float values; thefmulopcode.fneg()Negate the top stack float value; thefnegopcode.frem()Take the remainder of the top two float stack values; thefremopcode.freturn()Return a float from a method; thefreturnopcode.fstore()Store a float value from the stack into a local variable.fsub()Subtract the top two stack float values; thefsubopcode.getExceptionHandler(Class catchType) Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined.getExceptionHandler(String catchType) Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined.getExceptionHandler(BCClass catchType) Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined.Return the exception handlers active in this code block, or an empty array if none.getExceptionHandlers(Class catchType) Return all exception handlers that catch the given exception type, or an empty array if none.getExceptionHandlers(String catchType) Return all exception handlers that catch the given exception type, or an empty array if none.getExceptionHandlers(BCClass catchType) Return all exception handlers that catch the given exception type, or an empty array if none.getfield()Load the value from a field onto the stack; thegetfieldopcode.Return all the Instructions of this method.getLineNumberTable(boolean add) Return line number information for the code.intgetLocalsIndex(int paramIndex) Return the local variable index for the paramIndex'th parameter to the method.getLocalVariableTable(boolean add) Return local variable information for the code.getLocalVariableTypeTable(boolean add) Return local variable generics information for the code.intReturn the maximum number of local variables (including params) set for this method.intReturn the maximum stack depth set for this code block.The owning method.intReturn the next available local variable index.intgetParamsIndex(int localIndex) Return the parameter index for the given local index, or -1 if the given local does not reference a param.Load the value from a static field onto the stack; thegetstaticopcode.go2()Thego2opcode.booleanhasNext()Return true if a subsequent call tonext()will return an instruction.booleanReturn true if a subsequent call toprevious()will return an instruction.iadd()Add the top two stack int values; theiaddopcode.iaload()Load an int array value onto the stack; theialoadopcode.iand()Take the mathematical and of the top two stack int values; theiandopcode.iastore()Store an int value from the stack into an array; theiastoreopcode.idiv()Divide the top two stack int values; theidivopcode.ifacmpeq()Theifacmpeqopcode.ifacmpne()Theifacmpneopcode.ifeq()Theifeqopcode.ifge()Theifgeopcode.ifgt()Theifgtopcode.ificmpeq()Theificmpeqopcode.ificmpge()Theificmpgeopcode.ificmpgt()Theificmpgtopcode.ificmple()Theificmpleopcode.ificmplt()Theificmpltopcode.ificmpne()Theificmpneopcode.ifle()Theifleopcode.iflt()Theifltopcode.ifne()Theifneopcode.Theifnonnullopcode.ifnull()Theifnullopcode.iinc()Add theiincopcode.iload()Load an int local variable onto the stack.imul()Multiply the top two stack int values; theimulopcode.ineg()Negate the top stack int value; theinegopcode.Invoke a dynamic method; theinvokedynamicopcode.Invoke a method on an interface; theinvokeinterfaceopcode.Invoke a method non-virtually, as for constructors and superclass methods; theinvokespecialopcode.Invoke a static method; theinvokestaticopcode.Invoke a virtual method; theinvokevirtualopcode.ior()Take the mathematical or of the top two stack int values; theioropcode.irem()Take the remainder of the top two int stack values; theiremopcode.ireturn()Return an int from a method; theireturnopcode.ishl()Shift the top stack int values; theishlopcode.ishr()Shift the top stack int values; theishropcode.Test if a stack object is an instance of a class; theinstanceofopcode.istore()Store an int value from the stack into a local variable.isub()Subtract the top two stack int values; theisubopcode.iushr()Shift the top stack int values; theiushropcode.ixor()Take the mathematical xor of the top two stack int values; theixoropcode.jsr()Thejsropcode used in implementingfinallyclauses.ladd()Add the top two stack long values; theladdopcode.laload()Load a long array value onto the stack; thelaloadopcode.land()Take the mathematical and of the top two stack long values; thelandopcode.lastore()Store a long value from the stack into an array; thelastoreopcode.lcmp()Compare the top two stack values; thelcmpopcode.ldiv()Divide the top two stack long values; theldivopcode.Returns another listIterator view of the Instructions in this code block.lload()Load a long local variable onto the stack.lmul()Multiply the top two stack long values; thelmulopcode.lneg()Negate the top stack long value; thelnegopcode.Thelookupswitchopcode.lor()Take the mathematical or of the top two stack long values; theloropcode.lrem()Take the remainder of the top two long stack values; thelremopcode.lreturn()Return a long from a method; thelreturnopcode.lshl()Shift the top stack long values; thelshlopcode.lshr()Shift the top stack long values; thelshropcode.lstore()Store a long value from the stack into a local variable.lsub()Subtract the top two stack long values; thelsubopcode.lushr()Shift the top stack long values; thelushropcode.lxor()Take the mathematical xor of the top two stack long values; thelxoropcode.math()Perform some math operation on the stack items.Themonitorenteropcode.Themonitorexitopcode.Create a new multidimensional array; themultianewarrayopcode.newarray()Create a new array of a primitive type; thenewarrayopcode.next()Return the next instruction.intReturn the index of the next instruction, orsize()if at end.nop()Add thenopopcode.pop()Thepopopcode.pop2()Thepop2opcode.previous()Return the previous instruction.intReturn the index of the previous instruction, or -1 if at beginning.putfield()Place the value of a field onto the stack; theputfieldopcode.Place the value of a static field onto the stack; theputstaticopcode.voidremove()Remove the last iterated instruction.booleanremoveExceptionHandler(Class catchType) Remove the exception handler that catches the given type.booleanremoveExceptionHandler(String catchType) Remove the exception handler that catches the given type.booleanremoveExceptionHandler(BCClass catchType) Remove the exception handler that catches the given type.booleanremoveExceptionHandler(ExceptionHandler handler) Remove an exception handler from this code block.booleanRemove the line number table for the code.booleanRemove the local variable table for the code.booleanRemove the local variable type table for the code.intreplace(Instruction[] templates, Instruction[] with) Equivalent to looping over each given template/replacement pair and callingreplace(Instruction,Instruction)for each.intreplace(Instruction template, Instruction with) Replaces all the instructions in this code block that match the given template with the given instruction.ret()Add theretopcode, used in implementingfinallyclauses.saload()Load a short array value onto the stack; thesaloadopcode.sastore()Store a short value from the stack into an array; thesastoreopcode.booleansearchBackward(Instruction template) Find the closest previous instruction from the current iterator position that matches the given one, according to theObject.equals(java.lang.Object)methods of the instruction types.booleansearchForward(Instruction template) Find the next instruction from the current iterator position that matches the given one, according to theObject.equals(java.lang.Object)methods of the instruction types.set(Instruction ins) Replaces the last iterated instruction with a copy of the given one.voidsetExceptionHandlers(ExceptionHandler[] handlers) Set the exception handlers for this code block.voidsetMaxLocals(int max) Set the maximum number of local variables (including params) in this method.voidsetMaxStack(int max) Set the maximum stack depth for this code block.intsize()Return the number of instructions in the method.swap()Theswapopcode.Thetableswitchopcode.vreturn()Return void from a method; thereturnopcode.wide()Add thewideopcode.xadd()Add the top two stack values.xaload()Load an array value onto the stack.xand()Take the mathematical and of the top two stack values.xastore()Store a value from the stack into an array.xcmp()Compare the top two stack values.xdiv()Divide the top two stack values.xload()Load a local variable onto the stack.xmul()Multiply the top two stack values.xneg()Negate the top stack value.xor()Take the mathematical or of the top two stack values.xrem()Take the remainder of the top two stack values.xreturn()Return from a method.xshl()Shift the top stack values.xshr()Shift the top stack values.xstore()Store a value from the stack into a local variable.xsub()Subtract the top two stack values.xushr()Shift the top stack values.xxor()Take the mathematical xor of the top two stack values.Methods inherited from class serp.bytecode.Attribute
getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, isValidMethods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, removeAttribute, removeAttribute, setAttributes
-
Constructor Details
-
Code
public Code()The public constructor is for creating template code modules that produceInstructions used in matching through the varioussearchandreplacemethods.
-
-
Method Details
-
getMethod
The owning method. -
getMaxStack
public int getMaxStack()Return the maximum stack depth set for this code block. -
setMaxStack
public void setMaxStack(int max) Set the maximum stack depth for this code block. -
getMaxLocals
public int getMaxLocals()Return the maximum number of local variables (including params) set for this method. -
setMaxLocals
public void setMaxLocals(int max) Set the maximum number of local variables (including params) in this method. -
getLocalsIndex
public int getLocalsIndex(int paramIndex) Return the local variable index for the paramIndex'th parameter to the method. Local variable indexes differ from parameter indexes because: a) non-static methods use the 0th local variable for the 'this' ptr, and b) double and long values occupy two spots in the local variable array. Returns -1 if the given index is not valid. -
getParamsIndex
public int getParamsIndex(int localIndex) Return the parameter index for the given local index, or -1 if the given local does not reference a param.- See Also:
-
getNextLocalsIndex
public int getNextLocalsIndex()Return the next available local variable index. -
calculateMaxLocals
public void calculateMaxLocals()Calculate and set the number of locals needed based on the instructions used and the parameters of the method this code block is a part of.- See Also:
-
calculateMaxStack
public void calculateMaxStack()Calculate and set the maximum stack depth needed for the instructions used.- See Also:
-
getExceptionHandlers
Return the exception handlers active in this code block, or an empty array if none. -
getExceptionHandler
Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined. -
getExceptionHandler
Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined. -
getExceptionHandler
Return the exception handler that catches the given exception type; if multiple handlers catch the given type, which is returned is undefined. -
getExceptionHandlers
Return all exception handlers that catch the given exception type, or an empty array if none. -
getExceptionHandlers
Return all exception handlers that catch the given exception type, or an empty array if none. -
getExceptionHandlers
Return all exception handlers that catch the given exception type, or an empty array if none. -
setExceptionHandlers
Set the exception handlers for this code block. This method is useful for importing all handlers from another code block. Set to null or empty array if none. -
addExceptionHandler
Import the given exception handler from another code block. -
addExceptionHandler
Add an exception handler to this code block. -
addExceptionHandler
public ExceptionHandler addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, String catchType) Add an exception handler to this code block.- Parameters:
tryStart- the first instruction of the try {} blocktryEnd- the last instruction of the try {} blockhandlerStart- the first instruction of the catch {} blockcatchType- the type of exception being caught
-
addExceptionHandler
public ExceptionHandler addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, Class catchType) Add an exception handler to this code block.- Parameters:
tryStart- the first instruction of the try {} blocktryEnd- the last instruction of the try {} blockhandlerStart- the first instruction of the catch {} blockcatchType- the type of exception being caught
-
addExceptionHandler
public ExceptionHandler addExceptionHandler(Instruction tryStart, Instruction tryEnd, Instruction handlerStart, BCClass catchType) Add an exception handler to this code block.- Parameters:
tryStart- the first instruction of the try {} blocktryEnd- the last instruction of the try {} blockhandlerStart- the first instruction of the catch {} blockcatchType- the type of exception being caught
-
clearExceptionHandlers
public void clearExceptionHandlers()Clear all exception handlers. -
removeExceptionHandler
Remove the exception handler that catches the given type. -
removeExceptionHandler
Remove the exception handler that catches the given type.- Returns:
- true if the handler was removed, false otherwise
-
removeExceptionHandler
Remove the exception handler that catches the given type.- Returns:
- true if the handler was removed, false otherwise
-
removeExceptionHandler
Remove an exception handler from this code block. The given handler must belong to this code block. -
size
public int size()Return the number of instructions in the method. -
beforeFirst
public void beforeFirst()Reset the position of the instruction iterator to the first opcode. -
afterLast
public void afterLast()Set the position of the instruction iterator to after the last opcode. -
before
Position the iterator just before the given instruction. The instruction must belong to this method. -
after
Position the iterator just after the given instruction. The instruction must belong to this method. -
hasNext
public boolean hasNext()Return true if a subsequent call tonext()will return an instruction. -
hasPrevious
public boolean hasPrevious()Return true if a subsequent call toprevious()will return an instruction. -
next
Return the next instruction. -
nextIndex
public int nextIndex()Return the index of the next instruction, orsize()if at end. -
previous
Return the previous instruction. -
previousIndex
public int previousIndex()Return the index of the previous instruction, or -1 if at beginning. -
before
public void before(int index) Place the iterator before the given list index. -
after
public void after(int index) Place the iterator after the given list index. -
searchForward
Find the next instruction from the current iterator position that matches the given one, according to theObject.equals(java.lang.Object)methods of the instruction types. This allows for matching based on template instructions, as the equals methods of most instructions return true if the information for the given instruction has not been filled in. If a match is found, the iterator is placed after the matching Instruction. If no match is found, moves the iterator toafterLast().- Returns:
- true if match found
-
searchBackward
Find the closest previous instruction from the current iterator position that matches the given one, according to theObject.equals(java.lang.Object)methods of the instruction types. This allows for matching based on template instructions, as the equals methods of most instructions return true if the information for the given instruction has not been filled in. If a match is found, the iterator is placed before the matching Instruction. If no match is found, moves the iterator tobeforeFirst().- Returns:
- true if match found
-
add
Adds a copy of the given instruction.- Returns:
- the newly added instruction
-
set
Replaces the last iterated instruction with a copy of the given one. This method will also make sure that all jump points that referenced the old opcode are updated correctly.- Returns:
- the newly added instruction
- See Also:
-
replace
Replaces all the instructions in this code block that match the given template with the given instruction. After this method, the iterator will beafterLast().- Returns:
- the number of substitutions made
-
replace
Equivalent to looping over each given template/replacement pair and callingreplace(Instruction,Instruction)for each. -
remove
public void remove()Remove the last iterated instruction.- See Also:
-
classconstant
Load a class constant onto the stack. For primitive types, this translates into a getstatic for the TYPE field of the primitive's wrapper type. For non-primitives, things get much more complex. Suffice it to say that the operation involves adding synthetic static fields and even methods to the class. Note that this instruction requires up to 3 stack positions to execute. -
nop
Add thenopopcode. -
constant
Load some constant onto the stack. TheConstantInstructiontype takes any constant and correctly translates it into the proper opcode, depending on the constant type and value. For example, if the constant value is set to 0L, the opcode will be set tolconst0. -
xload
Load a local variable onto the stack. This instruction will result in anopuntil its type and local index are set. -
iload
Load an int local variable onto the stack. This instruction will result in anopuntil its local index is set. -
lload
Load a long local variable onto the stack. This instruction will result in anopuntil its local index is set. -
fload
Load a float local variable onto the stack. This instruction will result in anopuntil its local index is set. -
dload
Load a double local variable onto the stack. This instruction will result in anopuntil its local index is set. -
aload
Load an object local variable onto the stack. This instruction will result in anopuntil its local index is set. -
xstore
Store a value from the stack into a local variable. This instruction will result in anopuntil its type and local index are set. -
istore
Store an int value from the stack into a local variable. This instruction will result in anopuntil its local index is set. -
lstore
Store a long value from the stack into a local variable. This instruction will resultin anopuntil its local index is set. -
fstore
Store a float value from the stack into a local variable. This instruction will result in anopuntil its local index is set. -
dstore
Store a double value from the stack into a local variable. This instruction will result in anopuntil its local index is set. -
astore
Store an object value from the stack into a local variable. This instruction will result in anopuntil its local index is set. -
ret
Add theretopcode, used in implementingfinallyclauses. -
iinc
Add theiincopcode. -
wide
Add thewideopcode. -
xaload
Load an array value onto the stack. This instruction will result in anopuntil its type is set. -
iaload
Load an int array value onto the stack; theialoadopcode. -
laload
Load a long array value onto the stack; thelaloadopcode. -
faload
Load a float array value onto the stack; thefaloadopcode. -
daload
Load a double array value onto the stack; thedaloadopcode. -
aaload
Load an object array value onto the stack; theaaloadopcode. -
baload
Load a byte array value onto the stack; thebaloadopcode. -
caload
Load a char array value onto the stack; thecaloadopcode. -
saload
Load a short array value onto the stack; thesaloadopcode. -
xastore
Store a value from the stack into an array. This instruction will result in anopuntil its type is set. -
iastore
Store an int value from the stack into an array; theiastoreopcode. -
lastore
Store a long value from the stack into an array; thelastoreopcode. -
fastore
Store a float value from the stack into an array; thefastoreopcode. -
dastore
Store a double value from the stack into an array; thedastoreopcode. -
aastore
Store an object value from the stack into an array; theaastoreopcode. -
bastore
Store a byte value from the stack into an array; thebastoreopcode. -
castore
Store a char value from the stack into an array; thecastoreopcode. -
sastore
Store a short value from the stack into an array; thesastoreopcode. -
pop
Thepopopcode. -
pop2
Thepop2opcode. -
dup
Thedupopcode. -
dupx1
Thedupx1opcode. -
dupx2
Thedupx2opcode. -
dup2
Thedup2opcode. -
dup2x1
Thedup2x1opcode. -
dup2x2
Thedup2x2opcode. -
swap
Theswapopcode. -
math
Perform some math operation on the stack items. This instruction will result in anopuntil its operation and type are set. -
xadd
Add the top two stack values. This instruction will result in anopuntil its type is set. -
iadd
Add the top two stack int values; theiaddopcode. -
ladd
Add the top two stack long values; theladdopcode. -
fadd
Add the top two stack float values; thefaddopcode. -
dadd
Add the top two stack double values; thedaddopcode. -
xsub
Subtract the top two stack values. This instruction will result in anopuntil its type is set. -
isub
Subtract the top two stack int values; theisubopcode. -
lsub
Subtract the top two stack long values; thelsubopcode. -
fsub
Subtract the top two stack float values; thefsubopcode. -
dsub
Subtract the top two stack double values; thedsubopcode. -
xmul
Multiply the top two stack values. This instruction will result in anopuntil its type is set. -
imul
Multiply the top two stack int values; theimulopcode. -
lmul
Multiply the top two stack long values; thelmulopcode. -
fmul
Multiply the top two stack float values; thefmulopcode. -
dmul
Multiply the top two stack double values; thedmulopcode. -
xdiv
Divide the top two stack values. This instruction will result in anopuntil its type is set. -
idiv
Divide the top two stack int values; theidivopcode. -
ldiv
Divide the top two stack long values; theldivopcode. -
fdiv
Divide the top two stack float values; thefdivopcode. -
ddiv
Divide the top two stack double values; theddivopcode. -
xrem
Take the remainder of the top two stack values. This instruction will result in anopuntil its type is set. -
irem
Take the remainder of the top two int stack values; theiremopcode. -
lrem
Take the remainder of the top two long stack values; thelremopcode. -
frem
Take the remainder of the top two float stack values; thefremopcode. -
drem
Take the remainder of the top two double stack values; thedremopcode. -
xneg
Negate the top stack value. This instruction will result in anopuntil its type is set. -
ineg
Negate the top stack int value; theinegopcode. -
lneg
Negate the top stack long value; thelnegopcode. -
fneg
Negate the top stack float value; thefnegopcode. -
dneg
Negate the top stack double value; thednegopcode. -
xshl
Shift the top stack values. This instruction will result in anopuntil its type is set. -
ishl
Shift the top stack int values; theishlopcode. -
lshl
Shift the top stack long values; thelshlopcode. -
xshr
Shift the top stack values. This instruction will result in anopuntil its type is set. -
ishr
Shift the top stack int values; theishropcode. -
lshr
Shift the top stack long values; thelshropcode. -
xushr
Shift the top stack values. This instruction will result in anopuntil its type is set. -
iushr
Shift the top stack int values; theiushropcode. -
lushr
Shift the top stack long values; thelushropcode. -
xand
Take the mathematical and of the top two stack values. This instruction results in anopuntil its type is set. -
iand
Take the mathematical and of the top two stack int values; theiandopcode. -
land
Take the mathematical and of the top two stack long values; thelandopcode. -
xor
Take the mathematical or of the top two stack values. This instruction results in anopuntil its type is set. -
ior
Take the mathematical or of the top two stack int values; theioropcode. -
lor
Take the mathematical or of the top two stack long values; theloropcode. -
xxor
Take the mathematical xor of the top two stack values. This instruction results in anopuntil its type is set. -
ixor
Take the mathematical xor of the top two stack int values; theixoropcode. -
lxor
Take the mathematical xor of the top two stack long values; thelxoropcode. -
convert
Convert the top stack value to another type. This instruction will result in anopuntil the types to convert between are set. -
xcmp
Compare the top two stack values. This instruction will result in anopuntil its type is set. -
lcmp
Compare the top two stack values; thelcmpopcode. -
fcmpl
Compare the top two stack values; thefcmplopcode. -
fcmpg
Compare the top two stack values; thefcmpgopcode. -
dcmpl
Compare the top two stack values; thedcmplopcode. -
dcmpg
Compare the top two stack values; thedcmpgopcode. -
ifeq
Theifeqopcode. -
ifne
Theifneopcode. -
iflt
Theifltopcode. -
ifge
Theifgeopcode. -
ifgt
Theifgtopcode. -
ifle
Theifleopcode. -
ificmpeq
Theificmpeqopcode. -
ificmpne
Theificmpneopcode. -
ificmplt
Theificmpltopcode. -
ificmpge
Theificmpgeopcode. -
ificmpgt
Theificmpgtopcode. -
ificmple
Theificmpleopcode. -
ifacmpeq
Theifacmpeqopcode. -
ifacmpne
Theifacmpneopcode. -
ifnull
Theifnullopcode. -
ifnonnull
Theifnonnullopcode. -
go2
Thego2opcode. -
jsr
Thejsropcode used in implementingfinallyclauses. -
tableswitch
Thetableswitchopcode. -
lookupswitch
Thelookupswitchopcode. -
xreturn
Return from a method. This method will result in anopuntil its type is set. -
vreturn
Return void from a method; thereturnopcode. -
ireturn
Return an int from a method; theireturnopcode. -
lreturn
Return a long from a method; thelreturnopcode. -
freturn
Return a float from a method; thefreturnopcode. -
dreturn
Return a double from a method; thedreturnopcode. -
areturn
Return an object from a method; theareturnopcode. -
getfield
Load the value from a field onto the stack; thegetfieldopcode. -
getstatic
Load the value from a static field onto the stack; thegetstaticopcode. -
putfield
Place the value of a field onto the stack; theputfieldopcode. -
putstatic
Place the value of a static field onto the stack; theputstaticopcode. -
invokevirtual
Invoke a virtual method; theinvokevirtualopcode. -
invokespecial
Invoke a method non-virtually, as for constructors and superclass methods; theinvokespecialopcode. -
invokeinterface
Invoke a method on an interface; theinvokeinterfaceopcode. -
invokestatic
Invoke a static method; theinvokestaticopcode. -
invokedynamic
Invoke a dynamic method; theinvokedynamicopcode. -
anew
Create a new instance of an object; thenewopcode. -
anewarray
Create a new instance of an object array; theanewopcode. -
checkcast
Cast an object on the stack to another type; thecheckcastopcode. -
isinstance
Test if a stack object is an instance of a class; theinstanceofopcode. -
multianewarray
Create a new multidimensional array; themultianewarrayopcode. -
newarray
Create a new array of a primitive type; thenewarrayopcode. -
arraylength
Get the length of an array on the stack; thearraylengthopcode. -
athrow
Throw an exception; theathrowopcode. -
monitorenter
Themonitorenteropcode. -
monitorexit
Themonitorexitopcode. -
getInstructions
Return all the Instructions of this method. -
acceptVisit
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one. -
getLineNumberTable
Return line number information for the code. Acts internally through theAttributesinterface.- Parameters:
add- if true, a new line number table will be added if not already present- Returns:
- the line number information, or null if none
and the
addparam is set to false
-
removeLineNumberTable
public boolean removeLineNumberTable()Remove the line number table for the code. Acts internally through theAttributesinterface.- Returns:
- true if there was a table to remove
-
getLocalVariableTable
Return local variable information for the code. Acts internally through theAttributesinterface.- Parameters:
add- if true, a new local variable table will be added if not already present- Returns:
- the local variable information, or null if none
and the
addparam is set to false
-
removeLocalVariableTables
public boolean removeLocalVariableTables()Remove the local variable table for the code. Acts internally through theAttributesinterface.- Returns:
- true if there was a table to remove
-
getLocalVariableTypeTable
Return local variable generics information for the code. Acts internally through theAttributesinterface.- Parameters:
add- if true, a new local variable type table will be added if not already present- Returns:
- the local variable type information, or null if none
and the
addparam is set to false
-
removeLocalVariableTypeTables
public boolean removeLocalVariableTypeTables()Remove the local variable type table for the code. Acts internally through theAttributesinterface.- Returns:
- true if there was a table to remove
-
listIterator
Returns another listIterator view of the Instructions in this code block. Useful for performing read-only searches through Instructions without effecting the pointer location of the main code block.
-