Package serp.bytecode
Class JumpInstruction
java.lang.Object
serp.bytecode.CodeEntry
serp.bytecode.Instruction
serp.bytecode.JumpInstruction
- All Implemented Interfaces:
BCEntity,InstructionPtr,VisitAcceptor
- Direct Known Subclasses:
GotoInstruction,IfInstruction,LookupSwitchInstruction,SwitchInstruction,TableSwitchInstruction
An instruction that specifies a position in the code block to jump to.
Examples include
go2, jsr, etc.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptVisit(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.booleanequalsInstruction(Instruction other) JumpInstructions are equal if they represent the same operation and the instruction they jump to is the same, or if the jump Instruction of either is unset.intGet the current target instruction to jump to, if it has been set.(package private) voidRead the arguments for this opcode from the given stream.(package private) voidread(Instruction orig) Copy the given instruction data.voidreplaceTarget(Instruction oldTarget, Instruction newTarget) Replace the given old, likely invalid, target with a new target.voidsetOffset(int offset) setTarget(Instruction instruction) Set the instruction to jump to; the instruction must already be added to the code block.voidUse the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr.(package private) voidwrite(DataOutput out) Write the arguments for this opcode to the given stream.Methods inherited from class serp.bytecode.Instruction
getByteIndex, getClassLoader, getCode, getLength, getLineNumber, getLogicalStackChange, getName, getOpcode, getPool, getProject, getStackChange, invalidate, invalidateByteIndexes, isValid, setOpcodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface serp.bytecode.InstructionPtr
getCode
-
Field Details
-
_target
-
-
Constructor Details
-
JumpInstruction
JumpInstruction(Code owner, int opcode)
-
-
Method Details
-
getTarget
Get the current target instruction to jump to, if it has been set. -
setTarget
Set the instruction to jump to; the instruction must already be added to the code block.- Returns:
- this instruction, for method chaining
-
equalsInstruction
JumpInstructions are equal if they represent the same operation and the instruction they jump to is the same, or if the jump Instruction of either is unset.- Overrides:
equalsInstructionin classInstruction
-
updateTargets
public void updateTargets()Description copied from interface:InstructionPtrUse the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr. This method will be called after the byte code has been read in for the first time and before it is written after modification.- Specified by:
updateTargetsin interfaceInstructionPtr
-
replaceTarget
Description copied from interface:InstructionPtrReplace the given old, likely invalid, target with a new target. The new target Instruction is guaranteed to be in the same code block as this InstructionPtr.- Specified by:
replaceTargetin interfaceInstructionPtr
-
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.- Specified by:
acceptVisitin interfaceVisitAcceptor- Overrides:
acceptVisitin classInstruction
-
read
Description copied from class:InstructionCopy the given instruction data.- Overrides:
readin classInstruction
-
read
Description copied from class:InstructionRead the arguments for this opcode from the given stream. This method should be overridden by opcodes that take arguments.- Overrides:
readin classInstruction- Throws:
IOException
-
write
Description copied from class:InstructionWrite the arguments for this opcode to the given stream. This method should be overridden by opcodes that take arguments.- Overrides:
writein classInstruction- Throws:
IOException
-
setOffset
public void setOffset(int offset) -
getOffset
public int getOffset()
-