org.codehaus.janino
public class CodeContext extends Object
Nested Class Summary | |
---|---|
interface | CodeContext.FixUp
A throw-in interface that marks Offsets
as "fix-ups": During the execution of
CodeContext, all "fix-ups" are invoked and
can do last touches to the code attribute.
|
class | CodeContext.Inserter
A class that implements an insertion point into a "Code"
attribute. |
class | CodeContext.LineNumberOffset |
class | CodeContext.Offset
A class that represents an offset within a "Code" attribute.
|
Constructor Summary | |
---|---|
CodeContext(ClassFile classFile)
Create an empty "Code" attribute. |
Method Summary | |
---|---|
void | addExceptionTableEntry(CodeContext.Offset startPC, CodeContext.Offset endPC, CodeContext.Offset handlerPC, String catchTypeFD)
Add another entry to the "exception_table" of this code attribute (see JVMS 4.7.3). |
short | allocateLocalVariable(short size)
Allocate space for a local variable of the given size (1 or 2)
on the local variable array.
|
CodeContext.Inserter | currentInserter() |
void | fixUpAndRelocate()
fixUp() all of the offsets and relocate() all relocatables |
void | flowAnalysis(String functionName)
Checks the code for consistency; updates the "maxStack" member.
|
ClassFile | getClassFile() |
void | makeSpace(short lineNumber, int size)
Add space for size bytes at current offset. |
CodeContext.Inserter | newInserter()
Allocate an Inserter, set it to the current offset, and
insert it before the current offset.
|
CodeContext.Offset | newOffset() |
void | popInserter()
Replace the current Inserter with the remembered one (see
pushInserter). |
void | pushInserter(CodeContext.Inserter ins)
Remember the current Inserter, then replace it with the
new one. |
void | restoreLocalVariables()
Restore the previous size of the local variables array. |
void | saveLocalVariables()
Remember the current size of the local variables array. |
protected void | storeCodeAttributeBody(DataOutputStream dos, short lineNumberTableAttributeNameIndex) |
void | write(short lineNumber, byte[] b)
Inserts a sequence of bytes at the current insertion position. |
void | write(short lineNumber, byte b1)
Inserts a byte at the current insertion position. |
void | write(short lineNumber, byte b1, byte b2)
Inserts bytes at the current insertion position. |
void | write(short lineNumber, byte b1, byte b2, byte b3)
Inserts bytes at the current insertion position. |
void | write(short lineNumber, byte b1, byte b2, byte b3, byte b4)
Inserts bytes at the current insertion position. |
void | writeBranch(short lineNumber, int opcode, CodeContext.Offset dst) |
void | writeOffset(short lineNumber, CodeContext.Offset src, CodeContext.Offset dst) |
void | writeShort(short lineNumber, int v) |
Parameters: startPC endPC handlerPC catchTypeFD
Parameters: lineNumber The line number that corresponds to the byte code, or -1 size The size in bytes to inject
Parameters: dos lineNumberTableAttributeNameIndex 0 == don't generate a "LineNumberTable" attribute
Throws: IOException
Parameters: lineNumber The line number that corresponds to the byte code, or -1 b
This method is an optimization to avoid allocating small byte[] and ease GC load.
Parameters: lineNumber The line number that corresponds to the byte code, or -1 b1
This method is an optimization to avoid allocating small byte[] and ease GC load.
Parameters: lineNumber The line number that corresponds to the byte code, or -1 b1 b2
This method is an optimization to avoid allocating small byte[] and ease GC load.
Parameters: lineNumber The line number that corresponds to the byte code, or -1 b1 b2 b3
This method is an optimization to avoid allocating small byte[] and ease GC load.
Parameters: lineNumber The line number that corresponds to the byte code, or -1 b1 b2 b3 b4
Parameters: lineNumber The line number that corresponds to the byte code, or -1
Parameters: lineNumber The line number that corresponds to the byte code, or -1