edu.cmu.cs.crystal.analysis.live
Class LiveVariableLatticeOps
java.lang.Object
edu.cmu.cs.crystal.simple.SimpleLatticeOperations<LiveVariableLE>
edu.cmu.cs.crystal.analysis.live.LiveVariableLatticeOps
- All Implemented Interfaces:
- IAbstractLatticeOperations<LiveVariableLE,ASTNode>, ILatticeOperations<LiveVariableLE>
public class LiveVariableLatticeOps
- extends SimpleLatticeOperations<LiveVariableLE>
LiveVariableLatticeOps
public LiveVariableLatticeOps()
atLeastAsPrecise
public boolean atLeastAsPrecise(LiveVariableLE left,
LiveVariableLE right)
- Description copied from class:
SimpleLatticeOperations
- Checks to see if the left side of the operand is more precise (or as precise) as the right side.
Notice that in a lattice, the bottom lattice element will be more precise than everything, and top element will be less precise
than everything. That is,
atLeastAsPrecise(bottom, x) == true
and atLeastAsPrecise(x, top) == true
.
- Specified by:
atLeastAsPrecise
in class SimpleLatticeOperations<LiveVariableLE>
- Returns:
- True if left is more precise (or the same as) right, false if right is more precise
or the two have no precision relationship.
bottom
public LiveVariableLE bottom()
- Description copied from interface:
IAbstractLatticeOperations
- Responsible for returning a lattice that represents no knowledge.
- Specified by:
bottom
in interface IAbstractLatticeOperations<LiveVariableLE,ASTNode>
- Specified by:
bottom
in interface ILatticeOperations<LiveVariableLE>
- Specified by:
bottom
in class SimpleLatticeOperations<LiveVariableLE>
- Returns:
- The lattice element which is the bottom of the lattice.
copy
public LiveVariableLE copy(LiveVariableLE original)
- Description copied from class:
SimpleLatticeOperations
- Creates a new deep copy of the given analysis information.
"Deep copy" means that all mutable (changeable)
objects referenced by the original
must not be referenced by the copy.
Notice that if your lattice is immutable (an
enum
, for example), then you
can just return this
- Specified by:
copy
in interface IAbstractLatticeOperations<LiveVariableLE,ASTNode>
- Specified by:
copy
in interface ILatticeOperations<LiveVariableLE>
- Specified by:
copy
in class SimpleLatticeOperations<LiveVariableLE>
- Parameters:
original
- analysis information to be copied.
- Returns:
- a copy of the argument that contains no references to mutable objects found in the original.
join
public LiveVariableLE join(LiveVariableLE left,
LiveVariableLE right)
- Description copied from class:
SimpleLatticeOperations
- Joins the two lattice elements into an element that is as precise as possible while still being less precise than both.
This is a symmetric relationship.
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.
Notice that:
- joining anything with bottom gives it back to you (
join(bottom, X) == X
)
- joining anything with top gives you top (
join(top, X) == top
)
- joining anything with itself gives it back to you (
join(X, X) == X
)
- the result of a join is less precise than the operands. If
join(A, B) == C
,
then atLeastAsPrecise(A, C) == true
and atLeastAsPrecise(B, C) == true
- Specified by:
join
in class SimpleLatticeOperations<LiveVariableLE>
right
- DO NOT MODIFY
- Returns:
- A lattice element which is the join of the parameters.