| java.lang.Object com.sun.tools.javac.jvm.Code
Code | public class Code (Code) | | An internal structure that corresponds to the code attribute of
methods in a classfile. The class also provides some utility operations to
generate bytecode instructions.
This is NOT part of any API supported by Sun Microsystems. If
you write code that depends on this, you do so at your own risk.
This code and its internal interfaces are subject to change or
deletion without notice.
|
Inner Class :public enum StackMapFormat | |
Inner Class :static class StackMapFrame | |
Inner Class :public static class Chain | |
Inner Class :class State implements Cloneable | |
Inner Class :static class LocalVar | |
Constructor Summary | |
public | Code(MethodSymbol meth, boolean fatcode, Position.LineMap lineMap, boolean varDebugInfo, StackMapFormat stackMap, boolean debugCode, CRTable crt, Symtab syms, Types types, Pool pool) Construct a code object, given the settings of the fatcode,
debugging info switches and the CharacterRangeTable. |
Method Summary | |
public void | addCatch(char startPc, char endPc, char handlerPc, char catchType) Add a catch clause to code. | public void | addLineNumber(char startPc, char lineNumber) Add a line number entry. | public void | align(int incr) Align code pointer to next `incr' boundary. | public static int | arraycode(Type type) Given a type, return its code for allocating arrays of that type. | public Chain | branch(int opcode) Emit a branch with given opcode; return its chain. | public boolean | checkLimits(DiagnosticPosition pos, Log log) Check the code against VM spec limits; if
problems report them and return true. | public int | curPc() The current output code pointer. | public void | emit4(int od) Emit four bytes of code. | public void | emitAnewarray(int od, Type arrayType) Emit anewarray. | void | emitCLDCStackMap(int pc, int localsSize) Emit a CLDC stack map frame. | public void | emitInvokeinterface(int meth, Type mtype) Emit an invokeinterface instruction. | public void | emitInvokespecial(int meth, Type mtype) Emit an invokespecial instruction. | public void | emitInvokestatic(int meth, Type mtype) Emit an invokestatic instruction. | public void | emitInvokevirtual(int meth, Type mtype) Emit an invokevirtual instruction. | public int | emitJump(int opcode) Emit a jump instruction. | public void | emitMultianewarray(int ndims, int type, Type arrayType) Emit a multinewarray instruction. | public void | emitNewarray(int elemcode, Type arrayType) Emit newarray. | public void | emitStackMap() Emit a stack map entry. | void | emitStackMapFrame(int pc, int localsSize) | public void | emitop0(int op) Emit an opcode with no operand field. | public void | emitop1(int op, int od) Emit an opcode with a one-byte operand field. | public void | emitop1w(int op, int od) Emit an opcode with a one-byte operand field;
widen if field does not fit in a byte. | public void | emitop1w(int op, int od1, int od2) Emit an opcode with two one-byte operand fields;
widen if either field does not fit in a byte. | public void | emitop2(int op, int od) Emit an opcode with a two-byte operand field. | public void | emitop4(int op, int od) Emit an opcode with a four-byte operand field. | public void | endScopes(int first) End scopes of all variables with registers >= first. | public int | entryPoint() | public int | entryPoint(State state) | public int | entryPoint(State state, Type pushed) | public int | get4(int pc) Return four code bytes at position pc as an int. | StackMapFrame | getInitialFrame() | public boolean | isAlive() | public void | markDead() Switch code generation on/off. | public void | markStatBegin() | public static Chain | mergeChains(Chain chain1, Chain chain2) Merge the jumps in of two chains into one. | public static String | mnem(int opcode) | public static int | negate(int opcode) Negate a branch opcode. | public int | newLocal(VarSymbol v) | public void | newRegSegment() Start a set of fresh registers. | void | postop() | public void | put4(int pc, int od) Place four bytes into code at address pc. | void | putVar(LocalVar var) Put a live variable range into the buffer to be output to the
class file. | public void | resolve(Chain chain, int target) Resolve chain to point to given target. | public void | resolve(Chain chain) Resolve chain to point to current code pointer. | public void | resolvePending() Resolve any pending jumps. | public void | setDefined(Bits newDefined) Set the current variable defined state. | public void | setDefined(int adr) Mark a register as being (possibly) defined. | public void | setUndefined(int adr) Mark a register as being undefined. | public void | statBegin(int pos) Mark beginning of statement. | public static int | truncate(int tc) Collapse type code for subtypes of int to INTcode. | public static int | typecode(Type type) Given a type, return its type code (used implicitly in the
JVM architecture). | public static int | width(int typecode) The width in bytes of objects of the type. | public static int | width(Type type) | public static int | width(List<Type> types) The total width taken up by a vector of objects. |
catchInfo | ListBuffer<char[]> catchInfo(Code) | | A buffer for expression catch data. Each enter is a vector
of four unsigned shorts.
|
code | public byte[] code(Code) | | The code buffer.
|
cp | public int cp(Code) | | the current code pointer.
|
debugCode | final public boolean debugCode(Code) | | |
fatcode | public boolean fatcode(Code) | | Are we generating code with jumps >= 32K?
|
frameBeforeLast | StackMapFrame frameBeforeLast(Code) | | The stack map frame before the last one.
|
lastFrame | StackMapFrame lastFrame(Code) | | The last stack map frame in StackMapTable.
|
lastStackMapPC | int lastStackMapPC(Code) | | The last PC at which we generated a stack map.
|
lineDebugInfo | boolean lineDebugInfo(Code) | | Switch: emit line number info.
|
lineInfo | List<char[]> lineInfo(Code) | | A buffer for line number information. Each entry is a vector
of two unsigned shorts.
|
lvar | LocalVar[] lvar(Code) | | Local variables, indexed by register.
|
max_locals | public int max_locals(Code) | | The maximum number of local variable slots.
|
max_stack | public int max_stack(Code) | | The maximum stack size.
|
meth | final MethodSymbol meth(Code) | | |
needStackMap | final public boolean needStackMap(Code) | | |
nextreg | public int nextreg(Code) | | The next available register.
|
pendingJumps | Chain pendingJumps(Code) | | A chain for jumps to be resolved before the next opcode is emitted.
We do this lazily to avoid jumps to jumps.
|
pendingStackMap | boolean pendingStackMap(Code) | | Set true when a stackMap is needed at the current PC.
|
pendingStatPos | int pendingStatPos(Code) | | The position of the currently statement, if we are at the
start of this statement, NOPOS otherwise.
We need this to emit line numbers lazily, which we need to do
because of jump-to-jump optimization.
|
pool | final Pool pool(Code) | | The constant pool of the current class.
|
stackMap | StackMapFormat stackMap(Code) | | The stack map format to be generated.
|
stackMapBuffer | StackMapFrame[] stackMapBuffer(Code) | | A buffer of cldc stack map entries.
|
stackMapBufferSize | int stackMapBufferSize(Code) | | |
stackMapTableBuffer | StackMapTableFrame[] stackMapTableBuffer(Code) | | A buffer of compressed StackMapTable entries.
|
state | State state(Code) | | The current machine state (registers and stack).
|
varBuffer | LocalVar[] varBuffer(Code) | | Previously live local variables, to be put into the variable table.
|
varBufferSize | int varBufferSize(Code) | | |
varDebugInfo | boolean varDebugInfo(Code) | | Switch: emit variable debug info.
|
Code | public Code(MethodSymbol meth, boolean fatcode, Position.LineMap lineMap, boolean varDebugInfo, StackMapFormat stackMap, boolean debugCode, CRTable crt, Symtab syms, Types types, Pool pool)(Code) | | Construct a code object, given the settings of the fatcode,
debugging info switches and the CharacterRangeTable.
|
addCatch | public void addCatch(char startPc, char endPc, char handlerPc, char catchType)(Code) | | Add a catch clause to code.
|
addLineNumber | public void addLineNumber(char startPc, char lineNumber)(Code) | | Add a line number entry.
|
align | public void align(int incr)(Code) | | Align code pointer to next `incr' boundary.
|
arraycode | public static int arraycode(Type type)(Code) | | Given a type, return its code for allocating arrays of that type.
|
branch | public Chain branch(int opcode)(Code) | | Emit a branch with given opcode; return its chain.
branch differs from jump in that jsr is treated as no-op.
|
checkLimits | public boolean checkLimits(DiagnosticPosition pos, Log log)(Code) | | Check the code against VM spec limits; if
problems report them and return true.
|
curPc | public int curPc()(Code) | | The current output code pointer.
|
emit4 | public void emit4(int od)(Code) | | Emit four bytes of code.
|
emitAnewarray | public void emitAnewarray(int od, Type arrayType)(Code) | | Emit anewarray.
|
emitCLDCStackMap | void emitCLDCStackMap(int pc, int localsSize)(Code) | | Emit a CLDC stack map frame.
|
emitInvokeinterface | public void emitInvokeinterface(int meth, Type mtype)(Code) | | Emit an invokeinterface instruction.
|
emitInvokespecial | public void emitInvokespecial(int meth, Type mtype)(Code) | | Emit an invokespecial instruction.
|
emitInvokestatic | public void emitInvokestatic(int meth, Type mtype)(Code) | | Emit an invokestatic instruction.
|
emitInvokevirtual | public void emitInvokevirtual(int meth, Type mtype)(Code) | | Emit an invokevirtual instruction.
|
emitJump | public int emitJump(int opcode)(Code) | | Emit a jump instruction.
Return code pointer of instruction to be patched.
|
emitMultianewarray | public void emitMultianewarray(int ndims, int type, Type arrayType)(Code) | | Emit a multinewarray instruction.
|
emitNewarray | public void emitNewarray(int elemcode, Type arrayType)(Code) | | Emit newarray.
|
emitStackMap | public void emitStackMap()(Code) | | Emit a stack map entry.
|
emitStackMapFrame | void emitStackMapFrame(int pc, int localsSize)(Code) | | |
emitop0 | public void emitop0(int op)(Code) | | Emit an opcode with no operand field.
|
emitop1 | public void emitop1(int op, int od)(Code) | | Emit an opcode with a one-byte operand field.
|
emitop1w | public void emitop1w(int op, int od)(Code) | | Emit an opcode with a one-byte operand field;
widen if field does not fit in a byte.
|
emitop1w | public void emitop1w(int op, int od1, int od2)(Code) | | Emit an opcode with two one-byte operand fields;
widen if either field does not fit in a byte.
|
emitop2 | public void emitop2(int op, int od)(Code) | | Emit an opcode with a two-byte operand field.
|
emitop4 | public void emitop4(int op, int od)(Code) | | Emit an opcode with a four-byte operand field.
|
endScopes | public void endScopes(int first)(Code) | | End scopes of all variables with registers >= first.
|
entryPoint | public int entryPoint()(Code) | | Declare an entry point; return current code pointer
|
entryPoint | public int entryPoint(State state)(Code) | | Declare an entry point with initial state;
return current code pointer
|
entryPoint | public int entryPoint(State state, Type pushed)(Code) | | Declare an entry point with initial state plus a pushed value;
return current code pointer
|
get4 | public int get4(int pc)(Code) | | Return four code bytes at position pc as an int.
|
getInitialFrame | StackMapFrame getInitialFrame()(Code) | | |
isAlive | public boolean isAlive()(Code) | | Is code generation currently enabled?
|
markDead | public void markDead()(Code) | | Switch code generation on/off.
|
markStatBegin | public void markStatBegin()(Code) | | Force stat begin eagerly
|
mergeChains | public static Chain mergeChains(Chain chain1, Chain chain2)(Code) | | Merge the jumps in of two chains into one.
|
mnem | public static String mnem(int opcode)(Code) | | static tables
|
negate | public static int negate(int opcode)(Code) | | Negate a branch opcode.
|
newLocal | public int newLocal(VarSymbol v)(Code) | | |
newRegSegment | public void newRegSegment()(Code) | | Start a set of fresh registers.
|
put4 | public void put4(int pc, int od)(Code) | | Place four bytes into code at address pc. Pre: pc + 4 <= cp.
|
putVar | void putVar(LocalVar var)(Code) | | Put a live variable range into the buffer to be output to the
class file.
|
resolve | public void resolve(Chain chain, int target)(Code) | | Resolve chain to point to given target.
|
resolve | public void resolve(Chain chain)(Code) | | Resolve chain to point to current code pointer.
|
resolvePending | public void resolvePending()(Code) | | Resolve any pending jumps.
|
setDefined | public void setDefined(Bits newDefined)(Code) | | Set the current variable defined state.
|
setDefined | public void setDefined(int adr)(Code) | | Mark a register as being (possibly) defined.
|
setUndefined | public void setUndefined(int adr)(Code) | | Mark a register as being undefined.
|
statBegin | public void statBegin(int pos)(Code) | | Mark beginning of statement.
|
truncate | public static int truncate(int tc)(Code) | | Collapse type code for subtypes of int to INTcode.
|
typecode | public static int typecode(Type type)(Code) | | Given a type, return its type code (used implicitly in the
JVM architecture).
|
width | public static int width(int typecode)(Code) | | The width in bytes of objects of the type.
|
width | public static int width(List<Type> types)(Code) | | The total width taken up by a vector of objects.
|
|
|