Class AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>   
java.lang.Object
org.checkerframework.dataflow.analysis.AbstractAnalysis<V,S,T>  
- Type Parameters:
- V- the abstract value type to be tracked by the analysis
- S- the store type used in the analysis
- T- the transfer function type that is used to approximated runtime behavior
- All Implemented Interfaces:
- Analysis<V,- S, - T> 
- Direct Known Subclasses:
- BackwardAnalysisImpl,- ForwardAnalysisImpl
public abstract class AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>   
extends Object
implements Analysis<V,S,T>  
Implementation of common features for 
BackwardAnalysisImpl and ForwardAnalysisImpl.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classA worklist is a priority queue of blocks in which the order is given by depth-first ordering to place non-loop predecessors ahead of successors.Nested classes/interfaces inherited from interface org.checkerframework.dataflow.analysis.AnalysisAnalysis.BeforeOrAfter, Analysis.Direction
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected @MonotonicNonNull ControlFlowGraphThe current control flow graph to perform the analysis on.protected @Nullable TransferInput<V,S> The current transfer input when the analysis is running.protected @InternedDistinct @Nullable NodeThe node that is currently handled in the analysis (if it is running).protected @InternedDistinct @Nullable TreeThe tree that is currently being looked at.protected final Analysis.DirectionThe direction of this analysis.protected final HashMap<VariableElement,V> Map from (effectively final) local variable elements to their abstract value.protected final IdentityHashMap<Block,TransferInput<V, S>> The transfer inputs of every basic block (assumed to be 'no information' if not present, inputs before blocks in forward analysis, after blocks in backward analysis).protected booleanIs the analysis currently running?protected final IdentityHashMap<Node,V> Abstract values of nodes.protected @MonotonicNonNull TThe transfer function for regular nodes.protected final AbstractAnalysis.WorklistThe worklist used for the fix-point iteration.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractAnalysis(Analysis.Direction direction) Implementation of common features forBackwardAnalysisImplandForwardAnalysisImpl.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAdd a basic block toworklist.protected TransferResult<V,S> callTransferFunction(Node node, TransferInput<V, S> transferInput) Call the transfer function for nodenode, and set that node as current node first.Get theMethodTreeof the current CFG if the argumentTreemaps to aNodein the CFG ornullotherwise.Returns the tree that is currently being looked at.Get the direction of this analysis.Returns the exceptional exit store.Returns all current node values.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.protected final voidinit(ControlFlowGraph cfg) Initialize the analysis with a new control flow graph.protected voidInitialize fields of this object based on a given control flow graph.protected abstract voidInitialize the transfer inputs of every basic block before performing the analysis.protected booleanisIgnoredExceptionType(TypeMirror exceptionType) Should exceptional control flow for a particular exception type be ignored?booleanIs the analysis currently running?protected abstract voidpropagateStoresTo(Block nextBlock, Node node, TransferInput<V, S> currentInput, Store.FlowRule flowRule, boolean addToWorklistAgain) Propagate the stores incurrentInputto the next block in the direction of analysis, according to theflowRule.protected static <S> @Nullable SreadFromStore(Map<Block, S> stores, Block b) Read the store for a particular basic block from a map of stores (ornullif none exists yet).protected voidsetCurrentNode(@Nullable Node currentNode) Set the node that is currently being looked at.voidsetCurrentTree(Tree currentTree) Set the tree that is currently being looked at.protected booleanupdateNodeValues(Node node, TransferResult<V, S> transferResult) Updates the value of nodenodeto the value of thetransferResult.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.checkerframework.dataflow.analysis.AnalysisgetInput, performAnalysis, performAnalysisBlock, runAnalysisFor
- 
Field Details- 
directionThe direction of this analysis.
- 
isRunningprotected boolean isRunningIs the analysis currently running?
- 
transferFunctionThe transfer function for regular nodes.
- 
cfgThe current control flow graph to perform the analysis on.
- 
inputsprotected final IdentityHashMap<Block,TransferInput<V extends AbstractValue<V>, inputsS extends Store<S>>> The transfer inputs of every basic block (assumed to be 'no information' if not present, inputs before blocks in forward analysis, after blocks in backward analysis).
- 
worklistThe worklist used for the fix-point iteration.
- 
nodeValuesAbstract values of nodes.
- 
finalLocalValuesMap from (effectively final) local variable elements to their abstract value.
- 
currentNodeThe node that is currently handled in the analysis (if it is running). The following invariant holds:!isRunning ⇒ (currentNode == null) 
- 
currentTreeThe tree that is currently being looked at. The transfer function can set this tree to make sure that calls togetValuewill not return information for this given tree.
- 
currentInputThe current transfer input when the analysis is running.
 
