edu.cmu.cs.crystal.flow
Interface ILatticeOperations<LE>

Type Parameters:
LE - Analysis information being tracked.
All Superinterfaces:
IAbstractLatticeOperations<LE,ASTNode>
All Known Implementing Classes:
BooleanConstantLatticeOps, LatticeElementOps, LiveVariableLatticeOps, SimpleLatticeOperations, SingleObjectAliasOps, TupleLatticeOperations

public interface ILatticeOperations<LE>
extends IAbstractLatticeOperations<LE,ASTNode>

Implement this interface to provide typical lattice operations. Instances of this interface are used by Crystal flow analyses to compare and join analysis-specific information. This interface is parameterized by the type used to represent values in the lattice. Notice that there are no assumptions being made about the lattice values, which allows using existing types such as Set. Crystal encourages including analysis-specific operations into classes implementing this interfaces, but this is not required. Lattices are defined with four methods:

Since:
Crystal 3.4.0
Author:
Kevin Bierhoff

Method Summary
 boolean atLeastAsPrecise(LE info, LE reference, ASTNode node)
          Compares analysis information for precision; more precisely, determines whether the first argument is at least as precise as the second.
 LE bottom()
          Responsible for returning a lattice that represents no knowledge.
 LE copy(LE original)
          Creates a new deep copy of the given analysis information.
 LE join(LE someInfo, LE otherInfo, ASTNode node)
          Carries out a join on this lattice and another lattice.
 

Method Detail

bottom

LE bottom()
Responsible for returning a lattice that represents no knowledge.

Specified by:
bottom in interface IAbstractLatticeOperations<LE,ASTNode>
Returns:
the lattice that represents "bottom"

join

LE join(LE someInfo,
        LE otherInfo,
        ASTNode node)
Carries out a join on this lattice and another lattice. This method is called by the framework to join different flows together. For example: The lattice that follows an If statement must represent the knowledge from the true and the false paths. The join is what combines the analysis of each path together. You may modify "this" and return it, or simply create a new LE and return it.

Specified by:
join in interface IAbstractLatticeOperations<LE,ASTNode>
Parameters:
someInfo - LE to join with otherInfo.
otherInfo - The other LE to join with, do not modify.
node - ASTNode where the two paths were originally forked apart (e.g., if, while, try, switch, etc.) or null if this join occurs on a "dummy" node.
Returns:
the resulting LE that has the combined knowledge

atLeastAsPrecise

boolean atLeastAsPrecise(LE info,
                         LE reference,
                         ASTNode node)
Compares analysis information for precision; more precisely, determines whether the first argument is at least as precise as the second. This method is used by the framework to compare analysis information.

Specified by:
atLeastAsPrecise in interface IAbstractLatticeOperations<LE,ASTNode>
Parameters:
info - Analysis information to be compared against reference
reference - the other LE to compare info with.
node - ASTNode where the two paths were originally forked apart (e.g., if, while, try, switch, etc.) or null if this comparison occurs on a "dummy" node.
Returns:
true if the first argument is at least as precise as the second; false otherwise, including if the two arguments are incomparable.

copy

LE copy(LE original)
Creates a new deep copy of the given analysis information. "Deep copy" means that all mutable (changeable) objects referenced by the given LE must not be referenced by the returned LE.

Specified by:
copy in interface IAbstractLatticeOperations<LE,ASTNode>
Parameters:
original - analysis information to be copied.
Returns:
a copy of the argument that contains no references to mutable objects found in the original.