Field Summary |
|
final static int | FIXUP_CASE The offset contains a label relative to the previous FIXUP_SWITCH. |
final static int | FIXUP_CATCH Second half of a FIXUP_TRY/FIXUP_CATCH pair.
The label is the ed of the try clause;
the current offset is the exception type as a constant pool index. |
final static int | FIXUP_DEFINE The definition of a label. |
final static int | FIXUP_DELETE3 The offsets points to 3 bytes that should be deleted. |
final static int | FIXUP_GOTO The offset points to a goto instruction.
This case up to FIXUP_TRANSFER2 must be contiguous
- see the jump-to-jump optimization in processFixups. |
final static int | FIXUP_JSR The offset points to a jsr instruction. |
final static int | FIXUP_LINE_NUMBER With preceding FIXUP_LINE_PC associates an offset with a line number.
The fixup_offset is the line number; the fixup_label is null. |
final static int | FIXUP_LINE_PC With following FIXUP_LINE_NUMBER associates an offset with a line number.
The fixup_offset is the code location; the fixup_label is null. |
final static int | FIXUP_MOVE The following instructions are moved to later in the code stream.
Instead the instructions starting at the fixup label are patched here.
(If the fixup label is null, we're done.)
This allows re-arranging code to avoid unneeded gotos.
The following instruction is the target of a later FIXUP_MOVE,
and we'll insert then when we get to it. |
final static int | FIXUP_MOVE_TO_END The following instructions are moved to the end of the code stream.
Same as FIXUP_MOVE, but there is no explicit later FIXUP_MOVE that
refers to the following instructions. |
final static int | FIXUP_NONE Not a fixup - a no-op. |
final static int | FIXUP_SWITCH The offset points to a tableswitch/lookupswitch - handle padding. |
final static int | FIXUP_TRANSFER The offset points to a conditional transfer (if_xxx) instruction. |
final static int | FIXUP_TRANSFER2 A FIXUP_GOTO_, FIXUP_JSR, or FIXUP_TRANSFER that uses a 2-byte offset. |
final static int | FIXUP_TRY FIXUP_TRY with the following FIXUP_CATCH marks an exception handler.
The label is the start of the try clause;
the current offset marks the exception handler. |
int | PC Current active length of code array.
Note that processFixups may expand/contract the code array. |
int | SP |
Attribute | attributes |
byte[] | code |
short[] | exception_table |
int | exception_table_length |
int | fixup_count |
Label[] | fixup_labels |
int[] | fixup_offsets |
IfState | if_stack The stack of currently active conditionals. |
public static boolean | instructionLineMode If true we get a line number entry for each instruction.
Normally false, but can be a convenient hack to allow instruction-level
stepping/debugging and stacktraces. |
LineNumbersAttr | lines |
public LocalVarsAttr | locals |
SourceDebugExtAttr | sourceDbgExt |
Type[] | stack_types |
TryState | try_stack The stack of currently active try statements. |
Method Summary |
|
public void | addHandler(int start_pc, int end_pc, int handler_pc, int catch_type) Add an exception handler. |
public void | addHandler(Label start_try, Label end_try, ClassType catch_type) Add an exception handler. |
public Variable | addLocal(Type type) Add a new local variable (in the current scope).
Parameters: type - type of the new Variable. |
public Variable | addLocal(Type type, String name) Add a new local variable (in the current scope).
Parameters: type - type of the new Variable. Parameters: name - name of the new Variable. |
public void | addParamLocals() Call addLocal for parameters (as implied by method type). |
public void | assignConstants(ClassType cl) |
public int | beginFragment(Label start, Label after) |
final public static String | calculateSplit(String str) Calculate how many CONSTANT_String constants we need for a string. |
public static boolean | castNeeded(Type top, Type required) |
public void | disAssemble(ClassTypeWriter dst, int start, int limit) |
public void | doPendingFinalizers(TryState limit) Call pending finalizer functions. |
final public void | emitAdd(char sig) |
final public void | emitAdd(PrimType type) |
final public void | emitAdd() |
final public void | emitAnd() |
final public void | emitArrayLength() |
public void | emitArrayLoad(Type element_type) Load an element from an array. |
public void | emitArrayStore(Type element_type) Store into an element of an array. |
public void | emitCatchEnd() |
public void | emitCatchStart(Variable var) |
public void | emitCheckcast(Type type) |
final public void | emitConvert(Type from, Type to) |
final public void | emitDiv() |
public void | emitDup() Emit code to duplicate the top element of the stack. |
public void | emitDup(int size, int offset) Compile code to duplicate with offset. |
public void | emitDup(int size) Compile code to duplicate the top 1 or 2 words. |
public void | emitDup(Type type) |
public void | emitDupX() Emit code to duplicate the top element of the stack
and place the copy before the previous element. |
final public void | emitElse() Compile start of else clause. |
final public void | emitFi() Compile end of conditional. |
public void | emitFinallyEnd() |
public void | emitFinallyStart() |
final public void | emitGetField(Field field) Compile code to get a non-static field value. |
final public void | emitGetStatic(Field field) Compile code to get a static field value.
Stack: ... |
final public void | emitGoto(Label label) Compile an unconditional branch (goto). |
final public void | emitGotoIfCompare1(Label label, int opcode) |
final public void | emitGotoIfCompare2(Label label, int logop) |
final public void | emitGotoIfEq(Label label, boolean invert) |
final public void | emitGotoIfEq(Label label) Compile a conditional transfer if 2 top stack elements are equal. |
final public void | emitGotoIfGe(Label label) |
final public void | emitGotoIfGt(Label label) |
final public void | emitGotoIfIntEqZero(Label label) |
final public void | emitGotoIfIntGeZero(Label label) |
final public void | emitGotoIfIntGtZero(Label label) |
final public void | emitGotoIfIntLeZero(Label label) |
final public void | emitGotoIfIntLtZero(Label label) |
final public void | emitGotoIfIntNeZero(Label label) |
final public void | emitGotoIfLe(Label label) |
final public void | emitGotoIfLt(Label label) |
final public void | emitGotoIfNE(Label label) Compile conditional transfer if 2 top stack elements are not equal. |
final public void | emitIOr() |
final public void | emitIfCompare1(int opcode) Compile start of a conditional:
if (!(x opcode 0)) ....
The value of x must already have been pushed. |
final public void | emitIfEq() Compile start of a conditional: if (x == y) ...
The values of x and y must already have been pushed. |
final public void | emitIfGe() Compile start of a conditional: if (x >= y) ...
The values of x and y must already have been pushed. |
final public void | emitIfGt() Compile start of a conditional: if (x > y) ...
The values of x and y must already have been pushed. |
final public void | emitIfIntCompare(int opcode) Compile start of a conditional: if (!(x OPCODE y)) ...
The value of x and y must already have been pushed. |
final public void | emitIfIntEqZero() Compile start of conditional: if (x == 0) ....
Also use this if you have pushed a boolean value: if (!b) ... |
final public void | emitIfIntLEqZero() Compile start of conditional: if (x <= 0). |
final public void | emitIfIntLt() |
final public void | emitIfIntNotZero() Compile start of conditional: if (x != 0) ....
Also use this if you have pushed a boolean value: if (b) ... |
final public void | emitIfLe() Compile start of a conditional: if (x <= y) ...
The values of x and y must already have been pushed. |
final public void | emitIfLt() Compile start of a conditional: if (x < y) ...
The values of x and y must already have been pushed. |
final public void | emitIfNEq() Compile start of a conditional: if (x != y) ...
The values of x and y must already have been pushed. |
final public void | emitIfNotNull() |
final public void | emitIfNull() |
final public void | emitIfRefCompare1(int opcode) Compile start of a conditional: if (!(x opcode null)) ....
The value of x must already have been pushed and must be of
reference type. |
final public void | emitIfThen() |
public void | emitInc(Variable var, short inc) |
public void | emitInstanceof(Type type) |
public void | emitInvoke(Method method) |
public void | emitInvokeInterface(Method method) |
public void | emitInvokeMethod(Method method, int opcode) |
public void | emitInvokeSpecial(Method method) |
public void | emitInvokeStatic(Method method) Compile a static method call. |
public void | emitInvokeVirtual(Method method) Compile a virtual method call. |
final public void | emitJsr(Label label) |
final public void | emitLoad(Variable var) Compile code to push the contents of a local variable onto the statck. |
void | emitMaybeWide(int opcode, int index) |
final public void | emitMonitorEnter() |
final public void | emitMonitorExit() |
final public void | emitMul() |
public void | emitNew(ClassType type) Invoke new on a class type. |
void | emitNewArray(int type_code) |
public void | emitNewArray(Type element_type, int dims) Compile code to allocate a new array. |
public void | emitNewArray(Type element_type) |
final public void | emitNot(Type type) |
public void | emitPop(int nvalues) Compile code to pop values off the stack (and ignore them). |
public void | emitPrimop(int opcode, int arg_count, Type retType) |
final public void | emitPushClass(String name) Push a class constant pool entry.
This is only supported by JDK 1.5 and later. |
final public void | emitPushConstant(int val, Type type) |
final public void | emitPushConstant(CpoolEntry cnst) |
public void | emitPushDouble(double x) |
public void | emitPushFloat(float x) |
final public void | emitPushInt(int i) |
public void | emitPushLong(long i) |
public void | emitPushNull() |
final public void | emitPushPrimArray(Object value, ArrayType arrayType) Emit code to push a constant primitive array. |
final public void | emitPushString(String str) Emit code to push the value of a constant String. |
final public void | emitPushThis() |
final public void | emitPutField(Field field) Compile code to put a non-static field value.
Stack: ..., objectref, value => ... |
final public void | emitPutStatic(Field field) Compile code to put a static field value.
Stack: ..., value => ... |
final public void | emitRem() |
public void | emitRet(Variable var) Emit a 'ret' instruction. |
final public void | emitReturn() Compile a method return. |
final public void | emitShl() |
final public void | emitShr() |
public void | emitStore(Variable var) |
final public void | emitSub(char sig) |
final public void | emitSub(PrimType type) |
final public void | emitSub() |
public void | emitSwap() |
public void | emitTailCall(boolean pop_args, Scope scope) Compile a tail-call to position 0 of the current procedure.
Parameters: pop_args - if true, copy argument registers (except this) from stack. Parameters: scope - Scope whose start we jump back to. |
final public void | emitThen() |
final public void | emitThrow() |
final void | emitTransfer(Label label, int opcode) |
public void | emitTryCatchEnd() |
public void | emitTryEnd() |
public void | emitTryStart(boolean has_finally, Type result_type) |
final public void | emitUshr() |
public void | emitWithCleanupCatch(Variable catchVar) Called after a body that has a cleanup clause. |
public void | emitWithCleanupDone() Called after generating a cleanup handler. |
public void | emitWithCleanupStart() Beginning of code that has a cleanup handler.
This is similar to a try-finally, but the cleanup is only
done in the case of an exception. |
final public void | emitXOr() |
public void | endFragment(int cookie) End a fragment. |
public void | enterScope(Scope scope) |
final public void | fixupAdd(int kind, Label label) Add a fixup at this location.
Parameters: kind - one of the FIXUP_xxx codes. Parameters: label - varies - typically the target of jump. |
final void | fixupAdd(int kind, int offset, Label label) |
final public void | fixupChain(Label here, Label target) This causes a later processFixup to rearrange the code.
The code at target comes here, instead of the following instructions.
Fuctionally equivalent to: goto target; here: ,
but implemented by code re-arranging. |
public Variable | getArg(int index) Get the index'th parameter. |
final public Attribute | getAttributes() |
public byte[] | getCode() Get the code (instruction bytes) of this method.
Does not make a copy. |
public int | getCodeLength() Set the current lengthof the code (instruction bytes) of this method. |
final public ConstantPool | getConstants() |
public Scope | getCurrentScope() |
final public TryState | getCurrentTry() |
public Label | getLabel() Get a new Label for the current location. |
final public int | getLength() |
public int | getMaxLocals() Get the maximum number of local variable words in this method. |
public int | getMaxStack() Get the maximum number of words on the operand stack in this method. |
final public Method | getMethod() |
final public int | getPC() |
final public int | getSP() |
byte | invert_opcode(byte opcode) Get opcode that implements NOT (x OPCODE y). |
final public boolean | isInTry() |
public Variable | lookup(String name) |
public Scope | popScope() |
final public Type | popType() |
public void | print(ClassTypeWriter dst) |
public void | processFixups() |
public Scope | pushScope() |
final public void | pushType(Type type) |
final public void | put1(int i) Write an 8-bit byte to the current code-stream. |
final public void | put2(int i) |
final public void | put4(int i) |
final public void | putIndex2(CpoolEntry cnst) |
final public void | putLineNumber(String filename, int linenumber) |
final public void | putLineNumber(int linenumber) |
final public boolean | reachableHere() True if control could reach here. |
final public void | reserve(int bytes) |
public void | restoreStackTypeState(Type[] save) Restore a type state as saved by saveStackTypeState. |
public Type[] | saveStackTypeState(boolean clear) Return an object encapsulating the type state of the JVM stack. |
final public void | setAttributes(Attribute attributes) |
public void | setCode(byte[] code) Set the code (instruction bytes) of this method.
Parameters: code - the code bytes (which are not copied).Implicitly calls setCodeLength(code.length). |
public void | setCodeLength(int len) Set the length the the code (instruction bytes) of this method. |
public void | setMaxLocals(int n) Set the maximum number of local variable words in this method. |
public void | setMaxStack(int n) Set the maximum number of words on the operand stack in this method. |
final public void | setReachable(boolean val) |
final public void | setUnreachable() |
final public Type | topType() |
public void | write(DataOutputStream dstr) |