public class UpperBoundTransfer extends IndexAbstractTransfer
analysis
sequentialSemantics
Constructor and Description |
---|
UpperBoundTransfer(CFAnalysis analysis) |
Modifier and Type | Method and Description |
---|---|
protected void |
refineGT(Node larger,
AnnotationMirror largerAnno,
Node smaller,
AnnotationMirror smallerAnno,
CFStore store,
TransferInput<CFValue,CFStore> in) |
protected void |
refineGTE(Node left,
AnnotationMirror leftAnno,
Node right,
AnnotationMirror rightAnno,
CFStore store,
TransferInput<CFValue,CFStore> in)
This method refines the type of the right expression to the glb the previous type of right
and the type of left.
|
protected TransferResult<CFValue,CFStore> |
strengthenAnnotationOfEqualTo(TransferResult<CFValue,CFStore> res,
Node firstNode,
Node secondNode,
CFValue firstValue,
CFValue secondValue,
boolean notEqualTo)
Refine the annotation of
secondNode if the annotation secondValue is less
precise than firstvalue . |
TransferResult<CFValue,CFStore> |
visitAssignment(AssignmentNode node,
TransferInput<CFValue,CFStore> in) |
TransferResult<CFValue,CFStore> |
visitFieldAccess(FieldAccessNode n,
TransferInput<CFValue,CFStore> in)
If n is an array length field access, then the type of a.length, is the glb
of @LTEqLengthOf("a") and the value of a.length in the store.
|
TransferResult<CFValue,CFStore> |
visitNumericalAddition(NumericalAdditionNode n,
TransferInput<CFValue,CFStore> in)
If some Node a is known to be less than the length of some array, x, then, the type of a + b,
is @LTLengthOf(value="x", offset="-b").
|
TransferResult<CFValue,CFStore> |
visitNumericalSubtraction(NumericalSubtractionNode n,
TransferInput<CFValue,CFStore> in)
If some Node a is known to be less than the length of some array x, then the type of a - b
is @LTLengthOf(value="x", offset="b").
|
visitGreaterThan, visitGreaterThanOrEqual, visitLessThan, visitLessThanOrEqual
addInformationFromPreconditions, finishValue, finishValue, getTypeFactoryOfSubchecker, getValueFromFactory, getValueWithSameAnnotations, initialStore, isNotFullyInitializedReceiver, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, processPostconditions, setFixedInitialStore, splitAssignments, usesSequentialSemantics, visitArrayAccess, visitCase, visitClassName, visitConditionalNot, visitEqualTo, visitLocalVariable, visitMethodInvocation, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConcatenateAssignment, visitStringConversion, visitTernaryExpression, visitThisLiteral, visitVariableDeclaration, visitWideningConversion
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThisLiteral, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitImplicitThisLiteral, visitInstanceOf, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift, visitValueLiteral
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThisLiteral, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitImplicitThisLiteral, visitInstanceOf, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
public UpperBoundTransfer(CFAnalysis analysis)
public TransferResult<CFValue,CFStore> visitAssignment(AssignmentNode node, TransferInput<CFValue,CFStore> in)
visitAssignment
in interface NodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
visitAssignment
in class CFAbstractTransfer<CFValue,CFStore,CFTransfer>
protected void refineGT(Node larger, AnnotationMirror largerAnno, Node smaller, AnnotationMirror smallerAnno, CFStore store, TransferInput<CFValue,CFStore> in)
refineGT
in class IndexAbstractTransfer
protected void refineGTE(Node left, AnnotationMirror leftAnno, Node right, AnnotationMirror rightAnno, CFStore store, TransferInput<CFValue,CFStore> in)
Also, if the left expression is an array access, then the types of sub expressions of the right are refined.
refineGTE
in class IndexAbstractTransfer
protected TransferResult<CFValue,CFStore> strengthenAnnotationOfEqualTo(TransferResult<CFValue,CFStore> res, Node firstNode, Node secondNode, CFValue firstValue, CFValue secondValue, boolean notEqualTo)
CFAbstractTransfer
secondNode
if the annotation secondValue
is less
precise than firstvalue
. This is possible, if secondNode
is an expression
that is tracked by the store (e.g., a local variable or a field).
Note that when overriding this method, when a new type is inserted into the store, splitAssignments should be called, and the new type should be inserted into the store for each of the resulting nodes.
strengthenAnnotationOfEqualTo
in class CFAbstractTransfer<CFValue,CFStore,CFTransfer>
res
- the previous resultnotEqualTo
- if true, indicates that the logic is flipped (i.e., the information is
added to the elseStore
instead of the thenStore
) for a not-equal
comparison.null
.public TransferResult<CFValue,CFStore> visitNumericalAddition(NumericalAdditionNode n, TransferInput<CFValue,CFStore> in)
Alternatively, if a is known to be less than the length of x when some offset, o, is added to a (the type of a is @LTLengthOf(value="x", offset="o")), then the type of a + b is @LTLengthOf(value="x",offset="o - b"). (Note, if "o - b" can be computed, then it is and the result is used in the annotation.)
In addition, If expression i has type @LTLengthOf(value = "f2", offset = "f1.length") int and expression j is less than or equal to the length of f1, then the type of i + j is .@LTLengthOf("f2").
visitNumericalAddition
in interface NodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
visitNumericalAddition
in class AbstractNodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
public TransferResult<CFValue,CFStore> visitNumericalSubtraction(NumericalSubtractionNode n, TransferInput<CFValue,CFStore> in)
visitNumericalSubtraction
in interface NodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
visitNumericalSubtraction
in class AbstractNodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
public TransferResult<CFValue,CFStore> visitFieldAccess(FieldAccessNode n, TransferInput<CFValue,CFStore> in)
visitFieldAccess
in interface NodeVisitor<TransferResult<CFValue,CFStore>,TransferInput<CFValue,CFStore>>
visitFieldAccess
in class CFAbstractTransfer<CFValue,CFStore,CFTransfer>