- 
- 
Constructor Details- 
AbstractAnalysisImplementation of common features forBackwardAnalysisImplandForwardAnalysisImpl.- Parameters:
- direction- direction of the analysis
 
 
- 
- 
Method Details- 
getCurrentTreeReturns the tree that is currently being looked at. The transfer function can set this tree to make sure that calls togetValuewill not return information for this given tree.- Returns:
- the tree that is currently being looked at
 
- 
setCurrentTreeSet the tree that is currently being looked at.- Parameters:
- currentTree- the tree that should be currently looked at
 
- 
setCurrentNodeSet the node that is currently being looked at.- Parameters:
- currentNode- the node that should be currently looked at
 
- 
initInitialInputsInitialize the transfer inputs of every basic block before performing the analysis.
- 
propagateStoresToprotected abstract void propagateStoresTo(Block nextBlock, Node node, TransferInput<V, S> currentInput, Store.FlowRule flowRule, boolean addToWorklistAgain) Propagate the stores incurrentInputto the next block in the direction of analysis, according to theflowRule.- Parameters:
- nextBlock- the target block to propagate the stores to
- node- the node of the target block
- currentInput- the current transfer input
- flowRule- the flow rule being used
- addToWorklistAgain- whether the block should be added to- worklistagain
 
- 
isRunningpublic boolean isRunning()Description copied from interface:AnalysisIs the analysis currently running?
- 
getDirectionDescription copied from interface:AnalysisGet the direction of this analysis.- Specified by:
- getDirectionin interface- Analysis<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Returns:
- the direction of this analysis
 
- 
getResultDescription copied from interface:AnalysisThe result of running the analysis. This is only available once the analysis finished running.
- 
getTransferFunctionDescription copied from interface:AnalysisGet the transfer function of this analysis.- Specified by:
- getTransferFunctionin interface- Analysis<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Returns:
- the transfer function of this analysis
 
- 
getValueDescription copied from interface:AnalysisReturns the abstract value forNoden, ornullif no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.
- 
getNodeValuesReturns all current node values.- Returns:
- nodeValues
 
- 
getRegularExitStoreDescription copied from interface:AnalysisReturns the regular exit store, ornull, if there is no such store (because the method cannot exit through the regular exit block).- Specified by:
- getRegularExitStorein interface- Analysis<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Returns:
- the regular exit store, or null, if there is no such store (because the method cannot exit through the regular exit block)
 
- 
getExceptionalExitStoreDescription copied from interface:AnalysisReturns the exceptional exit store.- Specified by:
- getExceptionalExitStorein interface- Analysis<V extends AbstractValue<V>,- S extends Store<S>, - T extends TransferFunction<V, - S>> 
- Returns:
- the exceptional exit store
 
- 
getNodesForTree- Parameters:
- t- the given tree
- Returns:
- the set of corresponding nodes to the given tree
 
- 
getValueDescription copied from interface:AnalysisReturn the abstract value forTreet, ornullif no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.
- 
getContainingMethodGet theMethodTreeof the current CFG if the argumentTreemaps to aNodein the CFG ornullotherwise.- Parameters:
- t- the given tree
- Returns:
- the contained method tree of the given tree
 
- 
getContainingClassGet theClassTreeof the current CFG if the argumentTreemaps to aNodein the CFG ornullotherwise.- Parameters:
- t- the given tree
- Returns:
- the contained class tree of the given tree
 
- 
callTransferFunctionCall the transfer function for nodenode, and set that node as current node first. This method requires atransferInputthat the method can modify.- Parameters:
- node- the given node
- transferInput- the transfer input
- Returns:
- the output of the transfer function
 
- 
initInitialize the analysis with a new control flow graph.- Parameters:
- cfg- the control flow graph to use
 
- 
isIgnoredExceptionTypeShould exceptional control flow for a particular exception type be ignored?The default implementation always returns false. Subclasses should override the method to implement a different policy.- Parameters:
- exceptionType- the exception type
- Returns:
- trueif exceptional control flow due to- exceptionTypeshould be ignored,- falseotherwise
 
- 
initFieldsInitialize fields of this object based on a given control flow graph. Sub-class may override this method to initialize customized fields.- Parameters:
- cfg- a given control flow graph
 
- 
updateNodeValuesUpdates the value of nodenodeto the value of thetransferResult. Returns true if the node's value changed, or a store was updated.- Parameters:
- node- the node to update
- transferResult- the transfer result being updated
- Returns:
- true if the node's value changed, or a store was updated
 
- 
readFromStoreRead the store for a particular basic block from a map of stores (ornullif none exists yet).- Type Parameters:
- S- method return type should be a subtype of- Store
- Parameters:
- stores- a map of stores
- b- the target block
- Returns:
- the store for the target block
 
- 
addToWorklistAdd a basic block toworklist. Ifbis already present, the method does nothing.- Parameters:
- b- the block to add to- worklist
 
 
-