public class StaticAnalysis extends Object
The analysis builds a directed graph of type flows
. If a type is added to type
flow, it is propagated to all uses
of the type flow. Types are propagated
using a worklist
of changed type flows until a fixpoint is reached, i.e., until no more
types need to be added to any type state.
The type flows are constructed from a high-level Graal graph by the StaticAnalysis.TypeFlowBuilder
. All
nodes that operate on object
values are converted to the appropriate type
flows. The analysis is context insensitive: every Java field has one
list
of types assigned to the field; every Java method has one
state
for each parameter
as well as the
return value
.
Modifier and Type | Class and Description |
---|---|
(package private) class |
StaticAnalysis.InvokeTypeFlow
The active element for method invocations.
|
class |
StaticAnalysis.MethodState
The
types of the parameters and return value of a method. |
class |
StaticAnalysis.Results
The results computed by the static analysis.
|
class |
StaticAnalysis.TypeFlow
The active element during static analysis: types are added until a fixed point is reached.
|
(package private) class |
StaticAnalysis.TypeFlowBuilder
Converts the Graal nodes of a method to a type flow graph.
|
(package private) class |
StaticAnalysis.WorklistEntry
Base class for all work items that can be
added to the worklist . |
Modifier and Type | Field and Description |
---|---|
private MetaAccessProvider |
metaAccess
Access to type, method, and fields using the Graal API.
|
private StaticAnalysis.Results |
results
The results of the static analysis.
|
private StampProvider |
stampProvider
Access to platform dependent stamps.
|
private Deque<StaticAnalysis.WorklistEntry> |
worklist
Worklist for fixpoint iteration.
|
Constructor and Description |
---|
StaticAnalysis(MetaAccessProvider metaAccess,
StampProvider stampProvider) |
Modifier and Type | Method and Description |
---|---|
void |
addMethod(ResolvedJavaMethod method)
Adds a root method to the static analysis.
|
protected void |
addToWorklist(StaticAnalysis.WorklistEntry task) |
protected static RuntimeException |
error(String msg) |
void |
finish()
Performs the fixed-point analysis that finds all methods transitively reachable from the
root methods . |
StaticAnalysis.Results |
getResults()
Returns the static analysis results computed by
finish() . |
private final MetaAccessProvider metaAccess
private final StampProvider stampProvider
private final StaticAnalysis.Results results
private final Deque<StaticAnalysis.WorklistEntry> worklist
public StaticAnalysis(MetaAccessProvider metaAccess, StampProvider stampProvider)
public void addMethod(ResolvedJavaMethod method)
public void finish()
root methods
.public StaticAnalysis.Results getResults()
finish()
.protected void addToWorklist(StaticAnalysis.WorklistEntry task)
protected static RuntimeException error(String msg)