Class ConstantPropagationStore
- java.lang.Object
-
- org.checkerframework.dataflow.constantpropagation.ConstantPropagationStore
-
- All Implemented Interfaces:
Store<ConstantPropagationStore>
public class ConstantPropagationStore extends java.lang.Object implements Store<ConstantPropagationStore>
A store that records information about constant values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.checkerframework.dataflow.analysis.Store
Store.FlowRule, Store.Kind
-
-
Constructor Summary
Constructors Modifier Constructor Description ConstantPropagationStore()
Creates a new ConstantPropagationStore.protected
ConstantPropagationStore(java.util.Map<Node,Constant> contents)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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).ConstantPropagationStore
copy()
Returns an exact copy of this store.boolean
equals(@Nullable java.lang.Object o)
Returns true if this is equal to the given argument.Constant
getInformation(Node n)
int
hashCode()
ConstantPropagationStore
leastUpperBound(ConstantPropagationStore other)
Compute the least upper bound of two stores.void
mergeInformation(Node n, Constant val)
void
setInformation(Node n, Constant val)
java.lang.String
toString()
java.lang.String
visualize(CFGVisualizer<?,ConstantPropagationStore,?> viz)
Delegate visualization responsibility to a visualizer.ConstantPropagationStore
widenedUpperBound(ConstantPropagationStore previous)
Compute an upper bound of two stores that is wider than the least upper bound of the two stores.
-
-
-
Method Detail
-
copy
public ConstantPropagationStore copy()
Description copied from interface:Store
Returns an exact copy of this store.- Specified by:
copy
in interfaceStore<ConstantPropagationStore>
- Returns:
- an exact copy of this store
-
leastUpperBound
public ConstantPropagationStore leastUpperBound(ConstantPropagationStore 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<ConstantPropagationStore>
- Does not change
-
widenedUpperBound
public ConstantPropagationStore widenedUpperBound(ConstantPropagationStore previous)
Description copied from interface:Store
Compute 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
.previous
must 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:
widenedUpperBound
in interfaceStore<ConstantPropagationStore>
- Parameters:
previous
- must be the previous store
- Does not change
-
equals
public boolean equals(@Nullable java.lang.Object o)
Description copied from interface:Store
Returns true if this is equal to the given argument.- Specified by:
equals
in interfaceStore<ConstantPropagationStore>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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<ConstantPropagationStore>
-
visualize
public java.lang.String visualize(CFGVisualizer<?,ConstantPropagationStore,?> viz)
Description copied from interface:Store
Delegate visualization responsibility to a visualizer.- Specified by:
visualize
in interfaceStore<ConstantPropagationStore>
- Parameters:
viz
- the visualizer to visualize this store- Returns:
- the String representation of this store
-
-