A - Type of the analysis resultspublic abstract class AnalysisUtil<A extends Ordered<A>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected AccrueExtensionInfo |
extInfo
Compiler extension info
|
protected boolean |
instanceInitializersChecked |
protected WorkQueue<A> |
workQueue
Analysis item work queue
|
| Constructor and Description |
|---|
AnalysisUtil(WorkQueue<A> workQueue,
AnalysisUnit currentAnalysisUnit,
AccrueExtensionInfo extInfo)
Create a new utility class
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Set<AbstractLocation> |
abstractLocations(AccrueExtensionInfo extInfo,
AnalysisContext context,
polyglot.ast.ArrayAccess aa)
Get the set of abstract locations the given array access in the given context
parameter could reference
|
static java.util.Set<AbstractLocation> |
abstractLocations(AccrueExtensionInfo extInfo,
AnalysisContext context,
polyglot.ast.Field f)
Get the set of abstract locations the given field in the given context
parameter could reference
|
java.util.Set<AbstractLocation> |
abstractLocations(polyglot.ast.ArrayAccess aa) |
java.util.Set<AbstractLocation> |
abstractLocations(polyglot.ast.Expr receiver,
polyglot.types.FieldInstance fi)
Get the set of abstract locations the given field in the given receiver
could reference
|
java.util.Set<AbstractLocation> |
abstractLocations(polyglot.ast.Expr e,
java.util.List<java.lang.String> path,
java.util.List<polyglot.types.Type> types)
if path = f1, f2, f3, then returns abstract locations for e.f1.f2.f3
if types = t1.t2.t3, then e.f1 is of type t1, e.f1.f2 is of type t2, etc.
|
java.util.Set<AbstractLocation> |
abstractLocations(polyglot.ast.Field f)
Get the set of abstract locations the given field could point to
|
java.util.Set<AbstractLocation> |
abstractLocations(polyglot.ast.Formal f,
polyglot.types.FieldInstance fi)
Get the set of abstract locations the given field in the given formal parameter
could reference
|
java.util.Set<AbstractLocation> |
abstractLocations(HContext receiver,
polyglot.types.FieldInstance fi)
Get the set of abstract locations the given field in the given context
could reference
|
java.util.Set<AbstractLocation> |
abstractLocations(HContext receiver,
java.lang.String fieldName)
Get the set of abstract locations the given field in the given context
could reference
|
java.util.Set<AbstractLocation> |
abstractLocationsForArray(polyglot.ast.Expr array) |
java.util.Set<AbstractLocation> |
abstractLocationsForArray(polyglot.ast.Formal f) |
java.util.Set<AbstractLocation> |
abstractLocationsForArray(java.util.Set<HContext> arrayObjects) |
java.util.Set<AbstractLocation> |
abstractLocationsImplicitTarget(polyglot.types.FieldInstance fi)
Get the set of abstract locations the given field could point to.
|
java.lang.String |
analysisName() |
abstract ExitMap<A> |
analyze(polyglot.ast.CodeNode n,
A before)
Analyze the given code with the given current analysis results
|
ExitMap<A> |
analyzeInitializers(A input)
Analyze the initializers for the current analysis unit given the current
analysis results
|
protected ExitMap<A> |
analyzeStaticInitializers(A input)
Analyze the static initializers for the current analysis unit given the current
analysis results
|
ExitMap<A> |
createExitMap(A input)
Create a map from exit key to the given analysis result
|
AnalysisUnit |
currentAnalysisUnit() |
polyglot.types.ClassType |
currentClass() |
AnalysisContext |
currentContext() |
AccrueExtensionInfo |
extensionInfo() |
java.util.List<polyglot.ast.CodeNode> |
instanceInitializers(polyglot.types.ClassType container) |
static <O extends Ordered<O>> |
leq(O x,
O y) |
protected boolean |
maybeRecursiveCall(AnalysisUnit callee)
Check if a call to the given analysis unit from the current analysis unit
could be recursive
|
java.util.Set<HContext> |
pointsTo(polyglot.ast.Expr e)
Get the points-to set for the given expression in the current analysis context
|
static java.util.Set<HContext> |
pointsTo(polyglot.ast.Expr e,
AnalysisContext context,
AccrueExtensionInfo extInfo)
The set of heap objects the expression could point to given the
AnalysisContext |
java.util.Set<HContext> |
pointsTo(polyglot.ast.Formal f) |
static java.util.Set<HContext> |
pointsTo(polyglot.ast.Formal f,
AnalysisContext context,
AccrueExtensionInfo extInfo)
The set of heap objects the formal could point to given the
AnalysisContext |
protected static java.util.Set<HContext> |
pointsTo(ReferenceVariable ln,
AnalysisContext context,
AccrueExtensionInfo extInfo)
The set of heap objects the node could point to given the
AnalysisContext |
java.util.Set<HContext> |
pointsTo(java.util.Set<HContext> os,
polyglot.types.FieldInstance fi)
Return the set of abstract objects that may be pointed to by the
field instance fi of the abstract objects os.
|
static java.util.Set<HContext> |
pointsTo(java.util.Set<HContext> os,
polyglot.types.FieldInstance fi,
polyglot.frontend.ExtensionInfo extInfo)
Return the set of abstract objects that may be pointed to by the
field instance fi of the abstract objects os.
|
java.util.Set<HContext> |
pointsTo(java.util.Set<HContext> os,
java.lang.String field,
polyglot.types.Type type)
Return the set of abstract objects that may be pointed to by the
field
field of type type of the abstract objects os. |
static java.util.Set<HContext> |
pointsTo(java.util.Set<HContext> os,
java.lang.String field,
polyglot.types.Type type,
polyglot.frontend.ExtensionInfo extInfo)
Return the set of abstract objects that may be pointed to by the
field
field of type type of the abstract objects os. |
static PointsToGraph |
pointsToGraph(polyglot.frontend.ExtensionInfo extInfo) |
java.util.Set<HContext> |
pointsToThis()
Return the pointsto set for "this" in the current analysis context.
|
ExitMap<A> |
process(polyglot.ast.CodeNode cn,
A input)
Run the analysis on the given code and current results (
input) |
void |
recordMissingCode(polyglot.types.CodeInstance ci)
Add the missing code to the compiler debug report
|
polyglot.types.TypeSystem |
typeSystem() |
static <O extends Ordered<O>> |
upperBound(O x,
O y) |
WorkQueue<A> |
workQueue() |
protected final AccrueExtensionInfo extInfo
protected boolean instanceInitializersChecked
public AnalysisUtil(WorkQueue<A> workQueue, AnalysisUnit currentAnalysisUnit, AccrueExtensionInfo extInfo)
workQueue - Queue of analysis unitscurrentAnalysisUnit - Current analysis unit from the queueextInfo - compiler analysis unitpublic AccrueExtensionInfo extensionInfo()
public polyglot.types.TypeSystem typeSystem()
TypeSystempublic AnalysisUnit currentAnalysisUnit()
public AnalysisContext currentContext()
public polyglot.types.ClassType currentClass()
ClassType for the current analysis unitpublic ExitMap<A> createExitMap(A input)
input - analysis result to put into the exit mapprotected boolean maybeRecursiveCall(AnalysisUnit callee)
callee - target of the potentially recursive calltrue if the current analysis unit make a recursive call on the
calleepublic static <O extends Ordered<O>> O upperBound(O x, O y)
x and ypublic static <O extends Ordered<O>> boolean leq(O x, O y)
true if x is less than ypublic ExitMap<A> process(polyglot.ast.CodeNode cn, A input) throws polyglot.types.SemanticException
input)cn - Code to analyzeinput - current analysis resultspolyglot.types.SemanticException - thrown if the analysis failspublic ExitMap<A> analyzeInitializers(A input) throws polyglot.types.SemanticException
input - current analysis resultspolyglot.types.SemanticException - thrown if the analysis failsprotected ExitMap<A> analyzeStaticInitializers(A input) throws polyglot.types.SemanticException
input - current analysis resultspolyglot.types.SemanticException - thrown if the analysis failspublic abstract ExitMap<A> analyze(polyglot.ast.CodeNode n, A before) throws polyglot.types.SemanticException
n - Code to analyzebefore - analysis result before analyzing the given codepolyglot.types.SemanticException - thrown if the analysis failspublic java.lang.String analysisName()
public java.util.Set<AbstractLocation> abstractLocations(polyglot.ast.Field f)
f - field to checkpublic java.util.Set<AbstractLocation> abstractLocationsImplicitTarget(polyglot.types.FieldInstance fi)
fi - field to checkpublic java.util.Set<AbstractLocation> abstractLocations(polyglot.ast.Expr receiver, polyglot.types.FieldInstance fi)
receiver - Expression containing the fieldf - field to checkpublic java.util.Set<AbstractLocation> abstractLocations(HContext receiver, polyglot.types.FieldInstance fi)
receiver - Context to evaluate the points-to set inf - field to checkpublic java.util.Set<AbstractLocation> abstractLocations(HContext receiver, java.lang.String fieldName)
receiver - Context to evaluate the points-to set inf - name of field to checkpublic java.util.Set<AbstractLocation> abstractLocations(polyglot.ast.Formal f, polyglot.types.FieldInstance fi)
f - formal parameter containing the fieldfi - field to checkpublic java.util.Set<AbstractLocation> abstractLocations(polyglot.ast.Expr e, java.util.List<java.lang.String> path, java.util.List<polyglot.types.Type> types)
public java.util.Set<AbstractLocation> abstractLocations(polyglot.ast.ArrayAccess aa)
public java.util.Set<AbstractLocation> abstractLocationsForArray(polyglot.ast.Expr array)
array - Expression representing the array to get the points-to set forpublic java.util.Set<AbstractLocation> abstractLocationsForArray(java.util.Set<HContext> arrayObjects)
public java.util.Set<AbstractLocation> abstractLocationsForArray(polyglot.ast.Formal f)
protected static java.util.Set<HContext> pointsTo(ReferenceVariable ln, AnalysisContext context, AccrueExtensionInfo extInfo)
AnalysisContextln - node to get the points-to set forcontext - Procedure analysis contextextInfo - Compiler extension infopublic static PointsToGraph pointsToGraph(polyglot.frontend.ExtensionInfo extInfo)
Compiler - extension infopublic java.util.Set<HContext> pointsTo(polyglot.ast.Expr e)
e - expressionepublic static java.util.Set<HContext> pointsTo(polyglot.ast.Expr e, AnalysisContext context, AccrueExtensionInfo extInfo)
AnalysisContexte - expression to get the points-to set forcontext - Procedure analysis contextextInfo - Compiler extension infopublic java.util.Set<HContext> pointsToThis()
public java.util.Set<HContext> pointsTo(polyglot.ast.Formal f)
public static java.util.Set<HContext> pointsTo(polyglot.ast.Formal f, AnalysisContext context, AccrueExtensionInfo extInfo)
AnalysisContextf - formal to get the points-to set forcontext - Procedure analysis contextextInfo - Compiler extension infopublic java.util.Set<HContext> pointsTo(java.util.Set<HContext> os, java.lang.String field, polyglot.types.Type type)
field of type type of the abstract objects os.
That is, if o is in os, and
the field field of the abstract object o may point to object m, and m is a subtype of
type then m is in the
set returned by this method. The pointsTo graph associated with the extInfo field
of this AnalysisUtil is used.public static java.util.Set<HContext> pointsTo(java.util.Set<HContext> os, java.lang.String field, polyglot.types.Type type, polyglot.frontend.ExtensionInfo extInfo)
field of type type of the abstract objects os.
That is, if o is in os, and
the field field of the abstract object o may point to object m, and m is a subtype of
type then m is in the
set returned by this method. The pointsTo graph associated with extInfo is used.public java.util.Set<HContext> pointsTo(java.util.Set<HContext> os, polyglot.types.FieldInstance fi)
public static java.util.Set<HContext> pointsTo(java.util.Set<HContext> os, polyglot.types.FieldInstance fi, polyglot.frontend.ExtensionInfo extInfo)
public static java.util.Set<AbstractLocation> abstractLocations(AccrueExtensionInfo extInfo, AnalysisContext context, polyglot.ast.Field f)
extInfo - Compiler extension infocontext - Procedure analysis contextf - field to checkpublic static java.util.Set<AbstractLocation> abstractLocations(AccrueExtensionInfo extInfo, AnalysisContext context, polyglot.ast.ArrayAccess aa)
extInfo - Compiler extension infocontext - Procedure analysis contextaa - array access to checkpublic java.util.List<polyglot.ast.CodeNode> instanceInitializers(polyglot.types.ClassType container)
public void recordMissingCode(polyglot.types.CodeInstance ci)
ci - missing code