public abstract class TypeFlow<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AnalysisType |
declaredType |
protected MethodFlowsGraph |
graphRef |
protected int |
id |
boolean |
inQueue |
protected static AtomicInteger |
nextId |
protected T |
source |
protected TypeState |
state |
| Constructor and Description |
|---|
TypeFlow() |
TypeFlow(T source,
AnalysisType declaredType) |
TypeFlow(T source,
AnalysisType declaredType,
boolean canBeNull) |
TypeFlow(T source,
AnalysisType declaredType,
TypeState state) |
TypeFlow(TypeFlow<T> original,
MethodFlowsGraph graphRef)
Shallow copy constructor.
|
TypeFlow(TypeFlow<T> original,
MethodFlowsGraph graphRef,
TypeState cloneState) |
TypeFlow(TypeState typeState) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInput(TypeFlow<?> input) |
void |
addObservee(TypeFlow<?> observee) |
void |
addObserver(PointsToAnalysis bb,
TypeFlow<?> observer)
Register object that will be notified when the state of this flow changes.
|
boolean |
addObserver(PointsToAnalysis bb,
TypeFlow<?> observer,
boolean triggerUpdate) |
boolean |
addState(PointsToAnalysis bb,
TypeState add) |
boolean |
addState(PointsToAnalysis bb,
TypeState add,
boolean postFlow) |
boolean |
addUse(PointsToAnalysis bb,
TypeFlow<?> use) |
boolean |
addUse(PointsToAnalysis bb,
TypeFlow<?> use,
boolean propagateTypeState) |
boolean |
canSaturate()
Can this type flow saturate? By default all type flows can saturate, with the exception of a
few ones that need to track all their types, e.g., AllInstantiated, AllSynchronized, etc.
|
void |
clearInputs() |
void |
clearObservees() |
void |
clearObservers() |
void |
clearUses() |
TypeFlow<T> |
copy(PointsToAnalysis bb,
MethodFlowsGraph methodFlows)
By default a type flow is not cloneable.
|
TypeState |
declaredTypeFilter(PointsToAnalysis bb,
TypeState newState)
Filter type states using a flow's declared type.
|
TypeState |
declaredTypeFilter(PointsToAnalysis bb,
TypeState newState,
boolean onlyWithRelaxedTypeFlowConstraints) |
protected boolean |
doAddUse(PointsToAnalysis bb,
TypeFlow<?> use) |
boolean |
equals(Object other) |
TypeState |
filter(PointsToAnalysis bb,
TypeState newState) |
static AnalysisType |
filterUncheckedInterface(AnalysisType type)
In Java, interface types are not checked by the bytecode verifier.
|
String |
format(boolean withState,
boolean withSource) |
String |
formatSource() |
AnalysisType |
getDeclaredType() |
Collection<TypeFlow<?>> |
getInputs() |
Collection<TypeFlow<?>> |
getObservees() |
Collection<TypeFlow<?>> |
getObservers() |
int |
getSlot() |
T |
getSource() |
TypeState |
getState() |
Collection<TypeFlow<?>> |
getUses() |
MethodFlowsGraph |
graphRef() |
int |
hashCode() |
int |
id() |
void |
initFlow(PointsToAnalysis bb)
Initialization code for some type flow corner cases.
|
void |
invalidate()
Invalidating the typeflow will cause the flow to be lazily removed in the future.
|
boolean |
isAllInstantiated() |
boolean |
isClone() |
boolean |
isContextInsensitive() |
boolean |
isSaturated()
Return true if this flow is saturated.
|
boolean |
isValid()
Return true is the flow is valid and should be updated.
|
AnalysisMethod |
method() |
boolean |
needsInitialization()
Type flows that require initialization after the graph is created need to override this
method and return true.
|
protected void |
notifyObserverOfSaturation(PointsToAnalysis bb,
TypeFlow<?> observer) |
protected void |
notifyUseOfSaturation(PointsToAnalysis bb,
TypeFlow<?> use) |
protected void |
onInputSaturated(PointsToAnalysis bb,
TypeFlow<?> input)
Notified by an input that it is saturated and it will stop sending updates.
|
void |
onObservedSaturated(PointsToAnalysis bb,
TypeFlow<?> observed)
Notified by an observed flow that it is saturated.
|
void |
onObservedUpdate(PointsToAnalysis bb)
Notify the observer that the observed type flow state has changed.
|
protected void |
onSaturated() |
protected void |
onSaturated(PointsToAnalysis bb)
Called when this type flow becomes saturated.
|
TypeFlow<?> |
receiver()
Some flows have a receiver (e.g., loads, store and invokes).
|
boolean |
removeObserver(TypeFlow<?> observer) |
boolean |
removeUse(TypeFlow<?> use) |
void |
replacedObservedWith(PointsToAnalysis bb,
TypeFlow<?> newObservedFlow) |
void |
replaceObservedWith(PointsToAnalysis bb,
AnalysisType newObservedType)
When an "observed -> observer" link is updated the observer needs to be notified as well so
it can update its internal reference.
|
protected void |
setObserved(TypeFlow<?> newObservedFlow)
Set the type flow that this flow is observing.
|
void |
setSaturated()
Mark this flow as saturated.
|
void |
setSlot(int slot) |
void |
setState(PointsToAnalysis bb,
TypeState state) |
protected void |
swapAtObserver(PointsToAnalysis bb,
TypeFlow<?> newFlow,
TypeFlow<?> observer) |
protected void |
swapAtUse(PointsToAnalysis bb,
TypeFlow<?> newFlow,
TypeFlow<?> use) |
protected void |
swapOut(PointsToAnalysis bb,
TypeFlow<?> newFlow)
This flow will swap itself out at all uses and observers.
|
String |
toString() |
void |
update(PointsToAnalysis bb) |
protected static final AtomicInteger nextId
protected final int id
protected T source
protected final AnalysisType declaredType
protected volatile TypeState state
protected final MethodFlowsGraph graphRef
public volatile boolean inQueue
public TypeFlow()
public TypeFlow(TypeState typeState)
public TypeFlow(T source, AnalysisType declaredType)
public TypeFlow(T source, AnalysisType declaredType, boolean canBeNull)
public TypeFlow(T source, AnalysisType declaredType, TypeState state)
public TypeFlow(TypeFlow<T> original, MethodFlowsGraph graphRef)
original - the original flowgraphRef - the holder method clonepublic TypeFlow(TypeFlow<T> original, MethodFlowsGraph graphRef, TypeState cloneState)
public TypeFlow<T> copy(PointsToAnalysis bb, MethodFlowsGraph methodFlows)
bb - methodFlows - public void initFlow(PointsToAnalysis bb)
TypeFlow.needsInitialization() also
needs to be overridden to enable type flow initialization.bb - public boolean needsInitialization()
public TypeFlow<?> receiver()
public int id()
public MethodFlowsGraph graphRef()
public AnalysisMethod method()
public T getSource()
public boolean isClone()
public boolean isContextInsensitive()
public AnalysisType getDeclaredType()
public TypeState getState()
public boolean isAllInstantiated()
public void setState(PointsToAnalysis bb, TypeState state)
public void setSlot(int slot)
public int getSlot()
public boolean isValid()
public void invalidate()
public boolean isSaturated()
public boolean canSaturate()
public void setSaturated()
public boolean addState(PointsToAnalysis bb, TypeState add)
public boolean addState(PointsToAnalysis bb, TypeState add, boolean postFlow)
public boolean addUse(PointsToAnalysis bb, TypeFlow<?> use)
public boolean addUse(PointsToAnalysis bb, TypeFlow<?> use, boolean propagateTypeState)
protected void notifyUseOfSaturation(PointsToAnalysis bb, TypeFlow<?> use)
protected boolean doAddUse(PointsToAnalysis bb, TypeFlow<?> use)
public boolean removeUse(TypeFlow<?> use)
public void clearUses()
public Collection<TypeFlow<?>> getUses()
public void addObserver(PointsToAnalysis bb, TypeFlow<?> observer)
public boolean addObserver(PointsToAnalysis bb, TypeFlow<?> observer, boolean triggerUpdate)
protected void notifyObserverOfSaturation(PointsToAnalysis bb, TypeFlow<?> observer)
public boolean removeObserver(TypeFlow<?> observer)
public void clearObservers()
public Collection<TypeFlow<?>> getObservers()
public void addObservee(TypeFlow<?> observee)
public Collection<TypeFlow<?>> getObservees()
public void clearObservees()
public void addInput(TypeFlow<?> input)
public Collection<TypeFlow<?>> getInputs()
public void clearInputs()
public TypeState filter(PointsToAnalysis bb, TypeState newState)
public TypeState declaredTypeFilter(PointsToAnalysis bb, TypeState newState)
public TypeState declaredTypeFilter(PointsToAnalysis bb, TypeState newState, boolean onlyWithRelaxedTypeFlowConstraints)
public static AnalysisType filterUncheckedInterface(AnalysisType type)
public void update(PointsToAnalysis bb)
public void onObservedUpdate(PointsToAnalysis bb)
protected void onSaturated(PointsToAnalysis bb)
protected void onSaturated()
protected void swapOut(PointsToAnalysis bb, TypeFlow<?> newFlow)
protected void swapAtUse(PointsToAnalysis bb, TypeFlow<?> newFlow, TypeFlow<?> use)
protected void swapAtObserver(PointsToAnalysis bb, TypeFlow<?> newFlow, TypeFlow<?> observer)
protected void onInputSaturated(PointsToAnalysis bb, TypeFlow<?> input)
public void onObservedSaturated(PointsToAnalysis bb, TypeFlow<?> observed)
public void replaceObservedWith(PointsToAnalysis bb, AnalysisType newObservedType)
TypeFlow.replacedObservedWith(PointsToAnalysis, TypeFlow) can be used for
replacing the observed with a custom type flow.public void replacedObservedWith(PointsToAnalysis bb, TypeFlow<?> newObservedFlow)
protected void setObserved(TypeFlow<?> newObservedFlow)
public String formatSource()
public String format(boolean withState, boolean withSource)