Class ReachingDefinitionStore
- java.lang.Object
-
- org.checkerframework.dataflow.reachingdef.ReachingDefinitionStore
-
- All Implemented Interfaces:
Store<ReachingDefinitionStore>
public class ReachingDefinitionStore extends java.lang.Object implements Store<ReachingDefinitionStore>
A reaching definition store contains a set of reaching definitions represented by ReachingDefinitionNode
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.checkerframework.dataflow.analysis.Store
Store.FlowRule, Store.Kind
-
-
Constructor Summary
Constructors Constructor Description ReachingDefinitionStore()Create a new ReachDefinitionStore.ReachingDefinitionStore(java.util.Set<ReachingDefinitionNode> reachingDefSet)Create a new ReachDefinitionStore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanAlias(JavaExpression a, JavaExpression b)Can the objectsaandbbe aliases? Returns a conservative answer (i.e., returnstrueif not enough information is available to determine aliasing).ReachingDefinitionStorecopy()Returns an exact copy of this store.booleanequals(@Nullable java.lang.Object obj)Returns true if this is equal to the given argument.inthashCode()voidkillDef(Node defTarget)Remove the information of a reaching definition from the reaching definition set.ReachingDefinitionStoreleastUpperBound(ReachingDefinitionStore other)Compute the least upper bound of two stores.voidputDef(ReachingDefinitionNode def)Add a reaching definition to the reaching definition set.java.lang.StringtoString()java.lang.Stringvisualize(CFGVisualizer<?,ReachingDefinitionStore,?> viz)Delegate visualization responsibility to a visualizer.ReachingDefinitionStorewidenedUpperBound(ReachingDefinitionStore previous)Compute an upper bound of two stores that is wider than the least upper bound of the two stores.
-
-
-
Constructor Detail
-
ReachingDefinitionStore
public ReachingDefinitionStore()
Create a new ReachDefinitionStore.
-
ReachingDefinitionStore
public ReachingDefinitionStore(java.util.Set<ReachingDefinitionNode> reachingDefSet)
Create a new ReachDefinitionStore.- Parameters:
reachingDefSet- a set of reaching definition nodes. The parameter is captured and the caller should not retain an alias.
-
-
Method Detail
-
killDef
public void killDef(Node defTarget)
Remove the information of a reaching definition from the reaching definition set.- Parameters:
defTarget- target of a reaching definition
-
putDef
public void putDef(ReachingDefinitionNode def)
Add a reaching definition to the reaching definition set.- Parameters:
def- a reaching definition
-
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<ReachingDefinitionStore>- 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 ReachingDefinitionStore copy()
Description copied from interface:StoreReturns an exact copy of this store.- Specified by:
copyin interfaceStore<ReachingDefinitionStore>- Returns:
- an exact copy of this store
-
leastUpperBound
public ReachingDefinitionStore leastUpperBound(ReachingDefinitionStore 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<ReachingDefinitionStore>
- Does not change
-
widenedUpperBound
public ReachingDefinitionStore widenedUpperBound(ReachingDefinitionStore previous)
Description copied from interface:StoreCompute an upper bound of two stores that is wider than the least upper bound of the two stores. Used to jump to a higher abstraction to allow faster termination of the fixed point computations inAnalysis.previousmust be the previous store.A particular analysis might not require widening and should implement this method by calling leastUpperBound.
Important: This method must fulfill the following contract:
- Does not change
this. - Does not change
previous. - 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:
widenedUpperBoundin interfaceStore<ReachingDefinitionStore>- Parameters:
previous- must be the previous store
- Does not change
-
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<ReachingDefinitionStore>
-
visualize
public java.lang.String visualize(CFGVisualizer<?,ReachingDefinitionStore,?> viz)
Description copied from interface:StoreDelegate visualization responsibility to a visualizer.- Specified by:
visualizein interfaceStore<ReachingDefinitionStore>- 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
-
-