|
||||||||||
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.CContext
at.dms.kjc.CBodyContext
public abstract class CBodyContext
This class represents a local context during checkBody It follows the control flow and maintain informations about variable (initialized, used, allocated), exceptions (thrown, catched) It also verify that context is still reachable There is a set of utilities method to access fields, methods and class with the name by clamping the parsing tree
Field Summary |
---|
Fields inherited from class at.dms.kjc.CContext |
---|
parent |
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 |
Constructor Summary | |
---|---|
protected |
CBodyContext()
|
protected |
CBodyContext(CBodyContext parent)
Construct a block context, it supports local variable allocation throw statement and return statement This starts a new context in a method |
protected |
CBodyContext(CBodyContext parent,
CBodyContext source)
|
protected |
CBodyContext(CMethodContext parent)
Construct a block context, it supports local variable allocation throw statement and return statement This starts a new context in a method |
Method Summary | |
---|---|
void |
addBreak(JStatement target)
|
protected void |
addBreak(JStatement target,
CBodyContext context)
|
void |
addContinue(JStatement target)
|
protected void |
addContinue(JStatement target,
CBodyContext context)
|
void |
addThrowable(CThrowableInfo throwable)
|
void |
adopt(CBodyContext source)
|
void |
adoptFieldInfos(CContext source)
|
void |
adoptFlowState(CBodyContext source)
|
void |
adoptThrowables(CBodyContext source)
|
void |
adoptVariableInfos(CBodyContext source)
|
void |
clearFlowState()
|
void |
clearThrowables()
|
CSimpleBodyContext |
cloneContext()
Returns a copy of this context. |
void |
close(TokenReference ref)
Verify everything is okay at the end of this context |
Object |
deepClone()
Returns a deep clone of this object. |
protected void |
deepCloneInto(CBodyContext other)
Clones all fields of this into |
void |
dumpContext(int level)
Dumps this context to standard error stream. |
CVariableInfo |
getFieldInfo()
Returns the field definition state. |
int |
getFieldInfo(int index)
|
JStatement |
getLabeledStatement(String label)
Returns the statement with the specified label. |
JStatement |
getNearestBreakableStatement()
Returns the innermost statement which can be target of a break statement without label. |
JStatement |
getNearestContinuableStatement()
Returns the innermost statement which can be target of a continue statement without label. |
Hashtable |
getThrowables()
|
protected CVariableInfo |
getVariableInfo()
|
int |
getVariableInfo(int index)
BUGGY CUT AND PASTE JAVADOC. |
boolean |
isBreaked()
|
boolean |
isContinued()
|
boolean |
isInLoop()
Returns true iff execution is in the body of a loop. |
boolean |
isReachable()
Returns true iff the statement is reachable. |
int |
localsPosition()
|
JExpression |
lookupOuterLocalVariable(TokenReference ref,
String ident)
lookupOuterLocalVariable |
void |
merge(CBodyContext source)
|
void |
mergeFieldInfos(CBodyContext source)
|
void |
mergeFlowState(CBodyContext source)
|
void |
mergeThrowables(CBodyContext source)
|
void |
mergeVariableInfos(CBodyContext source)
|
void |
setFieldInfo(int index,
int info)
|
void |
setInLoop(boolean inloop)
Declares execution to be in the body of a loop. |
void |
setReachable(boolean reachable)
Declares next statement to be reachable. |
void |
setVariableInfo(int index,
int info)
|
Methods inherited from class at.dms.kjc.CContext |
---|
addSourceClass, check, check, check, check, deepCloneInto, dumpContext, dumpIndent, fail, fail, getBlockContext, getClassContext, getCompilationUnitContext, getMethodContext, getParentContext, isStaticContext, lookupClass, lookupField, lookupLocalVariable, lookupMethod, reportTrouble |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CBodyContext()
protected CBodyContext(CBodyContext parent)
parent
- the parent context, it must be different
than null except if called by the top levelprotected CBodyContext(CMethodContext parent)
parent
- the parent context, it must be different
than null except if called by the top levelprotected CBodyContext(CBodyContext parent, CBodyContext source)
Method Detail |
---|
public final CSimpleBodyContext cloneContext()
public void close(TokenReference ref)
public void merge(CBodyContext source)
public void adopt(CBodyContext source)
public void adoptFlowState(CBodyContext source)
public void mergeFlowState(CBodyContext source)
public void adoptVariableInfos(CBodyContext source)
public void mergeVariableInfos(CBodyContext source)
public void adoptFieldInfos(CContext source)
public void mergeFieldInfos(CBodyContext source)
public JExpression lookupOuterLocalVariable(TokenReference ref, String ident)
ident
- the name of the variable
public void clearFlowState()
public void setInLoop(boolean inloop)
inloop
- is execution in the body of a loop ?public boolean isInLoop()
public void setReachable(boolean reachable)
reachable
- is the next statement reachable ?public boolean isReachable()
public void addBreak(JStatement target)
protected void addBreak(JStatement target, CBodyContext context)
public boolean isBreaked()
public void addContinue(JStatement target)
protected void addContinue(JStatement target, CBodyContext context)
public boolean isContinued()
public int localsPosition()
public JStatement getLabeledStatement(String label)
public JStatement getNearestBreakableStatement()
public JStatement getNearestContinuableStatement()
protected CVariableInfo getVariableInfo()
public void setVariableInfo(int index, int info)
index
- The variable position in method array of local varsinfo
- The information to add
We make it a local copy of this information and at the end of this context
we will transfer it to the parent context according to controlFlowpublic int getVariableInfo(int index)
index
- the definition of a variable
public void setFieldInfo(int index, int info)
setFieldInfo
in class CContext
index
- The field position in method array of local varsinfo
- The information to add
We make it a local copy of this information and at the end of this context
we will transfert it to the parent context according to controlFlowpublic int getFieldInfo(int index)
getFieldInfo
in class CContext
index
- the definition of a field
public CVariableInfo getFieldInfo()
getFieldInfo
in class CContext
public void clearThrowables()
public void addThrowable(CThrowableInfo throwable)
throwable
- the type of the new throwablepublic void mergeThrowables(CBodyContext source)
public void adoptThrowables(CBodyContext source)
public Hashtable getThrowables()
public void dumpContext(int level)
dumpContext
in class CContext
public Object deepClone()
deepClone
in interface DeepCloneable
deepClone
in class CContext
protected void deepCloneInto(CBodyContext other)
other
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |