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 voidaddUseInExpression(Node expression)Add the information of live variables in an expression to the live variable set.booleancanAlias(JavaExpression a, JavaExpression b)Can the objectsaandbbe aliases? Returns a conservative answer (i.e., returnstrueif not enough information is available to determine aliasing).LiveVarStorecopy()Returns an exact copy of this store.booleanequals(@Nullable java.lang.Object obj)Returns true if this is equal to the given argument.inthashCode()voidkillLiveVar(LiveVarNode variable)Remove the information of a live variable from the live variable set.LiveVarStoreleastUpperBound(LiveVarStore other)Compute the least upper bound of two stores.voidputLiveVar(LiveVarNode variable)Add the information of a live variable into the live variable set.java.lang.StringtoString()java.lang.Stringvisualize(CFGVisualizer<?,LiveVarStore,?> viz)Delegate visualization responsibility to a visualizer.LiveVarStorewidenedUpperBound(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:StoreReturns true if this is equal to the given argument.- Specified by:
equalsin interfaceStore<LiveVarStore>- Overrides:
equalsin 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:
hashCodein classjava.lang.Object
-
copy
public LiveVarStore copy()
Description copied from interface:StoreReturns an exact copy of this store.- Specified by:
copyin interfaceStore<LiveVarStore>- Returns:
- an exact copy of this store
-
leastUpperBound
public LiveVarStore leastUpperBound(LiveVarStore other)
Description copied from interface:StoreCompute 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:
leastUpperBoundin 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:
widenedUpperBoundin interfaceStore<LiveVarStore>- Parameters:
previous- must be the previous store
-
canAlias
public boolean canAlias(JavaExpression a, JavaExpression b)
Description copied from interface:StoreCan the objectsaandbbe aliases? Returns a conservative answer (i.e., returnstrueif not enough information is available to determine aliasing).- Specified by:
canAliasin interfaceStore<LiveVarStore>
-
visualize
public java.lang.String visualize(CFGVisualizer<?,LiveVarStore,?> viz)
Description copied from interface:StoreDelegate visualization responsibility to a visualizer.- Specified by:
visualizein interfaceStore<LiveVarStore>- Parameters:
viz- the visualizer to visualize this store- Returns:
- the String representation of this store
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-