|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.arizona.cs.mbel.instructions.InstructionList
Represents a contiguous list of instructions, as in a method. The underlying structure is a linked list of InstructionHandle objects. There is also a factory method to parse an entire instruction list, using the Instruction.parseInstruction method. There are also methods to assign byte offsets to the InstructionHandles once user manipulation is complete.
Constructor Summary | |
InstructionList()
Creates an InstructionList with no instructions in it. |
|
InstructionList(ClassParser parse,
long CodeSize)
Parses an InstructionList from a file |
Method Summary | |
InstructionHandle |
append(Instruction i)
Adds an instruction to the end of the list |
InstructionHandle |
append(InstructionHandle handle)
Adds an InstructionHandle to the end of the list |
void |
clear()
Deletes all the instructions in the list |
boolean |
contains(Instruction i)
Returns true iff this InstructionList contains the given instruction |
boolean |
contains(InstructionHandle ih)
Returns true iff this InstrucitonList contains the given handle |
void |
delete(Instruction i)
Deletes the first occurrence of the given instruction from the list |
void |
delete(InstructionHandle ih)
Deletes the given handle from the list. |
void |
delete(InstructionHandle from,
InstructionHandle to)
Searches for 'from' and 'to'. |
void |
delete(Instruction from,
Instruction to)
Searches for 'from' and 'to'. |
void |
emit(ByteBuffer buffer,
ClassEmitter emitter)
Write this InstructionList out to a buffer |
InstructionHandle |
getEnd()
Returns the handle of the last instruction in this list |
InstructionHandle |
getHandleAt(int position)
Returns the InstructionHandle whose byte offset corresponds to position (not to be used until after a call to setPositions) |
InstructionHandle |
getHandleEndingAt(int position)
Returns the InstrucitonHandle that would end at byte offset 'position' (i.e. the next byte after this instruction is 'position') |
InstructionHandle[] |
getInstructionHandles()
Returns an array of the handles in this list, in order. |
int[] |
getInstructionPositions()
Returns the list of byte offset for each instruction (must be used after setPositions) |
Instruction[] |
getInstructions()
Returns the instructions in this list, in order |
int |
getLength()
Returns the number of instructions in this list |
int |
getSizeInBytes()
Returns the total size in bytes of all the instructions in this list put together. |
InstructionHandle |
getStart()
Returns the handle of the first instruction in this list |
boolean |
isEmpty()
Returns true iff the list has no instructions in it |
java.util.Iterator |
iterator()
|
InstructionHandle |
prepend(Instruction i)
Adds this instruction as the first instruction in the list |
InstructionHandle |
prepend(InstructionHandle handle)
Adds this InstructionHandle as the first handle in the list |
void |
setPositions()
Sets the byte offset in the InstructionHandles of this list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InstructionList()
public InstructionList(ClassParser parse, long CodeSize) throws java.io.IOException, MSILParseException
parse
- the ClassParser for this moduleCodeSize
- the size in bytes of the instrucitons on disk; used as a stopping pointMethod Detail |
public java.util.Iterator iterator()
public InstructionHandle getHandleAt(int position)
position
- the byte offset to search for (starts before any prefixes on the instruction)
public InstructionHandle getHandleEndingAt(int position)
position
- the byte offset right after the target instruction
public InstructionHandle append(Instruction i)
public InstructionHandle append(InstructionHandle handle)
public InstructionHandle prepend(Instruction i)
public InstructionHandle prepend(InstructionHandle handle)
public boolean contains(InstructionHandle ih)
public boolean contains(Instruction i)
public void clear()
public void delete(InstructionHandle ih) throws TargetLostException
TargetLostException
public void delete(Instruction i) throws TargetLostException
TargetLostException
public void delete(InstructionHandle from, InstructionHandle to) throws TargetLostException
TargetLostException
public void delete(Instruction from, Instruction to) throws TargetLostException
TargetLostException
public int getLength()
public InstructionHandle getEnd()
public InstructionHandle getStart()
public InstructionHandle[] getInstructionHandles()
public int[] getInstructionPositions()
public Instruction[] getInstructions()
public boolean isEmpty()
public void setPositions()
public void emit(ByteBuffer buffer, ClassEmitter emitter)
public int getSizeInBytes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |