public class DefUseAnalysisUtil extends AnalysisUtilVarContextDataFlow<VarContext<DefUseAbsVal>,DefUseAbsVal>
Modifier and Type | Class and Description |
---|---|
static class |
DefUseAnalysisUtil.Mode |
Modifier and Type | Field and Description |
---|---|
protected DefUseAnalysisUtil.Mode |
mode |
static java.lang.String |
STRING_CONTENTS |
protected boolean |
trackStrings |
protected polyglot.types.TypeSystem |
ts |
trackErrors
extInfo, instanceInitializersChecked, workQueue
Constructor and Description |
---|
DefUseAnalysisUtil(WorkQueue<VarContext<DefUseAbsVal>> wq,
AnalysisUnit currentAnalysisUnit,
AccrueExtensionInfo extInfo) |
DefUseAnalysisUtil(WorkQueue<VarContext<DefUseAbsVal>> wq,
AnalysisUnit currentAnalysisUnit,
AccrueExtensionInfo extInfo,
DefUseAnalysisUtil.Mode mode,
boolean trackStrings) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<AbstractLocation> |
abstractLocations(DefUseAbsVal arrayDFI,
polyglot.ast.ArrayAccess aa) |
protected java.util.Set<AbstractLocation> |
abstractLocations(DefUseAbsVal targetDFI,
polyglot.ast.Field f) |
protected java.util.Set<AbstractLocation> |
abstractLocationsImplicitTarget(DefUseAbsVal targetDFI,
polyglot.types.FieldInstance fi) |
FinalVarContext<DefUseAbsVal> |
analyze(polyglot.ast.CodeNode n,
VarContext<DefUseAbsVal> input)
Analyze the given code with the given current analysis results
|
FinalVarContext<DefUseAbsVal> |
analyzeInitializersForDataFlow(VarContext<DefUseAbsVal> before)
Analyze the initializers for the current analysis unit given the current
analysis results
|
DefUseAbsVal |
bottomAbstractValue() |
FinalVarContext<DefUseAbsVal> |
callNonVirtual(polyglot.types.ProcedureInstance pi,
AnalysisContext calleeContext,
HContext receiver,
DefUseAbsVal receiverAbsVal,
VarContext<DefUseAbsVal> input,
DataFlowNodeIdentifier callSite,
boolean canTerminateNormally)
|
VarContext<DefUseAbsVal> |
createInitContext()
Create an initial variable context
|
protected FinalVarContext<DefUseAbsVal> |
getAnalysisResultsFromWorkQueue(AnalysisUnit callee,
VarContext<DefUseAbsVal> beforeCall,
DataFlowNodeIdentifier callSite)
Get the analysis results for the given callee and variable context.
|
<T> java.util.Set<T> |
getCallResults(java.lang.String analysisKey,
polyglot.ast.ProcedureCall pcall)
Return analysis results for a procedure call.
|
protected java.util.Set<polyglot.types.ProcedureInstance> |
getCallTargets(polyglot.ast.Call n) |
protected <T> java.util.Set<T> |
getNativeCallResults(java.lang.String analysisKey,
polyglot.ast.ProcedureCall n,
polyglot.types.ProcedureInstance pi,
HContext o)
Returns analysis results for a native call target.
|
protected <T> java.util.Set<T> |
getNonVirtualCallResults(java.lang.String analysisKey,
polyglot.ast.ProcedureCall n,
polyglot.types.ProcedureInstance pi,
HContext o)
Returns analysis results for a specific target.
|
protected java.util.Set<polyglot.types.ClassType> |
getReceiverTypes(polyglot.ast.Call n) |
protected FinalVarContext<DefUseAbsVal> |
guessAnalysisForMissingCode(polyglot.types.ProcedureInstance pi,
AnalysisContext calleeContext,
HContext receiver,
VarContext<DefUseAbsVal> input,
DefUseAbsVal receiverAbsVal,
java.util.List<DefUseAbsVal> argAbsVals,
java.util.Set<ExitMap.Key> expectedExits,
DataFlowNodeIdentifier callSite)
Get analysis results for procedures for which the source code is missing.
|
protected FinalVarContext<DefUseAbsVal> |
guessAnalysisForMissingReceiver(polyglot.types.ProcedureInstance pi,
VarContext<DefUseAbsVal> input,
DefUseAbsVal receiverAbsVal,
java.util.List<DefUseAbsVal> argAbsVals,
java.util.Set<ExitMap.Key> expectedExits,
DataFlowNodeIdentifier callSiteNode)
Subclasses should override as a stop gap measure if the receiver is missing,
i.e., if the points to set of the receiver expression is empty.
|
protected boolean |
hasReferenceVariable(AnalysisContext context,
polyglot.ast.Expr e) |
protected boolean |
hasReferenceVariable(AnalysisContext context,
polyglot.ast.Formal f) |
protected boolean |
mayBeNull(DefUseAbsVal exprDFI,
polyglot.ast.Expr e,
polyglot.visit.FlowGraph.Peer<VarContext<DefUseAbsVal>> peer) |
protected boolean |
mayThrowClassCastException(DefUseAbsVal exprDFI,
polyglot.ast.Cast cast,
polyglot.visit.FlowGraph.Peer<VarContext<DefUseAbsVal>> peer) |
DefUseAnalysisUtil.Mode |
mode() |
protected java.util.Set<HContext> |
pointsTo(DefUseAbsVal exprDFI,
polyglot.ast.Expr e) |
protected java.util.Set<AbstractLocation> |
stringLocations(DefUseAbsVal stringDFI,
polyglot.ast.Expr stringExpr) |
boolean |
trackStrings() |
call, call, call, callFromNew, constructorCall, constructorCallFromConstructor, getAnalysisResultsFromWorkQueue, makeFinalVarContext, mergeCallResults, prepareCalleeContext
addLocations, analysisName, computeExpectedExits, createFinalVarContext, emptyFinalVarContext, getAnalysisForMissingReceiver, getLocationAbsVal, getSignatureForMissingCode, guessAnalysisForMissingCode, handleRecursiveCall, preCallNonVirtual, recordRead, recordReads, recordWrite, recordWrites, signatureAnalysisNames
abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocations, abstractLocationsForArray, abstractLocationsForArray, abstractLocationsForArray, abstractLocationsImplicitTarget, analyzeInitializers, analyzeStaticInitializers, createExitMap, currentAnalysisUnit, currentClass, currentContext, extensionInfo, instanceInitializers, leq, maybeRecursiveCall, pointsTo, pointsTo, pointsTo, pointsTo, pointsTo, pointsTo, pointsTo, pointsTo, pointsTo, pointsToGraph, pointsToThis, process, recordMissingCode, typeSystem, upperBound, workQueue
protected polyglot.types.TypeSystem ts
protected final DefUseAnalysisUtil.Mode mode
protected final boolean trackStrings
public static final java.lang.String STRING_CONTENTS
public DefUseAnalysisUtil(WorkQueue<VarContext<DefUseAbsVal>> wq, AnalysisUnit currentAnalysisUnit, AccrueExtensionInfo extInfo)
public DefUseAnalysisUtil(WorkQueue<VarContext<DefUseAbsVal>> wq, AnalysisUnit currentAnalysisUnit, AccrueExtensionInfo extInfo, DefUseAnalysisUtil.Mode mode, boolean trackStrings)
public DefUseAnalysisUtil.Mode mode()
public FinalVarContext<DefUseAbsVal> analyze(polyglot.ast.CodeNode n, VarContext<DefUseAbsVal> input) throws polyglot.types.SemanticException
AnalysisUtil
analyze
in class AnalysisUtil<VarContext<DefUseAbsVal>>
n
- Code to analyzeinput
- analysis result before analyzing the given codepolyglot.types.SemanticException
- thrown if the analysis failspublic VarContext<DefUseAbsVal> createInitContext()
AnalysisUtilVarContext
createInitContext
in class AnalysisUtilVarContext<VarContext<DefUseAbsVal>,DefUseAbsVal>
protected java.util.Set<polyglot.types.ProcedureInstance> getCallTargets(polyglot.ast.Call n)
protected java.util.Set<polyglot.types.ClassType> getReceiverTypes(polyglot.ast.Call n)
protected <T> java.util.Set<T> getNonVirtualCallResults(java.lang.String analysisKey, polyglot.ast.ProcedureCall n, polyglot.types.ProcedureInstance pi, HContext o)
protected <T> java.util.Set<T> getNativeCallResults(java.lang.String analysisKey, polyglot.ast.ProcedureCall n, polyglot.types.ProcedureInstance pi, HContext o)
public <T> java.util.Set<T> getCallResults(java.lang.String analysisKey, polyglot.ast.ProcedureCall pcall)
public FinalVarContext<DefUseAbsVal> callNonVirtual(polyglot.types.ProcedureInstance pi, AnalysisContext calleeContext, HContext receiver, DefUseAbsVal receiverAbsVal, VarContext<DefUseAbsVal> input, DataFlowNodeIdentifier callSite, boolean canTerminateNormally) throws polyglot.types.SemanticException
AnalysisUtilVarContextDataFlow
callNonVirtual
in class AnalysisUtilVarContextDataFlow<VarContext<DefUseAbsVal>,DefUseAbsVal>
pi
- call to analyzecalleeContext
- procedure analysis contextreceiver
- abstract heap object for the calleeinput
- variable context before analyzing the methodcallSite
- the call site for the procedure callcanTerminateNormally
- true if the called procedure can terminate normallypolyglot.types.SemanticException
- if analysis failsprotected boolean mayBeNull(DefUseAbsVal exprDFI, polyglot.ast.Expr e, polyglot.visit.FlowGraph.Peer<VarContext<DefUseAbsVal>> peer)
protected boolean mayThrowClassCastException(DefUseAbsVal exprDFI, polyglot.ast.Cast cast, polyglot.visit.FlowGraph.Peer<VarContext<DefUseAbsVal>> peer)
protected java.util.Set<AbstractLocation> abstractLocations(DefUseAbsVal targetDFI, polyglot.ast.Field f)
protected java.util.Set<AbstractLocation> abstractLocationsImplicitTarget(DefUseAbsVal targetDFI, polyglot.types.FieldInstance fi)
protected java.util.Set<AbstractLocation> abstractLocations(DefUseAbsVal arrayDFI, polyglot.ast.ArrayAccess aa)
protected java.util.Set<AbstractLocation> stringLocations(DefUseAbsVal stringDFI, polyglot.ast.Expr stringExpr)
protected boolean hasReferenceVariable(AnalysisContext context, polyglot.ast.Expr e)
protected boolean hasReferenceVariable(AnalysisContext context, polyglot.ast.Formal f)
protected java.util.Set<HContext> pointsTo(DefUseAbsVal exprDFI, polyglot.ast.Expr e)
protected FinalVarContext<DefUseAbsVal> getAnalysisResultsFromWorkQueue(AnalysisUnit callee, VarContext<DefUseAbsVal> beforeCall, DataFlowNodeIdentifier callSite) throws polyglot.types.SemanticException
AnalysisUtilVarContextDataFlow
getAnalysisResultsFromWorkQueue
in class AnalysisUtilVarContextDataFlow<VarContext<DefUseAbsVal>,DefUseAbsVal>
callee
- Code for a callee that is to be analyzedbeforeCall
- variable context before the call to the calleepolyglot.types.SemanticException
- thrown for an analysis errorpublic DefUseAbsVal bottomAbstractValue()
bottomAbstractValue
in class AnalysisUtilVarContext<VarContext<DefUseAbsVal>,DefUseAbsVal>
protected FinalVarContext<DefUseAbsVal> guessAnalysisForMissingReceiver(polyglot.types.ProcedureInstance pi, VarContext<DefUseAbsVal> input, DefUseAbsVal receiverAbsVal, java.util.List<DefUseAbsVal> argAbsVals, java.util.Set<ExitMap.Key> expectedExits, DataFlowNodeIdentifier callSiteNode)
AnalysisUtilVarContext
guessAnalysisForMissingReceiver
in class AnalysisUtilVarContext<VarContext<DefUseAbsVal>,DefUseAbsVal>
pi
- missing procedureinput
- variable context before analysisreceiverAbsVal
- abstract value for the receiverargAbsVals
- list of abstract values for the procedure argumentsexpectedExits
- set of expected exit keysprotected FinalVarContext<DefUseAbsVal> guessAnalysisForMissingCode(polyglot.types.ProcedureInstance pi, AnalysisContext calleeContext, HContext receiver, VarContext<DefUseAbsVal> input, DefUseAbsVal receiverAbsVal, java.util.List<DefUseAbsVal> argAbsVals, java.util.Set<ExitMap.Key> expectedExits, DataFlowNodeIdentifier callSite)
AnalysisUtilVarContextDataFlow
guessAnalysisForMissingCode
in class AnalysisUtilVarContextDataFlow<VarContext<DefUseAbsVal>,DefUseAbsVal>
pi
- procedure instance for which the code is missingcalleeContext
- context for the procedure missing source codereceiver
- Abstract heap object for the receiver of the missing procedureinput
- context before analyzing the missing procedurereceiverAbsVal
- abstract value for the receiver of the missing procedureargAbsVals
- abstract values for the arguments to the missing procedureexpectedExits
- expected exit keys for the missing procedure (for many analyses
the FinalVarContext
must have an entry for each exit key)callSite
- AST node and analysis context for the call siteFinalVarContext
estimating the results of analyzing the
missing codepublic FinalVarContext<DefUseAbsVal> analyzeInitializersForDataFlow(VarContext<DefUseAbsVal> before) throws polyglot.types.SemanticException
AnalysisUtilVarContextDataFlow
analyzeInitializersForDataFlow
in class AnalysisUtilVarContextDataFlow<VarContext<DefUseAbsVal>,DefUseAbsVal>
polyglot.types.SemanticException
- thrown if the analysis failspublic boolean trackStrings()