Interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
- Type Parameters:
V
- the abstract value type to be tracked by the analysisS
- the store type used in the analysisT
- the transfer function type that is used to approximated runtime behavior
- All Known Subinterfaces:
BackwardAnalysis<V,
,S, T> ForwardAnalysis<V,
S, T>
- All Known Implementing Classes:
AbstractAnalysis
,AccumulationAnalysis
,BackwardAnalysisImpl
,CalledMethodsAnalysis
,CFAbstractAnalysis
,CFAnalysis
,ForwardAnalysisImpl
,InitializationAnalysis
,KeyForAnalysis
,LockAnalysis
,NullnessNoInitAnalysis
,ResourceLeakAnalysis
public interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
This interface defines a dataflow analysis, given a control flow graph and a transfer function. A
dataflow analysis has a direction, either forward or backward. The direction of corresponding
transfer function is consistent with the analysis, i.e. a forward analysis has a forward transfer
function, and a backward analysis has a backward transfer function.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
In calls toAnalysis#runAnalysisFor
, whether to return the store before or after the given node.static enum
The direction of an analysis instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the direction of this analysis.Returns the exceptional exit store.Get the transfer input of a givenBlock
b.Returns the regular exit store, ornull
, if there is no such store (because the method cannot exit through the regular exit block).The result of running the analysis.Get the transfer function of this analysis.boolean
Is the analysis currently running?void
Perform the actual analysis.void
Perform the actual analysis on one block.runAnalysisFor
(Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V, S> blockTransferInput, IdentityHashMap<Node, V> nodeValues, @Nullable Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Runs the analysis again within the block ofnode
and returns the store at the location ofnode
.
-
Method Details
-
getDirection
Analysis.Direction getDirection()Get the direction of this analysis.- Returns:
- the direction of this analysis
-
isRunning
boolean isRunning()Is the analysis currently running?- Returns:
- true if the analysis is running currently, else false
-
performAnalysis
Perform the actual analysis.- Parameters:
cfg
- the control flow graph
-
performAnalysisBlock
Perform the actual analysis on one block.- Parameters:
b
- the block to analyze
-
runAnalysisFor
S runAnalysisFor(Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V, S> blockTransferInput, IdentityHashMap<Node, V> nodeValues, @Nullable Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Runs the analysis again within the block ofnode
and returns the store at the location ofnode
. Ifbefore
is true, then the store immediately before theNode
node
is returned. Otherwise, the store immediately afternode
is returned. IfanalysisCaches
is not null, this method uses a cache.analysisCaches
is a map of a block of node to the cached analysis result. If the cache fortransferInput
is not inanalysisCaches
, this method creates new cache and stores it inanalysisCaches
. The cache is a map of nodes to the analysis results of the nodes.- Parameters:
node
- the node to analyzepreOrPost
- which store to return: the store immediately beforenode
or the store afternode
blockTransferInput
- the transfer input of the block of this nodenodeValues
- abstract values of nodesanalysisCaches
- caches of analysis results- Returns:
- the store before or after
node
(depends on the value ofbefore
) after running the analysis
-
getResult
AnalysisResult<V,S> getResult()The result of running the analysis. This is only available once the analysis finished running.- Returns:
- the result of running the analysis
-
getTransferFunction
Get the transfer function of this analysis.- Returns:
- the transfer function of this analysis
-
getInput
Get the transfer input of a givenBlock
b.- Parameters:
b
- a given Block- Returns:
- the transfer input of this Block
-
getValue
Returns the abstract value forNode
n
, ornull
if no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.- Parameters:
n
- n a node- Returns:
- the abstract value for node
n
, ornull
if no information is available
-
getValue
Return the abstract value forTree
t
, ornull
if no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.- Parameters:
t
- the given tree- Returns:
- the abstract value for the given tree
-
getRegularExitStore
Returns the regular exit store, ornull
, if there is no such store (because the method cannot exit through the regular exit block).- Returns:
- the regular exit store, or
null
, if there is no such store (because the method cannot exit through the regular exit block)
-
getExceptionalExitStore
Returns the exceptional exit store.- Returns:
- the exceptional exit store
-