|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.util.Utils
at.dms.kjc.CodeSequence
public final class CodeSequence
Field Summary |
---|
Fields inherited from class at.dms.util.Utils |
---|
EMPTY_LIST, getForLoopCallers |
Fields inherited from interface at.dms.kjc.Constants |
---|
CMP_VERSION, JAV_CLASS, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_THIS, JAV_THROWABLE, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LE, OPE_LNOT, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BIT, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VECTOR, TID_VOID, VECTOR_EMPTY |
Method Summary | |
---|---|
void |
addExceptionHandler(int start,
int end,
int handler,
String thrown)
|
Object |
deepClone()
Returns a deep clone of this object. |
protected void |
deepCloneInto(CodeSequence other)
Clones all fields of this into |
static void |
endSession()
|
static CodeSequence |
getCodeSequence()
Constructs a code sequence. |
HandlerInfo[] |
getHandlers()
Returns an array of all exception handler |
Instruction[] |
getInstructionArray()
Return the instruction as a list WARNING: AFTER a call to release() this array will be reused |
Instruction |
getInstructionAt(int pc)
Returns the instruction at a given position |
LineNumberInfo[] |
getLineNumbers()
|
LocalVariableInfo[] |
getLocalVariableInfos()
|
int |
getPC()
Gets the location in code sequence |
void |
plantBreak(JStatement top)
Ask the code handler to generate the necessary code to call every finally and monitorexit |
void |
plantClassRefInstruction(int opcode,
String name)
Adds a class reference instruction to the code of the current method. |
void |
plantFieldRefInstruction(int opcode,
String owner,
String name,
String type)
Adds a field reference instruction to the code of the current method. |
void |
plantInstruction(Instruction insn)
Adds an instruction to the code of the current method. |
void |
plantJumpInstruction(int opcode,
at.dms.kjc.CodeLabel target)
Adds an jump instruction to the code of the current method. |
void |
plantLabel(at.dms.kjc.CodeLabel label)
Adds an instruction to the code of the current method. |
void |
plantLoadThis()
Adds a load of this (local var 0) to the code of the current method. |
void |
plantLocalVar(int opcode,
JLocalVariable var)
Adds a local var instruction to the code of the current method. |
void |
plantMethodRefInstruction(int opcode,
String owner,
String name,
String type)
Adds a method reference instruction to the code of the current method. |
void |
plantNewArrayInstruction(CType type)
Appends an array creation instruction to the code of the current method. |
void |
plantNoArgInstruction(int opcode)
Appends an instruction without arguments to the code of the current method. |
void |
plantPopInstruction(CType type)
Appends an instruction to the code of the current method which pops the top-most element from the stack. |
void |
plantReturn(JReturnStatement ret)
Ask the code handler to generate the necessary code to call every finally clause of all try statements |
void |
popContext(JStatement stmt)
Informs the code handlers that we exit a breakable code. |
void |
pushContext(JStatement stmt)
Informs the code handlers that we begin a portion of breakable code. |
void |
release()
Release a code sequence |
void |
setLineNumber(int lineNumber)
|
int |
size()
Returns the actual size of code (number of instruction) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CodeSequence getCodeSequence()
public void release()
public static void endSession()
public final void plantInstruction(Instruction insn)
insn
- the instruction to appendpublic final void plantNoArgInstruction(int opcode)
opcode
- the instruction opcodepublic final void plantPopInstruction(CType type)
type
- the type of the top-most elementpublic final void plantLocalVar(int opcode, JLocalVariable var)
opcode
- the instruction opcodevar
- the referenced variablepublic final void plantLoadThis()
public final void plantFieldRefInstruction(int opcode, String owner, String name, String type)
opcode
- the instruction opcodeowner
- the qualified name of the class containing the fieldname
- the simple name of the referenced fieldtype
- the signature of the referenced fieldpublic final void plantMethodRefInstruction(int opcode, String owner, String name, String type)
opcode
- the instruction opcodeowner
- the qualified name of the class containing the methodname
- the simple name of the referenced methodtype
- the signature of the referenced methodpublic final void plantClassRefInstruction(int opcode, String name)
opcode
- the instruction opcodename
- the qualified name of the referenced objectpublic final void plantJumpInstruction(int opcode, at.dms.kjc.CodeLabel target)
opcode
- the instruction opcodetarget
- the jump targetpublic final void plantNewArrayInstruction(CType type)
type
- the element typepublic final void plantLabel(at.dms.kjc.CodeLabel label)
label
- public final void setLineNumber(int lineNumber)
lineNumber
- the current line number in source codepublic final LineNumberInfo[] getLineNumbers()
public final LocalVariableInfo[] getLocalVariableInfos()
public final void plantReturn(JReturnStatement ret)
public final void plantBreak(JStatement top)
public final void pushContext(JStatement stmt)
public final void popContext(JStatement stmt)
public final void addExceptionHandler(int start, int end, int handler, String thrown)
public final HandlerInfo[] getHandlers()
public final int getPC()
public final int size()
public final Instruction getInstructionAt(int pc)
public Instruction[] getInstructionArray()
public Object deepClone()
deepClone
in interface DeepCloneable
deepClone
in class Utils
protected void deepCloneInto(CodeSequence other)
other
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |