Class BusyExprStore
- java.lang.Object
-
- org.checkerframework.dataflow.busyexpr.BusyExprStore
-
- All Implemented Interfaces:
Store<BusyExprStore>
public class BusyExprStore extends java.lang.Object implements Store<BusyExprStore>
A busy expression store contains a set of busy expressions 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 BusyExprStore()
Create a new BusyExprStore.BusyExprStore(java.util.Set<BusyExprValue> busyExprValueSet)
Create a new BusyExprStore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUseInExpression(Node e)
Add expressions to the store, add sub-expressions to the store recursivelyboolean
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).BusyExprStore
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.boolean
exprContainsVariable(Node expr, Node var)
Return true if the expression contains variable var.int
hashCode()
void
killBusyExpr(Node var)
Kill expressions if they contain variable var.BusyExprStore
leastUpperBound(BusyExprStore other)
Compute the least upper bound of two stores.void
putBusyExpr(BusyExprValue e)
Add busy expression e to busy expression value set.java.lang.String
toString()
java.lang.String
visualize(CFGVisualizer<?,BusyExprStore,?> viz)
Delegate visualization responsibility to a visualizer.BusyExprStore
widenedUpperBound(BusyExprStore previous)
Compute an upper bound of two stores that is wider than the least upper bound of the two stores.
-
-
-
Constructor Detail
-
BusyExprStore
public BusyExprStore(java.util.Set<BusyExprValue> busyExprValueSet)
Create a new BusyExprStore.- Parameters:
busyExprValueSet
- a set of busy expression abstract values. The parameter is captured and the caller should not retain an alias.
-
BusyExprStore
public BusyExprStore()
Create a new BusyExprStore.
-
-
Method Detail
-
killBusyExpr
public void killBusyExpr(Node var)
Kill expressions if they contain variable var.- Parameters:
var
- a variable
-
exprContainsVariable
public boolean exprContainsVariable(Node expr, Node var)
Return true if the expression contains variable var. Note that.equals
is used in the return statement to verify value equality, as the statement decides whether the two nodes have the same value, not represent the same CFG node.- Parameters:
expr
- the expression checkedvar
- the variable- Returns:
- true if the expression contains the variable
-
putBusyExpr
public void putBusyExpr(BusyExprValue e)
Add busy expression e to busy expression value set.- Parameters:
e
- the busy expression to be added
-
addUseInExpression
public void addUseInExpression(Node e)
Add expressions to the store, add sub-expressions to the store recursively- Parameters:
e
- the expression to be added
-
copy
public BusyExprStore copy()
Description copied from interface:Store
Returns an exact copy of this store.- Specified by:
copy
in interfaceStore<BusyExprStore>
- Returns:
- an exact copy of this store
-
leastUpperBound
public BusyExprStore leastUpperBound(BusyExprStore 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<BusyExprStore>
- Does not change
-
widenedUpperBound
public BusyExprStore widenedUpperBound(BusyExprStore 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<BusyExprStore>
- Parameters:
previous
- must be the previous store
- Does not change
-
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<BusyExprStore>
-
visualize
public java.lang.String visualize(CFGVisualizer<?,BusyExprStore,?> viz)
Description copied from interface:Store
Delegate visualization responsibility to a visualizer.- Specified by:
visualize
in interfaceStore<BusyExprStore>
- 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
-
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<BusyExprStore>
- 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
-
-