|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.RawClass.Attribute
harpoon.IR.RawClass.AttributeCode
public class AttributeCode
The Code
attribute is a variable-length attribute used
in the attributes
table of method_info
structures. A Code
attribute contains the Java Virtual
Machine instructions and auxilliary information for a single Java
method, instance initialization method, or class or interface
initialization method. There must be exactly one Code
attribute in each method_info
structure.
AttributeLineNumberTable
,
AttributeLocalVariableTable
,
Attribute
,
MethodInfo
,
ClassFile
Field Summary | |
---|---|
static String |
ATTRIBUTE_NAME
The string naming this Attribute type. |
Attribute[] |
attributes
Each value of the attributes table must be a
variable-length attribute structure. |
byte[] |
code
The code array gives the actual bytes of Java
Virtual Machine code that implement the method. |
ExceptionTable[] |
exception_table
Each entry in the exception_table array describes
one exception handler in the code array. |
int |
max_locals
The value of the max_locals item gives the number
of local variables used by this method, including the parameters
passed to the method on invocation. |
int |
max_stack
The value of the max_stack item gives the maximum
number of words on the operand stack at any point during
execution of this method. |
Fields inherited from class harpoon.IR.RawClass.Attribute |
---|
attribute_name_index, parent |
Constructor Summary | |
---|---|
AttributeCode(ClassFile parent,
int attribute_name_index,
int max_stack,
int max_locals,
byte[] code,
ExceptionTable[] exception_table,
Attribute[] attributes)
Constructor. |
Method Summary | |
---|---|
long |
attribute_length()
The value of the attribute_length item indicates
the length of the attribute, excluding the initial six bytes. |
int |
attributes_count()
|
long |
code_length()
|
Constant |
constant(int index)
Lookup a Constant in the constant_pool . |
int |
exception_table_length()
|
String |
localName(int pc,
int index)
Return the symbolic name of a local variable, or null if
one cannot be found. |
void |
print(PrintWriter pw,
int indent)
Pretty-print the contents of this attribute. |
void |
write(ClassDataOutputStream out)
Write to bytecode stream. |
Methods inherited from class harpoon.IR.RawClass.Attribute |
---|
attribute_name_index, attribute_name, read, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ATTRIBUTE_NAME
Attribute
type.
public int max_stack
max_stack
item gives the maximum
number of words on the operand stack at any point during
execution of this method.
public int max_locals
max_locals
item gives the number
of local variables used by this method, including the parameters
passed to the method on invocation. The index of the first
local variable is 0.
public byte[] code
code
array gives the actual bytes of Java
Virtual Machine code that implement the method.
public ExceptionTable[] exception_table
exception_table
array describes
one exception handler in the code
array.
public Attribute[] attributes
attributes
table must be a
variable-length attribute structure. A Code
attribute can have any number of optional attributes associated
with it. Currently, the LineNumberTable
and
LocalVariableTable
attributes, both of which
contain debugging information, are defined and used with the
Code
attribute.
Constructor Detail |
---|
public AttributeCode(ClassFile parent, int attribute_name_index, int max_stack, int max_locals, byte[] code, ExceptionTable[] exception_table, Attribute[] attributes)
Method Detail |
---|
public long code_length()
public int exception_table_length()
public int attributes_count()
public long attribute_length()
Attribute
attribute_length
item indicates
the length of the attribute, excluding the initial six bytes.
attribute_length
in class Attribute
public void write(ClassDataOutputStream out) throws IOException
write
in class Attribute
IOException
public String localName(int pc, int index)
null
if
one cannot be found.
index
- the index of the local variable to look up.
null
.public Constant constant(int index)
Constant
in the constant_pool
.
Provided for use of methods that parse the code array.
public void print(PrintWriter pw, int indent)
print
in class Attribute
indent
- the indentation level to use.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |