|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.fub.bytecode.generic.InstructionList
This class is a container for a list of `Instruction's, instructions can be appended, inserted, deleted, etc.. Instructions are being wrapped into InstructionHandle objects that are returned upon append/insert operations. They give the user (read only) access to the list structure, it can be traversed and manipulated in a controlled way. A list is finally dumped to a byte code array with `getByteCode'.
Instruction,
InstructionHandle,
BranchHandle, Serialized Form| Constructor Summary | |
InstructionList()
Create (empty) instruction list. |
|
InstructionList(BranchInstruction i)
Create instruction list containing one instruction. |
|
InstructionList(byte[] code)
Initialize instruction list from byte array. |
|
InstructionList(CompoundInstruction c)
Initialize list with (nonnull) compound instruction. |
|
InstructionList(Instruction i)
Create instruction list containing one instruction. |
|
| Method Summary | |
BranchHandle |
append(BranchInstruction i)
Append a branch instruction to the end of this list. |
InstructionHandle |
append(CompoundInstruction c)
Append a compound instruction. |
InstructionHandle |
append(Instruction i)
Append an instruction to the end of this list. |
InstructionHandle |
append(Instruction i,
CompoundInstruction c)
Append a compound instruction, after instruction i. |
BranchHandle |
append(InstructionHandle ih,
BranchInstruction i)
Append an instruction after instruction (handle) ih contained in this list. |
InstructionHandle |
append(InstructionHandle ih,
CompoundInstruction c)
Append a compound instruction. |
InstructionHandle |
append(InstructionHandle ih,
Instruction i)
Append an instruction after instruction (handle) ih contained in this list. |
InstructionHandle |
append(InstructionHandle ih,
InstructionList il)
Append another list after instruction (handle) ih contained in this list. |
InstructionHandle |
append(Instruction i,
Instruction j)
Append a single instruction j after another instruction i, which must be in this list of course! |
InstructionHandle |
append(Instruction i,
InstructionList il)
Append another list after instruction i contained in this list. |
InstructionHandle |
append(InstructionList il)
Append another list to this one. |
boolean |
contains(Instruction i)
|
boolean |
contains(InstructionHandle i)
|
InstructionList |
copy()
|
void |
delete(Instruction i)
Remove instruction from this list. |
void |
delete(InstructionHandle ih)
Remove instruction from this list. |
void |
delete(InstructionHandle from,
InstructionHandle to)
Remove instructions from instruction `from' to instruction `to' contained in this list. |
void |
delete(Instruction from,
Instruction to)
Remove instructions from instruction `from' to instruction `to' contained in this list. |
void |
dispose()
Delete contents of list. |
java.util.Enumeration |
elements()
|
static InstructionHandle |
findHandle(InstructionHandle[] ihs,
int[] pos,
int count,
int target)
Find the target instruction (handle) that corresponds to the given target position (byte code offset). |
InstructionHandle |
findHandle(int pos)
Get instruction handle for instruction at byte code position pos. |
byte[] |
getByteCode()
|
InstructionHandle |
getEnd()
|
InstructionHandle[] |
getInstructionHandles()
|
int[] |
getInstructionPositions()
Get positions (offsets) of all instructions in the list. |
int |
getLength()
|
InstructionHandle |
getStart()
|
BranchHandle |
insert(BranchInstruction i)
Insert a branch instruction at start of this list. |
InstructionHandle |
insert(CompoundInstruction c)
Insert a compound instruction. |
InstructionHandle |
insert(Instruction i)
Insert an instruction at start of this list. |
InstructionHandle |
insert(Instruction i,
CompoundInstruction c)
Insert a compound instruction before instruction i. |
BranchHandle |
insert(InstructionHandle ih,
BranchInstruction i)
Insert an instruction before instruction (handle) ih contained in this list. |
InstructionHandle |
insert(InstructionHandle ih,
CompoundInstruction c)
Insert a compound instruction. |
InstructionHandle |
insert(InstructionHandle ih,
Instruction i)
Insert an instruction before instruction (handle) ih contained in this list. |
InstructionHandle |
insert(InstructionHandle ih,
InstructionList il)
Insert another list before Instruction handle ih contained in this list. |
InstructionHandle |
insert(Instruction i,
Instruction j)
Insert a single instruction j before another instruction i, which must be in this list of course! |
InstructionHandle |
insert(Instruction i,
InstructionList il)
Insert another list before Instruction i contained in this list. |
InstructionHandle |
insert(InstructionList il)
Insert another list. |
boolean |
isEmpty()
Test for empty list. |
void |
redirectBranches(InstructionHandle old_target,
InstructionHandle new_target)
Redirect all references from old_target to new_target, i.e., update targets of branch instructions. |
void |
redirectExceptionHandlers(CodeExceptionGen[] exceptions,
InstructionHandle old_target,
InstructionHandle new_target)
Redirect all references of exception handlers from old_target to new_target. |
void |
redirectLocalVariables(LocalVariableGen[] lg,
InstructionHandle old_target,
InstructionHandle new_target)
Redirect all references of local variables from old_target to new_target. |
void |
setPositions()
|
void |
setPositions(boolean check)
Give all instructions their position number (offset in byte stream), i.e., make the list ready to be dumped. |
int |
size()
|
java.lang.String |
toString()
|
java.lang.String |
toString(boolean verbose)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public InstructionList()
public InstructionList(Instruction i)
i - initial instructionpublic InstructionList(BranchInstruction i)
i - initial instructionpublic InstructionList(CompoundInstruction c)
c - compound instruction (list)public InstructionList(byte[] code)
code - byte array containing the instructions| Method Detail |
public boolean isEmpty()
public static InstructionHandle findHandle(InstructionHandle[] ihs,
int[] pos,
int count,
int target)
ihs - array of instruction handlespos - array of positions corresponding to ihscount - length of arraystarget - target position to search forpublic InstructionHandle findHandle(int pos)
pos - byte code position to search for
public InstructionHandle append(InstructionHandle ih,
InstructionList il)
ih - where to append the instruction listil - Instruction list to append to this one
public InstructionHandle append(Instruction i,
InstructionList il)
i - where to append the instruction listil - Instruction list to append to this onepublic InstructionHandle append(InstructionList il)
il - list to append to end of this listpublic InstructionHandle append(Instruction i)
i - instruction to appendpublic BranchHandle append(BranchInstruction i)
i - branch instruction to append
public InstructionHandle append(Instruction i,
Instruction j)
i - Instruction in listj - Instruction to append after i in list
public InstructionHandle append(Instruction i,
CompoundInstruction c)
i - Instruction in listc - The composite instruction (containing an InstructionList)public InstructionHandle append(CompoundInstruction c)
c - The composite instruction (containing an InstructionList)
public InstructionHandle append(InstructionHandle ih,
CompoundInstruction c)
ih - where to append the instruction listc - The composite instruction (containing an InstructionList)
public InstructionHandle append(InstructionHandle ih,
Instruction i)
ih - where to append the instruction listi - Instruction to append
public BranchHandle append(InstructionHandle ih,
BranchInstruction i)
ih - where to append the instruction listi - Instruction to append
public InstructionHandle insert(InstructionHandle ih,
InstructionList il)
i - where to append the instruction listil - Instruction list to insertpublic InstructionHandle insert(InstructionList il)
il - list to insert before start of this list
public InstructionHandle insert(Instruction i,
InstructionList il)
i - where to append the instruction listil - Instruction list to insertpublic InstructionHandle insert(Instruction i)
i - instruction to insertpublic BranchHandle insert(BranchInstruction i)
i - branch instruction to insert
public InstructionHandle insert(Instruction i,
Instruction j)
i - Instruction in listj - Instruction to insert before i in list
public InstructionHandle insert(Instruction i,
CompoundInstruction c)
i - Instruction in listc - The composite instruction (containing an InstructionList)public InstructionHandle insert(CompoundInstruction c)
c - The composite instruction (containing an InstructionList)
public InstructionHandle insert(InstructionHandle ih,
Instruction i)
ih - where to insert to the instruction listi - Instruction to insert
public InstructionHandle insert(InstructionHandle ih,
CompoundInstruction c)
ih - where to insert the instruction listc - The composite instruction (containing an InstructionList)
public BranchHandle insert(InstructionHandle ih,
BranchInstruction i)
ih - where to insert to the instruction listi - Instruction to insert
public void delete(InstructionHandle ih)
throws TargetLostException
ih - instruction (handle) to remove
public void delete(Instruction i)
throws TargetLostException
i - instruction to remove
public void delete(InstructionHandle from,
InstructionHandle to)
throws TargetLostException
from - where to start deleting (inclusive)to - where to end deleting (inclusive)
public void delete(Instruction from,
Instruction to)
throws TargetLostException
from - where to start deleting (inclusive)to - where to end deleting (inclusive)public boolean contains(InstructionHandle i)
public boolean contains(Instruction i)
public void setPositions()
public void setPositions(boolean check)
check - Perform sanity checks, e.g. if all targeted instructions really belong
to this listpublic byte[] getByteCode()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean verbose)
verbose - toggle output formatpublic java.util.Enumeration elements()
public InstructionHandle[] getInstructionHandles()
public int[] getInstructionPositions()
public InstructionList copy()
public void dispose()
public InstructionHandle getStart()
public InstructionHandle getEnd()
public int getLength()
public int size()
public void redirectBranches(InstructionHandle old_target,
InstructionHandle new_target)
old_target - the old target instruction handlenew_target - the new target instruction handle
public void redirectLocalVariables(LocalVariableGen[] lg,
InstructionHandle old_target,
InstructionHandle new_target)
public void redirectExceptionHandlers(CodeExceptionGen[] exceptions,
InstructionHandle old_target,
InstructionHandle new_target)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||