|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.java.AttributeInfo | +--edu.wisc.cs.java.CodeAttribute
This class represents the code attribute of a method. One such code attribute is expected for any method which is not native or abstract.
Fields inherited from class edu.wisc.cs.java.AttributeInfo |
attributeData,
name_index,
num_bytes |
Constructor Summary | |
CodeAttribute(char name_index,
java.io.DataInputStream in)
Constructs a new code attribute reading data from the given stream with the given name index. |
|
CodeAttribute(int name_index,
boolean static_meth)
Creates a new CodeAttribute with the specified name index. |
Method Summary | |
int |
addLocal()
Adds a new local variable to this code. |
void |
appendBytecode(Bytecode b)
Adds a new bytecode to the end of this code attribute. |
Bytecode |
getBytecode(int i)
Returns the specified bytecode in this method. |
int |
getMaxStack()
Returns the maximum number of word on this methods operand stack at any time. |
int |
getNBytecodes()
Returns the number of instructions in this code attribute. |
int |
getNBytes()
Resolves label offsets and computes the size of this code attribute, not including the 6 byte attribute header. |
int |
getNLocals()
Returns the number of local variables this code uses. |
int |
getSize()
Returns the number of bytes necessary to represent this code attribute. |
void |
insertBytecode(int i,
Bytecode b)
Inserts a new instruction at the specified index. |
void |
removeBytecode(int i)
Removes a bytecode at a specified index. |
void |
setMaxStack(int max)
Sets the maximum number of words on the operand stack. |
void |
writeTo(java.io.DataOutputStream out)
Writes code data to the specified stream. |
Methods inherited from class edu.wisc.cs.java.AttributeInfo |
getNameIndex |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public CodeAttribute(int name_index, boolean static_meth)
name_index
- the constant pool index of the UTF8 constant "Code".static_meth
- true if this code belongs to a static method.public CodeAttribute(char name_index, java.io.DataInputStream in) throws java.io.IOException
n_index
- the index in the constant pool of the attribute name.in
- the stream from which to read all attribute data.Method Detail |
public int getNLocals()
public int addLocal()
public void setMaxStack(int max)
max
- the new max_stack value.public int getMaxStack()
public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
out
- the destination stream to write data to.public int getSize()
public int getNBytes()
public int getNBytecodes()
public Bytecode getBytecode(int i)
i
- the index of the bytecode to be returned.public void removeBytecode(int i)
i
- the index of the instruction to remove.public void insertBytecode(int i, Bytecode b)
i
- the position at which to insert the new instruction.b
- the instruction to insert.public void appendBytecode(Bytecode b)
b
- the instruction to append.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |