Package com.tonic.analysis.instruction
Class Instruction
- java.lang.Object
-
- com.tonic.analysis.instruction.Instruction
-
- Direct Known Subclasses:
AALoadInstruction,AAStoreInstruction,AConstNullInstruction,ALoadInstruction,ANewArrayInstruction,ArithmeticInstruction,ArithmeticShiftInstruction,ArrayLengthInstruction,AStoreInstruction,ATHROWInstruction,BALOADInstruction,BAStoreInstruction,BipushInstruction,CALoadInstruction,CAStoreInstruction,CheckCastInstruction,CompareInstruction,ConditionalBranchInstruction,ConversionInstruction,DALoadInstruction,DAStoreInstruction,DConstInstruction,DLoadInstruction,DNegInstruction,DStoreInstruction,DupInstruction,FALoadInstruction,FAStoreInstruction,FConstInstruction,FLoadInstruction,FNegInstruction,FStoreInstruction,GetFieldInstruction,GotoInstruction,I2LInstruction,IALoadInstruction,IAndInstruction,IAStoreInstruction,IConstInstruction,IIncInstruction,ILoadInstruction,INegInstruction,InstanceOfInstruction,InvokeDynamicInstruction,InvokeInterfaceInstruction,InvokeSpecialInstruction,InvokeStaticInstruction,InvokeVirtualInstruction,IOrInstruction,IStoreInstruction,IXorInstruction,JsrInstruction,LALoadInstruction,LandInstruction,LAStoreInstruction,LConstInstruction,Ldc2WInstruction,LdcInstruction,LdcWInstruction,LLoadInstruction,LNegInstruction,LookupSwitchInstruction,LorInstruction,LStoreInstruction,LXorInstruction,MethodReturnInstruction,MonitorEnterInstruction,MonitorExitInstruction,MultiANewArrayInstruction,NarrowingConversionInstruction,NewObjectInstruction,NewPrimitiveArrayInstruction,NopInstruction,Pop2Instruction,PopInstruction,PutFieldInstruction,RetInstruction,SALoadInstruction,SAStoreInstruction,SipushInstruction,SwapInstruction,TableSwitchInstruction,UnknownInstruction,WideIIncInstruction,WideInstruction
public abstract class Instruction extends Object
Represents a single bytecode instruction.
-
-
Constructor Summary
Constructors Constructor Description Instruction(int opcode, int offset, int length)Constructs an Instruction.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaccept(AbstractBytecodeVisitor visitor)Accepts a visitor for bytecode analysis.intgetLength()abstract intgetLocalChange()Returns the change in local variables caused by this instruction.intgetOffset()intgetOpcode()abstract intgetStackChange()Returns the change in stack size caused by this instruction.voidsetOffset(int offset)Updates this instruction's bytecode offset.StringtoString()abstract voidwrite(DataOutputStream dos)Writes the instruction to the DataOutputStream.
-
-
-
Method Detail
-
getOpcode
public int getOpcode()
- Returns:
- the opcode
-
getOffset
public int getOffset()
- Returns:
- the offset
-
getLength
public int getLength()
- Returns:
- the encoded length of the instruction in bytes
-
setOffset
public void setOffset(int offset)
Updates this instruction's bytecode offset.- Parameters:
offset- the new bytecode offset
-
accept
public abstract void accept(AbstractBytecodeVisitor visitor)
Accepts a visitor for bytecode analysis.- Parameters:
visitor- The visitor to accept.
-
write
public abstract void write(DataOutputStream dos) throws IOException
Writes the instruction to the DataOutputStream.- Parameters:
dos- The DataOutputStream to write to.- Throws:
IOException- If an I/O error occurs.
-
getStackChange
public abstract int getStackChange()
Returns the change in stack size caused by this instruction.- Returns:
- The stack size change.
-
getLocalChange
public abstract int getLocalChange()
Returns the change in local variables caused by this instruction.- Returns:
- The local variables size change.
-
-