public class Code extends Object implements BytecodeAttribute
| Modifier and Type | Class and Description |
|---|---|
static interface |
Code.BytecodeMapAttribute
Maps bytecodes to some kind of attribute.
|
static class |
Code.Handler
The exception handler class is used to store the necessary information
about where control-flow is directed when an exception is raised.
|
static class |
Code.Rewrite
A rewrite defines a sequence of bytecodes that are to be rewritten as a
(potentially) smaller sequence.
|
BytecodeAttribute.Fn, BytecodeAttribute.Reader, BytecodeAttribute.Unknown| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<BytecodeAttribute> |
attributes |
protected ArrayList<Bytecode> |
bytecodes |
protected ArrayList<Code.Handler> |
handlers |
protected ClassFile.Method |
method |
| Constructor and Description |
|---|
Code(Collection<Bytecode> bytecodes,
Collection<Code.Handler> handlers,
ClassFile.Method method) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPoolItems(Set<Constant.Info> constantPool)
When this method is called, the attribute must add all items that it
needs to the constant pool.
|
void |
apply(List<Code.Rewrite> rewrites)
This method accepts a list of rewrites which should be applied.
|
<T extends BytecodeAttribute> |
attribute(Class<T> c) |
List<BytecodeAttribute> |
attributes() |
List<Bytecode> |
bytecodes() |
List<Code.Handler> |
handlers() |
int |
maxLocals()
Determine the maximum number of local variable slots required for
this method.
|
int |
maxStack()
Determine the maximum number of stack slots required for this method.
|
String |
name() |
void |
print(PrintWriter output,
Map<Constant.Info,Integer> constantPool)
This method is used to print the contents of the attribute in
human-readable form, similar to that produced by "javap".
|
void |
validate(List<Code.Rewrite> rewrites)
The purpose of this method is to validate a candidate list of rewrites.
|
void |
write(BinaryOutputStream writer,
Map<Constant.Info,Integer> constantPool)
This method requires the attribute to write itself to the binary stream.
|
protected ArrayList<Code.Handler> handlers
protected ArrayList<BytecodeAttribute> attributes
protected ClassFile.Method method
public Code(Collection<Bytecode> bytecodes, Collection<Code.Handler> handlers, ClassFile.Method method)
public String name()
name in interface BytecodeAttributepublic List<BytecodeAttribute> attributes()
public <T extends BytecodeAttribute> T attribute(Class<T> c)
public int maxLocals()
public int maxStack()
public List<Code.Handler> handlers()
public void addPoolItems(Set<Constant.Info> constantPool)
BytecodeAttributeaddPoolItems in interface BytecodeAttributepublic void write(BinaryOutputStream writer, Map<Constant.Info,Integer> constantPool) throws IOException
BytecodeAttributewrite in interface BytecodeAttributewriter - Outputstream to which the attribute should be written.constantPool - Map of CONSTANT_info items to their index in the constant pool.IOExceptionpublic void validate(List<Code.Rewrite> rewrites)
rewrites - public void apply(List<Code.Rewrite> rewrites)
rewrites - public void print(PrintWriter output, Map<Constant.Info,Integer> constantPool)
BytecodeAttributeprint in interface BytecodeAttributeoutput - Output writer to which the attribute is printed.constantPool - Map of CONSTANT_info items to their index in the constant
pool.Copyright © 2016. All rights reserved.