|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.cunit.classFile.code.InstructionList
public class InstructionList
Represents a list of Java instructions.
| Field Summary | |
|---|---|
protected int |
_index
|
(package private) java.util.LinkedList<AInstruction> |
_instructionList
|
(package private) LineNumberTable |
_lnt
|
| Constructor Summary | |
|---|---|
InstructionList(byte[] code)
Constructor. |
|
InstructionList(byte[] code,
int index)
Constructor. |
|
InstructionList(InstructionList original)
Copy constructor. |
|
| Method Summary | |
|---|---|
boolean |
advanceIndex()
Advance the program index to the next instruction. |
boolean |
advanceIndex(int count)
Advance the program index by multiple instructions. |
boolean |
deleteInstr(CodeAttributeInfo codeAttribute)
This method deletes the instruction at the program index. |
boolean |
equals(java.lang.Object o)
Return true if this instruction list and the other object are equal. |
boolean |
findInstruction(AInstruction instr)
Finds the next instruction that matches the specified instruction completely and moves the program counter there. |
boolean |
findInstruction(AInstruction[] instrs)
Finds the next instruction that matches one of the specified instructions completely and moves the program counter there. |
boolean |
findOpcode(byte opcode)
Finds the next instruction with the specified opcode and moves the program counter there. |
boolean |
findOpcode(byte[] opcodes)
Finds the next instruction with one of the specified opcodes and moves the program counter there. |
byte[] |
getCode()
Accessor for the bytecode. |
int |
getIndex()
Accessor for the program index. |
AInstruction |
getInstr()
Return the instruction at the program index. |
int |
getLength()
Get the length of the instruction list. |
byte |
getOpcode()
Return the opcode at the program index. |
int |
getPCFromIndex(int index)
Calculate the PC for an index. |
int |
hashCode()
Return hash code. |
void |
insertBeforeInstr(AInstruction instr,
CodeAttributeInfo codeAttribute)
This method inserts the instruction before the program counter. |
void |
insertInstr(AInstruction instr,
CodeAttributeInfo codeAttribute)
This method inserts the instruction at the program counter. |
protected void |
relocateBranches(AInstruction relocInstr,
int ip)
Relocate branches in the instruction. |
boolean |
rewindIndex()
Rewind the program index to the previous instruction. |
boolean |
rewindIndex(int count)
Rewind the program index by multiple instructions. |
void |
setCode(byte[] code)
Mutator for the bytecode. |
void |
setIndex(int index)
Mutator for the program index. |
java.lang.String |
toString()
Return a human-readable version of the code. |
java.lang.String |
toString(boolean lineNumbers,
boolean PCs,
ConstantPool cp)
Return a human-readable version of the code. |
java.lang.String |
toString(ConstantPool cp)
Return a human-readable version of the code. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
java.util.LinkedList<AInstruction> _instructionList
protected int _index
LineNumberTable _lnt
| Constructor Detail |
|---|
public InstructionList(byte[] code)
code - bytecodepublic InstructionList(InstructionList original)
original - original
public InstructionList(byte[] code,
int index)
throws java.lang.IndexOutOfBoundsException
code - bytecodeindex - program index.
java.lang.IndexOutOfBoundsException| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(ConstantPool cp)
cp - constant pool
public java.lang.String toString(boolean lineNumbers,
boolean PCs,
ConstantPool cp)
lineNumbers - print line numbersPCs - print PC valuescp - constant pool, or null if not verbose
public byte[] getCode()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic void setCode(byte[] code)
code - bytecodepublic int getIndex()
public int getPCFromIndex(int index)
index - index
public int getLength()
public void setIndex(int index)
throws java.lang.IndexOutOfBoundsException,
java.lang.IllegalArgumentException
index - new program index
java.lang.IndexOutOfBoundsException
java.lang.IllegalArgumentExceptionpublic boolean advanceIndex(int count)
count - number of instructions
public boolean advanceIndex()
public boolean rewindIndex(int count)
count - number of instructions
public boolean rewindIndex()
public byte getOpcode()
public AInstruction getInstr()
public boolean deleteInstr(CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if none
public void insertInstr(AInstruction instr,
CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if noneinstr - instruction to be inserted
protected void relocateBranches(AInstruction relocInstr,
int ip)
relocInstr - instruction whose branches should be relocatedip - insertion point
public void insertBeforeInstr(AInstruction instr,
CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if noneinstr - instruction to be insertedpublic boolean findOpcode(byte opcode)
opcode - opcode to find
public boolean findOpcode(byte[] opcodes)
opcodes - array of opcodes to find
public boolean findInstruction(AInstruction instr)
instr - instruction to find
public boolean findInstruction(AInstruction[] instrs)
instrs - instructions to find
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - other object
public int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||