Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jif.extension
Class CallHelper

    java.lang.Object
      jif.extension.CallHelper

    public class CallHelper

extends java.lang.Object

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

### receiverLabel

    protected final Label receiverLabel

  Label of the reference to the object on which the procedure is being called.

### receiverExpr

    protected final polyglot.ast.Expr receiverExpr

### calleeContainer

    protected final polyglot.types.ReferenceType calleeContainer

### actualArgs

    protected final java.util.List actualArgs

  Copy of the list of the `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.

### pi

    protected final JifProcedureInstance pi

  The procedure being called. Also the MethodInstance of the overridden method, when this class is used for overriding checking.

### position

    protected final polyglot.util.Position position

  The position of the procedure call

### actualArgLabels

    protected java.util.List actualArgLabels

  Labels of the actual arguments.

### actualParamLabels

    protected java.util.List actualParamLabels

  Labels of the actual parameters.

### X

    protected PathMap X

  The PathMap for the procedure call.

### returnType

    protected polyglot.types.Type returnType

  The return type of the procedure, if there is one.

### callChecked

    protected boolean callChecked

### overrideChecker

    protected final boolean overrideChecker

Constructor Detail

### CallHelper

    public CallHelper(Label receiverLabel,
                      polyglot.ast.Receiver receiver,
                      polyglot.types.ReferenceType calleeContainer,
                      JifProcedureInstance pi,
                      java.util.List actualArgs,
                      polyglot.util.Position position)

### CallHelper

    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

### shouldReport

    protected static boolean shouldReport(int obscurity)

### report

    protected static void report(int obscurity,
                                 java.lang.String s)

### OverrideHelper

    public static CallHelper OverrideHelper(JifMethodInstance overridden,
                                            JifMethodInstance overriding,
                                            LabelChecker lc)

### returnType

    public polyglot.types.Type returnType()

### labelCheckedArgs

    public java.util.List labelCheckedArgs()

### X

    public PathMap X()

### labelCheckAndConstrainParams

    protected PathMap labelCheckAndConstrainParams(LabelChecker lc,
                                                   java.util.List throwTypes)
                                            throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### labelCheckAndConstrainArgs

    protected PathMap labelCheckAndConstrainArgs(LabelChecker lc,
                                                 PathMap Xjoin)
                                          throws polyglot.types.SemanticException

  Label check the arguments. Also initializes the array `argLabels`, that is the labels of the actual arguments.

  Parameters:
    `Xjoin` - The pathmap for the call so far, that is, up to the point just before the evaluation of the actual arguments.
  Returns:
    The PathMap for the evaluation of all actual arguments, that is, join_j xj, for all actual arguments xj.
  Throws:
    `polyglot.types.SemanticException`

### constrainArg

    protected void constrainArg(LabelChecker lc,
                                int index,
                                polyglot.ast.Expr Ej,
                                polyglot.types.Type formalType)
                         throws polyglot.types.SemanticException

  Add constraints to ensure that the labels of the actual arguments are less than the upper bounds of the formal arguments.

  Parameters:
    `index` - the ith arg
    `Ej` - the expression of the ith actual arg
    `formalType` - the type of ith formal arg.
  Throws:
    `polyglot.types.SemanticException`

### constrainFinalActualArgs

    protected void constrainFinalActualArgs(JifTypeSystem jts)
                                     throws polyglot.types.SemanticException

  Make sure that the actual arg for any formal arg that appears in the signature is final.

  Throws:
    `polyglot.types.SemanticException`

### resolvePCBound

    protected Label resolvePCBound(LabelChecker lc)
                            throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### resolveReturnLabel

    protected Label resolveReturnLabel(LabelChecker lc)
                                throws polyglot.types.SemanticException

  Returns the instantiated return label.

  Throws:
    `polyglot.types.SemanticException`

### resolveReturnValueLabel

    protected Label resolveReturnValueLabel(LabelChecker lc,
                                            Label returnLabel)
                                     throws polyglot.types.SemanticException

  Returns the instantiated return value label joined with returnLabel.

  Throws:
    `polyglot.types.SemanticException`

### excPathMap

    protected PathMap excPathMap(LabelChecker lc,
                                 Label returnLabel,
                                 Label pcPriorToInvoke,
                                 java.util.List throwTypes)
                          throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### checkCall

    public void checkCall(LabelChecker lc,
                          java.util.List throwTypes,
                          boolean targetMayBeNull)
                   throws polyglot.types.SemanticException

  Check method calls. (Thesis, Figure 4.29)

  Throws:
    `polyglot.types.SemanticException`

### satisfiesConstraints

    protected void satisfiesConstraints(JifProcedureInstance jpi,
                                        LabelChecker lc)
                                 throws polyglot.types.SemanticException

  Check if the caller has sufficient authority, and label constraints are satisfied Thesis, Figure 4.29

  Throws:
    `polyglot.types.SemanticException`

### bindVarLabels

    public void bindVarLabels(LabelChecker lc,
                              VarLabel receiverVarLabel,
                              java.util.List actualArgVarLabels,
                              java.util.List actualParamVarLabels)
                       throws polyglot.types.SemanticException

  Bind the given var labels to the appropriate labels that have been calculated during the call checking.

  Parameters:
    `lc` - the LabelChecker
    `receiverVarLabel` - the VarLabel used to stand in for the label of the receiver
    `actualArgVarLabels` - a list of VarLabels that were used to stand in for the labels of the actual arguments
    `actualParamVarLabels` - a list of VarLabels that were used to stand in for the labels of the actual parameters
  Throws:
    `polyglot.types.SemanticException`

### getArgLabelsFromFormalTypes

    protected static java.util.List getArgLabelsFromFormalTypes(java.util.List formalTypes,
                                                                JifTypeSystem jts,
                                                                polyglot.util.Position pos)
                                                         throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### instantiate

    public Label instantiate(JifContext A,
                             Label L)
                      throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### instantiate

    public Principal instantiate(JifContext A,
                                 Principal p)
                          throws polyglot.types.SemanticException

  replaces any signature ArgLabels in p with the appropriate label, and replaces any signature ArgPrincipal with the appropriate prinicipal.

  Throws:
    `polyglot.types.SemanticException`

### instantiate

    public polyglot.types.Type instantiate(JifContext A,
                                           polyglot.types.Type t)
                                    throws polyglot.types.SemanticException

  Throws:
    `polyglot.types.SemanticException`

### checkOverride

    public void checkOverride(LabelChecker lc)
                       throws polyglot.types.SemanticException

  this.pi is a Jif method instance that this.overridingMethod is attempting to override. Previous type checks have made sure that things like abstractness, access flags, throw sets, etc. are ok. We need to check that the labels conform.

  Throws:
    `polyglot.types.SemanticException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD