Instruction, InstructionHandle, BranchHandle
| Modifier and Type | Field and Description |
|---|---|
| private InstructionHandle | |
| private int | |
| private int[] | |
| private InstructionHandle |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | InstructionList(byte[]
byte array containing the instructions code)Initialize instruction list from byte array. |
| Modifier and Type | Method and Description |
|---|---|
| public InstructionHandle | Returns: instruction handle pointing to the first appended instructionwhere to append the instruction list appendTo, InstructionList Instruction list to append to this one appendee)Append another list after instruction (handle) ih contained in this list. |
| public InstructionHandle | Returns: instruction handle pointing to the first appended instructionwhere to append the instruction list i, InstructionList Instruction list to append to this one il)Append another list after instruction i contained in this list. |
| public InstructionHandle | Returns: instruction handle of the first appended instructionlist to append to end of this list il)Append another list to this one. |
| private void | |
| public InstructionHandle | Returns: instruction handle of the appended instructioninstruction to append i)Append an instruction to the end of this list. |
| public BranchHandle | Returns: branch instruction handle of the appended instructionbranch instruction to append i)Append a branch instruction to the end of this list. |
| public InstructionHandle | Returns: instruction handle of the first appended instructionInstruction in list i, Instruction Instruction to append after i in list j)Append a single instruction j after another instruction i, which must be in this list of course! |
| public InstructionHandle | Returns: instruction handle pointing to the first appended instructionwhere to append the instruction list ih, Instruction Instruction to append i)Append an instruction after instruction (handle) ih contained in this list. |
| public BranchHandle | Returns: instruction handle pointing to the first appended instructionwhere to append the instruction list ih, InstructionBranch Instruction to append i)Append an instruction after instruction (handle) ih contained in this list. |
| public InstructionHandle | |
| public InstructionHandle | |
| public InstructionHandle | |
| private void | |
| private void | |
| public boolean | |
| public boolean | |
| public InstructionList | |
| public void | |
| public void | delete(InstructionHandle
where to start deleting (inclusive) from, InstructionHandle where to end deleting (inclusive) to)Remove instructions from instruction `from' to instruction `to' contained in this list. |
| public void | delete(Instruction
where to start deleting (inclusive) from, Instruction where to end deleting (inclusive) to)Remove instructions from instruction `from' to instruction `to' contained in this list. |
| public void | |
| public static InstructionHandle | |
| public static InstructionHandle | Returns: target position's instruction handle if availablearray of instruction handles, i.e. il.getInstructionHandles() ihs, int[] array of positions corresponding to ihs, i.e. il.getInstructionPositions() pos, int length of arrays count, int target position to search for target, boolean returnClosestIfNoExactMatch)Find the target instruction (handle) that corresponds to the given target position (byte code offset). |
| public InstructionHandle | Returns: target position's instruction handle if availablebyte code position to search for pos)Get instruction handle for instruction at byte code position pos. |
| public InstructionHandle | |
| public InstructionHandle | findHandle(int pos, InstructionHandle[] instructionArray, boolean useClosestApproximationIfNoExactFound)
|
| private InstructionHandle | Returns: instruction found on success, null otherwiseinstruction to search for i)Search for given Instruction reference, start at beginning of list. |
| private InstructionHandle | Returns: instruction found on success, null otherwiseinstruction to search for i)Search for given Instruction reference, start at end of list |
| public byte[] | Returns: the byte code ready to be dumpedWhen everything is finished, use this method to convert the instruction list into an array of bytes. |
| public InstructionHandle | |
| public InstructionHandle[] | |
| public int[] | Returns: array containing all instruction's offset in byte codeGet positions (offsets) of all instructions in the list. |
| public Instruction[] | Returns: an array of instructions without target information for branch instructions.
|
| public InstructionHandle[] | |
| public int | |
| public InstructionHandle | |
| public InstructionHandle | Returns: instruction handle of the first inserted instructionwhere to append the instruction list ih, InstructionList Instruction list to insert il)Insert another list before Instruction handle ih contained in this list. |
| public InstructionHandle | Returns: instruction handle of the first inserted instructionlist to insert before start of this list il)Insert another list. |
| private void | |
| public InstructionHandle | Returns: instruction handle pointing to the first inserted instruction, i.e., il.getStart()where to append the instruction list i, InstructionList Instruction list to insert il)Insert another list before Instruction i contained in this list. |
| public InstructionHandle | Returns: instruction handle of the inserted instructioninstruction to insert i)Insert an instruction at start of this list. |
| public BranchHandle | Returns: branch instruction handle of the appended instructionbranch instruction to insert i)Insert a branch instruction at start of this list. |
| public InstructionHandle | Returns: instruction handle of the first inserted instructionInstruction in list i, Instruction Instruction to insert before i in list j)Insert a single instruction j before another instruction i, which must be in this list of course! |
| public InstructionHandle | Returns: instruction handle of the first inserted instructionwhere to insert to the instruction list ih, Instruction Instruction to insert i)Insert an instruction before instruction (handle) ih contained in this list. |
| public BranchHandle | Returns: instruction handle of the first inserted instructionwhere to insert to the instruction list ih, InstructionBranch Instruction to insert i)Insert an instruction before instruction (handle) ih contained in this list. |
| public boolean | |
| public Iterator | |
| public void | move(InstructionHandle
of moved block start, InstructionHandle of moved block end, InstructionHandle of moved block target)Take all instructions (handles) from "start" to "end" and append them after the new location "target". |
| public void | move(InstructionHandle
moved instruction ih, InstructionHandle new location of moved instruction target)Move a single instruction (handle) to a new location. |
| public void | redirectBranches(InstructionHandle
the old target instruction handle old_target, InstructionHandle the new target instruction handle new_target)Redirect all references from old_target to new_target, i.e., update targets of branch instructions. |
| public void | redirectExceptionHandlers(CodeExceptionGen[]
array of exception handlers exceptions, InstructionHandle the old target instruction handle old_target, InstructionHandle the new target instruction handle new_target)Redirect all references of exception handlers from old_target to new_target. |
| public void | redirectLocalVariables(LocalVariableGen[]
array of local variables lg, InstructionHandle the old target instruction handle old_target, InstructionHandle the new target instruction handle new_target)Redirect all references of local variables from old_target to new_target. |
| private void | remove(InstructionHandle
where to start deleting (predecessor, exclusive) prev, InstructionHandle where to end deleting (successor, exclusive) next, boolean careAboutLostTargeters)Remove from instruction 'prev' to instruction 'next' both contained in this list. |
| public void | replaceConstantPool(ConstantPool old_cp, ConstantPool new_cp)
Replace all references to the old constant pool with references to the new constant pool |
| public void | |
| public void | setPositions(boolean
Perform sanity checks, e.g. if all targeted instructions really belong to this list check)Give all instructions their position number (offset in byte stream), i.e., make the list ready to be dumped. |
| public int | |
| public String | |
| public String | Returns: String containing all instructions in this list.toggle output format verbose)
|
| end | back to summary |
|---|---|
| private InstructionHandle end | |
| length | back to summary |
|---|---|
| private int length | |
| positions | back to summary |
|---|---|
| private int[] positions | |
| start | back to summary |
|---|---|
| private InstructionHandle start | |
| InstructionList | back to summary |
|---|---|
| public InstructionList() | |
| InstructionList | back to summary |
|---|---|
| public InstructionList(Instruction i) | |
| InstructionList | back to summary |
|---|---|
| public InstructionList(byte[] code) Initialize instruction list from byte array.
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(InstructionHandle appendTo, InstructionList appendee) Append another list after instruction (handle) ih contained in this list. Consumes argument list, i.e., it becomes empty.
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(Instruction i, InstructionList il) Append another list after instruction i contained in this list. Consumes argument list, i.e., it becomes empty.
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(InstructionList il) Append another list to this one. Consumes argument list, i.e., it becomes empty.
| |
| append | back to summary |
|---|---|
| private void append(InstructionHandle ih) Append an instruction to the end of this list.
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(Instruction i) Append an instruction to the end of this list.
| |
| append | back to summary |
|---|---|
| public BranchHandle append(InstructionBranch i) Append a branch instruction to the end of this list.
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(Instruction i, Instruction j) Append a single instruction j after another instruction i, which must be in this list of course!
| |
| append | back to summary |
|---|---|
| public InstructionHandle append(InstructionHandle ih, Instruction i) Append an instruction after instruction (handle) ih contained in this list.
| |
| append | back to summary |
|---|---|
| public BranchHandle append(InstructionHandle ih, InstructionBranch i) Append an instruction after instruction (handle) ih contained in this list.
| |
| appendDUP | back to summary |
|---|---|
| public InstructionHandle appendDUP() | |
| appendNOP | back to summary |
|---|---|
| public InstructionHandle appendNOP() | |
| appendPOP | back to summary |
|---|---|
| public InstructionHandle appendPOP() | |
| checkInstructionList | back to summary |
|---|---|
| private void checkInstructionList() | |
| clear | back to summary |
|---|---|
| private void clear() | |
| contains | back to summary |
|---|---|
| public boolean contains(InstructionHandle i) | |
| contains | back to summary |
|---|---|
| public boolean contains(Instruction i) | |
| copy | back to summary |
|---|---|
public InstructionList copy()
| |
| delete | back to summary |
|---|---|
| public void delete(InstructionHandle ih) throws TargetLostException Remove instruction from this list. The corresponding Instruction handles must not be reused!
| |
| delete | back to summary |
|---|---|
| public void delete(InstructionHandle from, InstructionHandle to) throws TargetLostException Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
| |
| delete | back to summary |
|---|---|
| public void delete(Instruction from, Instruction to) throws TargetLostException Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
| |
| dispose | back to summary |
|---|---|
| public void dispose() Delete contents of list. Provides better memory utilization, because the system then may reuse the instruction handles. This
method is typically called right after | |
| findHandle | back to summary |
|---|---|
| public static InstructionHandle findHandle(InstructionHandle[] ihs, int[] pos, int count, int target) | |
| findHandle | back to summary |
|---|---|
| public static InstructionHandle findHandle(InstructionHandle[] ihs, int[] pos, int count, int target, boolean returnClosestIfNoExactMatch) Find the target instruction (handle) that corresponds to the given target position (byte code offset).
| |
| findHandle | back to summary |
|---|---|
| public InstructionHandle findHandle(int pos) Get instruction handle for instruction at byte code position pos. This only works properly, if the list is freshly initialized from a byte array or setPositions() has been called before this method.
| |
| findHandle | back to summary |
|---|---|
| public InstructionHandle findHandle(int pos, InstructionHandle[] instructionArray) | |
| findHandle | back to summary |
|---|---|
| public InstructionHandle findHandle(int pos, InstructionHandle[] instructionArray, boolean useClosestApproximationIfNoExactFound) | |
| findInstruction1 | back to summary |
|---|---|
| private InstructionHandle findInstruction1(Instruction i) Search for given Instruction reference, start at beginning of list.
| |
| findInstruction2 | back to summary |
|---|---|
| private InstructionHandle findInstruction2(Instruction i) Search for given Instruction reference, start at end of list
| |
| getByteCode | back to summary |
|---|---|
| public byte[] getByteCode() When everything is finished, use this method to convert the instruction list into an array of bytes.
| |
| getEnd | back to summary |
|---|---|
public InstructionHandle getEnd()
| |
| getInstructionHandles | back to summary |
|---|---|
public InstructionHandle[] getInstructionHandles()
| |
| getInstructionPositions | back to summary |
|---|---|
| public int[] getInstructionPositions() Get positions (offsets) of all instructions in the list. This relies on that the list has been freshly created from an byte code array, or that setPositions() has been called. Otherwise this may be inaccurate.
| |
| getInstructions | back to summary |
|---|---|
public Instruction[] getInstructions()
| |
| getInstructionsAsArray | back to summary |
|---|---|
| public InstructionHandle[] getInstructionsAsArray() | |
| getLength | back to summary |
|---|---|
public int getLength()
| |
| getStart | back to summary |
|---|---|
public InstructionHandle getStart()
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(InstructionHandle ih, InstructionList il) Insert another list before Instruction handle ih contained in this list. Consumes argument list, i.e., it becomes empty.
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(InstructionList il) Insert another list.
| |
| insert | back to summary |
|---|---|
| private void insert(InstructionHandle ih) Insert an instruction at start of this list.
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(Instruction i, InstructionList il) Insert another list before Instruction i contained in this list. Consumes argument list, i.e., it becomes empty.
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(Instruction i) Insert an instruction at start of this list.
| |
| insert | back to summary |
|---|---|
| public BranchHandle insert(InstructionBranch i) Insert a branch instruction at start of this list.
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(Instruction i, Instruction j) Insert a single instruction j before another instruction i, which must be in this list of course!
| |
| insert | back to summary |
|---|---|
| public InstructionHandle insert(InstructionHandle ih, Instruction i) Insert an instruction before instruction (handle) ih contained in this list.
| |
| insert | back to summary |
|---|---|
| public BranchHandle insert(InstructionHandle ih, InstructionBranch i) Insert an instruction before instruction (handle) ih contained in this list.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() | |
| iterator | back to summary |
|---|---|
public Iterator
| |
| move | back to summary |
|---|---|
| public void move(InstructionHandle start, InstructionHandle end, InstructionHandle target) Take all instructions (handles) from "start" to "end" and append them after the new location "target". Of course, "end" must
be after "start" and target must not be located withing this range. If you want to move something to the start of the list
use null as value for target.
| |
| move | back to summary |
|---|---|
| public void move(InstructionHandle ih, InstructionHandle target) Move a single instruction (handle) to a new location.
| |
| redirectBranches | back to summary |
|---|---|
| public void redirectBranches(InstructionHandle old_target, InstructionHandle new_target) Redirect all references from old_target to new_target, i.e., update targets of branch instructions.
| |
| redirectExceptionHandlers | back to summary |
|---|---|
| public void redirectExceptionHandlers(CodeExceptionGen[] exceptions, InstructionHandle old_target, InstructionHandle new_target) Redirect all references of exception handlers from old_target to new_target.
| |
| redirectLocalVariables | back to summary |
|---|---|
| public void redirectLocalVariables(LocalVariableGen[] lg, InstructionHandle old_target, InstructionHandle new_target) Redirect all references of local variables from old_target to new_target.
| |
| remove | back to summary |
|---|---|
| private void remove(InstructionHandle prev, InstructionHandle next, boolean careAboutLostTargeters) throws TargetLostException Remove from instruction 'prev' to instruction 'next' both contained in this list. If careAboutLostTargeters is true then this method will throw a TargetLostException when one of the removed instruction handles is still being targeted.
| |
| replaceConstantPool | back to summary |
|---|---|
| public void replaceConstantPool(ConstantPool old_cp, ConstantPool new_cp) Replace all references to the old constant pool with references to the new constant pool | |
| setPositions | back to summary |
|---|---|
| public void setPositions() | |
| setPositions | back to summary |
|---|---|
| public void setPositions(boolean check) Give all instructions their position number (offset in byte stream), i.e., make the list ready to be dumped.
| |
| size | back to summary |
|---|---|
public int size()
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
public String toString(boolean verbose)
| |