|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jif.extension.CallHelper
public class CallHelper
This is a tool to label check method calls. This class should be used by
creating an instance of it, and then calling the method
checkCall(LabelChecker)
. After the
call to that method, the remaining methods (which are getter methods) may be
called.
Field Summary | |
---|---|
protected java.util.List |
actualArgLabels
Labels of the actual arguments. |
protected java.util.List |
actualArgs
Copy of the list of the Expr s that are the arguments to
the procedure call. |
protected java.util.List |
actualParamLabels
Labels of the actual parameters. |
protected boolean |
callChecked
|
protected polyglot.types.ReferenceType |
calleeContainer
|
protected boolean |
overrideChecker
|
protected JifProcedureInstance |
pi
The procedure being called. |
protected polyglot.util.Position |
position
The position of the procedure call |
protected polyglot.ast.Expr |
receiverExpr
|
protected Label |
receiverLabel
Label of the reference to the object on which the procedure is being called. |
protected polyglot.types.Type |
returnType
The return type of the procedure, if there is one. |
protected PathMap |
X
The PathMap for the procedure call. |
Constructor Summary | |
---|---|
|
CallHelper(Label receiverLabel,
polyglot.ast.Receiver receiver,
polyglot.types.ReferenceType calleeContainer,
JifProcedureInstance pi,
java.util.List actualArgs,
polyglot.util.Position position)
|
protected |
CallHelper(Label receiverLabel,
polyglot.ast.Receiver receiver,
polyglot.types.ReferenceType calleeContainer,
JifProcedureInstance pi,
java.util.List actualArgs,
polyglot.util.Position position,
boolean overrideChecker)
|
Method Summary | |
---|---|
void |
bindVarLabels(LabelChecker lc,
VarLabel receiverVarLabel,
java.util.List actualArgVarLabels,
java.util.List actualParamVarLabels)
Bind the given var labels to the appropriate labels that have been calculated during the call checking. |
void |
checkCall(LabelChecker lc,
java.util.List throwTypes,
boolean targetMayBeNull)
Check method calls. |
void |
checkOverride(LabelChecker lc)
this.pi is a Jif method instance that this.overridingMethod is attempting to override. |
protected void |
constrainArg(LabelChecker lc,
int index,
polyglot.ast.Expr Ej,
polyglot.types.Type formalType)
Add constraints to ensure that the labels of the actual arguments are less than the upper bounds of the formal arguments. |
protected void |
constrainFinalActualArgs(JifTypeSystem jts)
Make sure that the actual arg for any formal arg that appears in the signature is final. |
protected PathMap |
excPathMap(LabelChecker lc,
Label returnLabel,
Label pcPriorToInvoke,
java.util.List throwTypes)
|
protected static java.util.List |
getArgLabelsFromFormalTypes(java.util.List formalTypes,
JifTypeSystem jts,
polyglot.util.Position pos)
|
Label |
instantiate(JifContext A,
Label L)
|
Principal |
instantiate(JifContext A,
Principal p)
replaces any signature ArgLabels in p with the appropriate label, and replaces any signature ArgPrincipal with the appropriate prinicipal. |
polyglot.types.Type |
instantiate(JifContext A,
polyglot.types.Type t)
|
protected PathMap |
labelCheckAndConstrainArgs(LabelChecker lc,
PathMap Xjoin)
Label check the arguments. |
protected PathMap |
labelCheckAndConstrainParams(LabelChecker lc,
java.util.List throwTypes)
|
java.util.List |
labelCheckedArgs()
|
static CallHelper |
OverrideHelper(JifMethodInstance overridden,
JifMethodInstance overriding,
LabelChecker lc)
|
protected static void |
report(int obscurity,
java.lang.String s)
|
protected Label |
resolvePCBound(LabelChecker lc)
|
protected Label |
resolveReturnLabel(LabelChecker lc)
Returns the instantiated return label. |
protected Label |
resolveReturnValueLabel(LabelChecker lc,
Label returnLabel)
Returns the instantiated return value label joined with returnLabel. |
polyglot.types.Type |
returnType()
|
protected void |
satisfiesConstraints(JifProcedureInstance jpi,
LabelChecker lc)
Check if the caller has sufficient authority, and label constraints are satisfied Thesis, Figure 4.29 |
protected static boolean |
shouldReport(int obscurity)
|
PathMap |
X()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Label receiverLabel
protected final polyglot.ast.Expr receiverExpr
protected final polyglot.types.ReferenceType calleeContainer
protected final java.util.List actualArgs
Expr
s that are the arguments to
the procedure call. As we label check the argument expressions, we
replace the elements of this list with the label checked versions of the
argument expressions.
protected final JifProcedureInstance pi
protected final polyglot.util.Position position
protected java.util.List actualArgLabels
protected java.util.List actualParamLabels
protected PathMap X
protected polyglot.types.Type returnType
protected boolean callChecked
protected final boolean overrideChecker
Constructor Detail |
---|
public CallHelper(Label receiverLabel, polyglot.ast.Receiver receiver, polyglot.types.ReferenceType calleeContainer, JifProcedureInstance pi, java.util.List actualArgs, polyglot.util.Position position)
protected CallHelper(Label receiverLabel, polyglot.ast.Receiver receiver, polyglot.types.ReferenceType calleeContainer, JifProcedureInstance pi, java.util.List actualArgs, polyglot.util.Position position, boolean overrideChecker)
Method Detail |
---|
protected static boolean shouldReport(int obscurity)
protected static void report(int obscurity, java.lang.String s)
public static CallHelper OverrideHelper(JifMethodInstance overridden, JifMethodInstance overriding, LabelChecker lc)
public polyglot.types.Type returnType()
public java.util.List labelCheckedArgs()
public PathMap X()
protected PathMap labelCheckAndConstrainParams(LabelChecker lc, java.util.List throwTypes) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected PathMap labelCheckAndConstrainArgs(LabelChecker lc, PathMap Xjoin) throws polyglot.types.SemanticException
argLabels
, that is the labels of the actual arguments.
Xjoin
- The pathmap for the call so far, that is, up to the point
just before the evaluation of the actual arguments.
polyglot.types.SemanticException
protected void constrainArg(LabelChecker lc, int index, polyglot.ast.Expr Ej, polyglot.types.Type formalType) throws polyglot.types.SemanticException
index
- the ith argEj
- the expression of the ith actual argformalType
- the type of ith formal arg.
polyglot.types.SemanticException
protected void constrainFinalActualArgs(JifTypeSystem jts) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected Label resolvePCBound(LabelChecker lc) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected Label resolveReturnLabel(LabelChecker lc) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected Label resolveReturnValueLabel(LabelChecker lc, Label returnLabel) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected PathMap excPathMap(LabelChecker lc, Label returnLabel, Label pcPriorToInvoke, java.util.List throwTypes) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public void checkCall(LabelChecker lc, java.util.List throwTypes, boolean targetMayBeNull) throws polyglot.types.SemanticException
polyglot.types.SemanticException
protected void satisfiesConstraints(JifProcedureInstance jpi, LabelChecker lc) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public void bindVarLabels(LabelChecker lc, VarLabel receiverVarLabel, java.util.List actualArgVarLabels, java.util.List actualParamVarLabels) throws polyglot.types.SemanticException
lc
- the LabelCheckerreceiverVarLabel
- the VarLabel used to stand in for the label of
the receiveractualArgVarLabels
- a list of VarLabels that were used to stand in
for the labels of the actual argumentsactualParamVarLabels
- a list of VarLabels that were used to stand
in for the labels of the actual parameters
polyglot.types.SemanticException
protected static java.util.List getArgLabelsFromFormalTypes(java.util.List formalTypes, JifTypeSystem jts, polyglot.util.Position pos) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public Label instantiate(JifContext A, Label L) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public Principal instantiate(JifContext A, Principal p) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public polyglot.types.Type instantiate(JifContext A, polyglot.types.Type t) throws polyglot.types.SemanticException
polyglot.types.SemanticException
public void checkOverride(LabelChecker lc) throws polyglot.types.SemanticException
polyglot.types.SemanticException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |