Class LiveVarStore
- java.lang.Object
-
- org.checkerframework.dataflow.livevariable.LiveVarStore
-
- All Implemented Interfaces:
Store<LiveVarStore>
public class LiveVarStore extends java.lang.Object implements Store<LiveVarStore>
A live variable store contains a set of live variables represented by nodes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.checkerframework.dataflow.analysis.Store
Store.FlowRule, Store.Kind
-
-
Constructor Summary
Constructors Constructor Description LiveVarStore()
Create a new LiveVarStore.LiveVarStore(java.util.Set<LiveVarNode> liveVarNodeSet)
Create a new LiveVarStore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUseInExpression(Node expression)
Add the information of live variables in an expression to the live variable set.boolean
canAlias(JavaExpression a, JavaExpression b)
Can the objectsa
andb
be aliases? Returns a conservative answer (i.e., returnstrue
if not enough information is available to determine aliasing).LiveVarStore
copy()
Returns an exact copy of this store.boolean
equals(@Nullable java.lang.Object obj)
Returns true if this is equal to the given argument.int
hashCode()
void
killLiveVar(LiveVarNode variable)
Remove the information of a live variable from the live variable set.LiveVarStore
leastUpperBound(LiveVarStore other)
Compute the least upper bound of two stores.void
putLiveVar(LiveVarNode variable)
Add the information of a live variable into the live variable set.java.lang.String
toString()
java.lang.String
visualize(CFGVisualizer<?,LiveVarStore,?> viz)
Delegate visualization responsibility to a visualizer.LiveVarStore
widenedUpperBound(LiveVarStore previous)
It should not be called since it is not used by the backward analysis.
-
-
-
Constructor Detail
-
LiveVarStore
public LiveVarStore()
Create a new LiveVarStore.
-
LiveVarStore
public LiveVarStore(java.util.Set<LiveVarNode> liveVarNodeSet)
Create a new LiveVarStore.- Parameters:
liveVarNodeSet
- the set of live variable nodes. The parameter is captured and the caller should not retain an alias.
-
-
Method Detail
-
putLiveVar
public void putLiveVar(LiveVarNode variable)
Add the information of a live variable into the live variable set.- Parameters:
variable
- a live variable
-
killLiveVar
public void killLiveVar(LiveVarNode variable)
Remove the information of a live variable from the live variable set.- Parameters:
variable
- a live variable
-
addUseInExpression
public void addUseInExpression(Node expression)
Add the information of live variables in an expression to the live variable set.- Parameters:
expression
- a node
-
equals
public boolean equals(@Nullable java.lang.Object obj)
Description copied from interface:Store
Returns true if this is equal to the given argument.- Specified by:
equals
in interfaceStore<LiveVarStore>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare against this- Returns:
- true if this is equal to the given argument
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
copy
public LiveVarStore copy()
Description copied from interface:Store
Returns an exact copy of this store.- Specified by:
copy
in interfaceStore<LiveVarStore>
- Returns:
- an exact copy of this store
-
leastUpperBound
public LiveVarStore leastUpperBound(LiveVarStore other)
Description copied from interface:Store
Compute the least upper bound of two stores.Important: This method must fulfill the following contract:
- Does not change
this
. - Does not change
other
. - Returns a fresh object which is not aliased yet.
- Returns an object of the same (dynamic) type as
this
, even if the signature is more permissive. - Is commutative.
- Specified by:
leastUpperBound
in interfaceStore<LiveVarStore>
- Does not change
-
widenedUpperBound
public LiveVarStore widenedUpperBound(LiveVarStore previous)
It should not be called since it is not used by the backward analysis.- Specified by:
widenedUpperBound
in interfaceStore<LiveVarStore>
- Parameters:
previous
- must be the previous store
-
canAlias
public boolean canAlias(JavaExpression a, JavaExpression b)
Description copied from interface:Store
Can the objectsa
andb
be aliases? Returns a conservative answer (i.e., returnstrue
if not enough information is available to determine aliasing).- Specified by:
canAlias
in interfaceStore<LiveVarStore>
-
visualize
public java.lang.String visualize(CFGVisualizer<?,LiveVarStore,?> viz)
Description copied from interface:Store
Delegate visualization responsibility to a visualizer.- Specified by:
visualize
in interfaceStore<LiveVarStore>
- Parameters:
viz
- the visualizer to visualize this store- Returns:
- the String representation of this store
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-