Package it.unive.lisa
Class LiSAConfiguration
- java.lang.Object
-
- it.unive.lisa.LiSAConfiguration
-
public class LiSAConfiguration extends java.lang.ObjectA holder for the configuration of aLiSAanalysis.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_WIDENING_THRESHOLDThe default number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).
-
Constructor Summary
Constructors Constructor Description LiSAConfiguration()Builds a new configuration object, with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LiSAConfigurationaddSemanticCheck(it.unive.lisa.checks.semantic.SemanticCheck<?,?,?> check)Adds the given semantic check to the ones that will be executed.LiSAConfigurationaddSemanticChecks(java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,?,?>> checks)Adds the given semantic checks to the ones that will be executed.LiSAConfigurationaddSyntacticCheck(it.unive.lisa.checks.syntactic.SyntacticCheck check)Adds the given syntactic check to the ones that will be executed.LiSAConfigurationaddSyntacticChecks(java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> checks)Adds the given syntactic checks to the ones that will be executed.booleanequals(java.lang.Object obj)it.unive.lisa.analysis.AbstractState<?,?,?>getAbstractState()Yields theAbstractStatefor the analysis.it.unive.lisa.interprocedural.callgraph.CallGraphgetCallGraph()Yields theCallGraphfor the analysis.java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>>getFixpointWorkingSet()Yields the concrete class ofWorkingSetto be used in fixpoints.it.unive.lisa.interprocedural.InterproceduralAnalysis<?,?,?>getInterproceduralAnalysis()Yields theInterproceduralAnalysisfor the analysis.it.unive.lisa.interprocedural.OpenCallPolicygetOpenCallPolicy()Yields theOpenCallPolicyto use during the analysis.java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,?,?>>getSemanticChecks()Yields the collection ofSemanticChecks that are to be executed during the analysis.java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck>getSyntacticChecks()Yields the collection ofSyntacticChecks that are to be executed during the analysis.java.util.function.Function<it.unive.lisa.analysis.AbstractState<?,?,?>,it.unive.lisa.util.collections.externalSet.ExternalSet<it.unive.lisa.type.Type>>getTypeExtractor()Yields the function that, given a state computed during type inference, yield the set of types computed for the processedSymbolicExpression.it.unive.lisa.analysis.AbstractState<?,?,?>getTypeInferenceState()Yields theAbstractStatefor the type inference.intgetWideningThreshold()Yields the number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).java.lang.StringgetWorkdir()Yields the working directory where LiSA will dump all of its outputs.inthashCode()booleanisDumpAnalysis()Yields whether or not the results of analysis, if run, should be dumped in the form of dot files representing results on singleCFGs.booleanisDumpCFGs()Yields whether or not the input program should be dumped in the form of dot files representing singleCFGs.booleanisDumpTypeInference()Yields whether or not the results of type inference, if run, should be dumped in the form of dot files representing results on singleCFGs.booleanisInferTypes()Yields whether or not type inference should be run.booleanisJsonOutput()Yields whether or not the results a json report file should be dumped at the end of the analysis.LiSAConfigurationsetAbstractState(it.unive.lisa.analysis.AbstractState<?,?,?> state)Sets theAbstractStateto use for the analysis.LiSAConfigurationsetCallGraph(it.unive.lisa.interprocedural.callgraph.CallGraph callGraph)Sets theCallGraphto use for the analysis.LiSAConfigurationsetDumpAnalysis(boolean dumpAnalysis)Sets whether or not dot files, namedanalysis__<cfg name>.dot, should be created and dumped in the working directory at the end of the analysis.LiSAConfigurationsetDumpCFGs(boolean dumpCFGs)Sets whether or not dot files, named<cfg name>.dot, should be created and dumped in the working directory at the start of the execution.LiSAConfigurationsetDumpTypeInference(boolean dumpTypeInference)Sets whether or not dot files, namedtyping__<cfg name>.dot, should be created and dumped in the working directory at the end of the type inference.LiSAConfigurationsetFixpointWorkingSet(java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet)Sets the concrete class ofWorkingSetto be used in fixpoints.LiSAConfigurationsetInferTypes(boolean inferTypes)Sets whether or not runtime types should be inferred before executing the semantic analysis.LiSAConfigurationsetInterproceduralAnalysis(it.unive.lisa.interprocedural.InterproceduralAnalysis<?,?,?> analysis)Sets theInterproceduralAnalysisto use for the analysis.LiSAConfigurationsetJsonOutput(boolean jsonOutput)Sets whether or not a json report file, namedreport.json, should be created and dumped in the working directory at the end of the analysis.LiSAConfigurationsetOpenCallPolicy(it.unive.lisa.interprocedural.OpenCallPolicy openCallPolicy)Sets theOpenCallPolicyto use during the analysis.LiSAConfigurationsetTypeInferenceState(it.unive.lisa.analysis.AbstractState<?,?,?> state, java.util.function.Function<it.unive.lisa.analysis.AbstractState<?,?,?>,it.unive.lisa.util.collections.externalSet.ExternalSet<it.unive.lisa.type.Type>> typeExtractor)Sets theAbstractStateto use for the type inference.LiSAConfigurationsetWideningThreshold(int wideningThreshold)Sets the number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).LiSAConfigurationsetWorkdir(java.lang.String workdir)Sets the working directory for this instance of LiSA, that is, the directory files will be created, if any.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_WIDENING_THRESHOLD
public static final int DEFAULT_WIDENING_THRESHOLD
The default number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LiSAConfiguration
public LiSAConfiguration()
Builds a new configuration object, with default settings. By default:- no syntactic check is executed
- no
AbstractStateis set for the analysis - no
CallGraphis set for the analysis - no
InterproceduralAnalysisis set for the analysis - the workdir is the one where LiSA was executed
- the input program will not be dumped
- no type inference will be run
- the type inference will not be dumped
- the results of the analysis will not be dumped
- the json report will not be dumped
- the default warning threshold (5) will be used
- the open call policy used is
WorstCasePolicy
-
-
Method Detail
-
addSyntacticCheck
public LiSAConfiguration addSyntacticCheck(it.unive.lisa.checks.syntactic.SyntacticCheck check)
Adds the given syntactic check to the ones that will be executed. These checks will be immediately executed after LiSA is started.- Parameters:
check- the check to execute- Returns:
- the current (modified) configuration
-
addSyntacticChecks
public LiSAConfiguration addSyntacticChecks(java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> checks)
Adds the given syntactic checks to the ones that will be executed. These checks will be immediately executed after LiSA is started.- Parameters:
checks- the checks to execute- Returns:
- the current (modified) configuration
-
addSemanticCheck
public LiSAConfiguration addSemanticCheck(it.unive.lisa.checks.semantic.SemanticCheck<?,?,?> check)
Adds the given semantic check to the ones that will be executed. These checks will be executed after the fixpoint iteration has been completed.- Parameters:
check- the check to execute- Returns:
- the current (modified) configuration
-
addSemanticChecks
public LiSAConfiguration addSemanticChecks(java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,?,?>> checks)
Adds the given semantic checks to the ones that will be executed. These checks will be executed after the fixpoint iteration has been completed.- Parameters:
checks- the checks to execute- Returns:
- the current (modified) configuration
-
setCallGraph
public LiSAConfiguration setCallGraph(it.unive.lisa.interprocedural.callgraph.CallGraph callGraph)
Sets theCallGraphto use for the analysis. Any existing value is overwritten.- Parameters:
callGraph- the callgraph to use- Returns:
- the current (modified) configuration
-
setInterproceduralAnalysis
public LiSAConfiguration setInterproceduralAnalysis(it.unive.lisa.interprocedural.InterproceduralAnalysis<?,?,?> analysis)
Sets theInterproceduralAnalysisto use for the analysis. Any existing value is overwritten.- Parameters:
analysis- the interprocedural analysis to use- Returns:
- the current (modified) configuration
-
setTypeInferenceState
public LiSAConfiguration setTypeInferenceState(it.unive.lisa.analysis.AbstractState<?,?,?> state, java.util.function.Function<it.unive.lisa.analysis.AbstractState<?,?,?>,it.unive.lisa.util.collections.externalSet.ExternalSet<it.unive.lisa.type.Type>> typeExtractor)
Sets theAbstractStateto use for the type inference. Any existing value is overwritten.- Parameters:
state- the abstract state to usetypeExtractor- the function that, given a state computed during type inference, yield the set of types computed for the processedSymbolicExpression. This value will be considered as the set of runtime types for theStatementthat generated such expression.- Returns:
- the current (modified) configuration
-
setAbstractState
public LiSAConfiguration setAbstractState(it.unive.lisa.analysis.AbstractState<?,?,?> state)
Sets theAbstractStateto use for the analysis. Any existing value is overwritten.- Parameters:
state- the abstract state to use- Returns:
- the current (modified) configuration
-
setInferTypes
public LiSAConfiguration setInferTypes(boolean inferTypes)
Sets whether or not runtime types should be inferred before executing the semantic analysis. If type inference is not executed, the runtime types of expressions will correspond to their static type.- Parameters:
inferTypes- iftrue, type inference will be ran before the semantic analysis- Returns:
- the current (modified) configuration
-
setDumpCFGs
public LiSAConfiguration setDumpCFGs(boolean dumpCFGs)
Sets whether or not dot files, named<cfg name>.dot, should be created and dumped in the working directory at the start of the execution. These files will contain a dot graph representing the each inputCFGs' structure.
To customize where the graphs should be generated, usesetWorkdir(String).- Parameters:
dumpCFGs- iftrue, a dot graph will be generated before starting the analysis for each input cfg- Returns:
- the current (modified) configuration
-
setDumpTypeInference
public LiSAConfiguration setDumpTypeInference(boolean dumpTypeInference)
Sets whether or not dot files, namedtyping__<cfg name>.dot, should be created and dumped in the working directory at the end of the type inference. These files will contain a dot graph representing the each inputCFGs' structure, and whose nodes will contain a textual representation of the results of the type inference on eachStatement.
To decide whether or not the type inference should be executed, usesetInferTypes(boolean).
To customize where the graphs should be generated, usesetWorkdir(String).- Parameters:
dumpTypeInference- iftrue, a dot graph will be generated after the type inference for each input cfg- Returns:
- the current (modified) configuration
-
setDumpAnalysis
public LiSAConfiguration setDumpAnalysis(boolean dumpAnalysis)
Sets whether or not dot files, namedanalysis__<cfg name>.dot, should be created and dumped in the working directory at the end of the analysis. These files will contain a dot graph representing the each inputCFGs' structure, and whose nodes will contain a textual representation of the results of the semantic analysis on eachStatement.
To customize where the graphs should be generated, usesetWorkdir(String).- Parameters:
dumpAnalysis- iftrue, a dot graph will be generated after the semantic analysis for each input cfg- Returns:
- the current (modified) configuration
-
setJsonOutput
public LiSAConfiguration setJsonOutput(boolean jsonOutput)
Sets whether or not a json report file, namedreport.json, should be created and dumped in the working directory at the end of the analysis. This file will contain all theWarnings that have been generated, as well as a list of produced files.
To customize where the report should be generated, usesetWorkdir(String).- Parameters:
jsonOutput- iftrue, a json report will be generated after the analysis- Returns:
- the current (modified) configuration
-
setWorkdir
public LiSAConfiguration setWorkdir(java.lang.String workdir)
Sets the working directory for this instance of LiSA, that is, the directory files will be created, if any. If files need to be created and this method has not been invoked, LiSA will create them in the directory where it was executed from.- Parameters:
workdir- the path (relative or absolute) to the working directory- Returns:
- the current (modified) configuration
-
setFixpointWorkingSet
public LiSAConfiguration setFixpointWorkingSet(java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet)
Sets the concrete class ofWorkingSetto be used in fixpoints.- Parameters:
fixpointWorkingSet- the class- Returns:
- the current (modified) configuration
-
setWideningThreshold
public LiSAConfiguration setWideningThreshold(int wideningThreshold)
Sets the number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).- Parameters:
wideningThreshold- the threshold- Returns:
- the current (modified) configuration
-
setOpenCallPolicy
public LiSAConfiguration setOpenCallPolicy(it.unive.lisa.interprocedural.OpenCallPolicy openCallPolicy)
Sets theOpenCallPolicyto use during the analysis.- Parameters:
openCallPolicy- the policy to use- Returns:
- the current (modified) configuration
-
getCallGraph
public it.unive.lisa.interprocedural.callgraph.CallGraph getCallGraph()
Yields theCallGraphfor the analysis. Might benullif none was set.- Returns:
- the call graph for the analysis
-
getInterproceduralAnalysis
public it.unive.lisa.interprocedural.InterproceduralAnalysis<?,?,?> getInterproceduralAnalysis()
Yields theInterproceduralAnalysisfor the analysis. Might benullif none was set.- Returns:
- the interprocedural analysis for the analysis
-
getTypeInferenceState
public it.unive.lisa.analysis.AbstractState<?,?,?> getTypeInferenceState()
Yields theAbstractStatefor the type inference. Might benullif none was set. If this is notnull, thengetTypeExtractor()is notnulleither.- Returns:
- the abstract state for the type inference
-
getTypeExtractor
public java.util.function.Function<it.unive.lisa.analysis.AbstractState<?,?,?>,it.unive.lisa.util.collections.externalSet.ExternalSet<it.unive.lisa.type.Type>> getTypeExtractor()
Yields the function that, given a state computed during type inference, yield the set of types computed for the processedSymbolicExpression. This value will be considered as the set of runtime types for theStatementthat generated such expression.- Returns:
- the function that is used to extract types
-
getAbstractState
public it.unive.lisa.analysis.AbstractState<?,?,?> getAbstractState()
Yields theAbstractStatefor the analysis. Might benullif none was set.- Returns:
- the abstract state for the analysis
-
getSyntacticChecks
public java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> getSyntacticChecks()
Yields the collection ofSyntacticChecks that are to be executed during the analysis.- Returns:
- the syntactic checks
-
getSemanticChecks
public java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,?,?>> getSemanticChecks()
Yields the collection ofSemanticChecks that are to be executed during the analysis.- Returns:
- the semantic checks
-
isInferTypes
public boolean isInferTypes()
Yields whether or not type inference should be run.- Returns:
trueif type inference should be run
-
isDumpCFGs
public boolean isDumpCFGs()
Yields whether or not the input program should be dumped in the form of dot files representing singleCFGs.- Returns:
trueif input program should be dumped
-
isDumpTypeInference
public boolean isDumpTypeInference()
Yields whether or not the results of type inference, if run, should be dumped in the form of dot files representing results on singleCFGs.- Returns:
trueif type inference should be dumped
-
isDumpAnalysis
public boolean isDumpAnalysis()
Yields whether or not the results of analysis, if run, should be dumped in the form of dot files representing results on singleCFGs.- Returns:
trueif the analysis should be dumped
-
isJsonOutput
public boolean isJsonOutput()
Yields whether or not the results a json report file should be dumped at the end of the analysis.- Returns:
trueif the report should be produced
-
getWorkdir
public java.lang.String getWorkdir()
Yields the working directory where LiSA will dump all of its outputs.- Returns:
- the working directory
-
getFixpointWorkingSet
public java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> getFixpointWorkingSet()
Yields the concrete class ofWorkingSetto be used in fixpoints.- Returns:
- the working set class
-
getWideningThreshold
public int getWideningThreshold()
Yields the number of fixpoint iteration on a given node after which calls toLattice.lub(Lattice)gets replaced withLattice.widening(Lattice).- Returns:
- the widening threshold
-
getOpenCallPolicy
public it.unive.lisa.interprocedural.OpenCallPolicy getOpenCallPolicy()
Yields theOpenCallPolicyto use during the analysis.- Returns:
- the policy
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-