N - The type of nodes in the interprocedural control-flow graph.
Typically Unit.D - The type of data-flow facts to be computed by the tabulation
problem.I - The type of inter-procedural control-flow graph being used.public class IFDSSolver<N,D extends FastSolverLinkedNode<D,N>,I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<N,soot.SootMethod>> extends Object implements IMemoryBoundedSolver
IFDSTabulationProblem. This solver is not based on
the IDESolver implementation in Heros for performance reasons.IFDSTabulationProblem| Modifier and Type | Class and Description |
|---|---|
protected static class |
IFDSSolver.IncomingRecord<N,D extends FastSolverLinkedNode<D,N>> |
IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static com.google.common.cache.CacheBuilder<Object,Object> |
DEFAULT_CACHE_BUILDER |
protected MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D>,Map<heros.solver.Pair<N,D>,D>> |
endSummary |
protected InterruptableExecutor |
executor |
protected heros.FlowFunctionCache<N,D,soot.SootMethod> |
ffCache |
protected heros.FlowFunctions<N,D,soot.SootMethod> |
flowFunctions |
protected boolean |
followReturnsPastSeeds |
protected IGarbageCollector<N,D> |
garbageCollector |
protected I |
icfg |
protected soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D>,IFDSSolver.IncomingRecord<N,D>> |
incoming |
protected Map<N,Set<D>> |
initialSeeds |
protected soot.util.ConcurrentHashMultiMap<soot.SootMethod,heros.solver.PathEdge<N,D>> |
jumpFunctions |
protected static org.slf4j.Logger |
logger |
protected IMemoryManager<D,N> |
memoryManager |
protected int |
numThreads |
long |
propagationCount |
protected PredecessorShorteningMode |
shorteningMode |
protected boolean |
solverId |
protected SolverPeerGroup |
solverPeerGroup |
protected D |
zeroValue |
| Constructor and Description |
|---|
IFDSSolver(heros.IFDSTabulationProblem<N,D,soot.SootMethod,I> tabulationProblem)
Creates a solver for the given problem, which caches flow functions and edge
functions.
|
IFDSSolver(heros.IFDSTabulationProblem<N,D,soot.SootMethod,I> tabulationProblem,
com.google.common.cache.CacheBuilder flowFunctionCacheBuilder)
Creates a solver for the given problem, constructing caches with the given
CacheBuilder. |
| Modifier and Type | Method and Description |
|---|---|
D |
addFunction(heros.solver.PathEdge<N,D> edge)
Records a jump function.
|
protected boolean |
addIncoming(soot.SootMethod m,
D d3,
N n,
D d1,
D d2) |
void |
addStatusListener(IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification listener)
Adds a new listener that will be notified of status changes in the solver
|
protected boolean |
applyEndSummaryOnCall(D d1,
N n,
D d2,
Collection<N> returnSiteNs,
soot.SootMethod sCalledProcN,
D d3) |
protected void |
awaitCompletionComputeValuesAndShutdown()
Awaits the completion of the exploded super graph.
|
protected Set<D> |
computeCallFlowFunction(heros.FlowFunction<D> callFlowFunction,
D d1,
D d2)
Computes the call flow function for the given call-site abstraction
|
protected Set<D> |
computeCallToReturnFlowFunction(heros.FlowFunction<D> callToReturnFlowFunction,
D d1,
D d2)
Computes the call-to-return flow function for the given call-site abstraction
|
protected Set<D> |
computeNormalFlowFunction(heros.FlowFunction<D> flowFunction,
D d1,
D d2)
Computes the normal flow function for the given set of start and end
abstractions.
|
protected Set<D> |
computeReturnFlowFunction(heros.FlowFunction<D> retFunction,
D d1,
D d2,
N callSite,
Collection<D> callerSideDs)
Computes the return flow function for the given set of caller-side
abstractions.
|
protected IGarbageCollector<N,D> |
createGarbageCollector()
Factory method for creating an instance of the garbage collector
|
protected Map<heros.solver.Pair<N,D>,D> |
endSummaryMap(soot.SootMethod m,
D d3) |
void |
forceTerminate(ISolverTerminationReason reason)
Forces the solver to terminate its tasks and stop processing new tasks.
|
protected String |
getDebugName()
Returns a String used to identify the output of this solver in debug mode.
|
protected InterruptableExecutor |
getExecutor()
Factory method for this solver's thread-pool executor.
|
IMemoryManager<D,N> |
getMemoryManager()
Gets the memory manager used by this solver to reduce memory consumption
|
ISolverTerminationReason |
getTerminationReason()
In case this solver was killed before it could complete its task, this
method returns the reason for the abortion.
|
protected Set<IFDSSolver.IncomingRecord<N,D>> |
incoming(D d1,
soot.SootMethod m) |
boolean |
isKilled()
Checks whether this solver was killed before it could complete its tasks
|
boolean |
isTerminated()
Checks whether this solver is terminated, either by forced termination,
or because it has finished all of its work.
|
void |
printStats() |
protected void |
processExit(heros.solver.PathEdge<N,D> edge)
Lines 21-32 of the algorithm.
|
protected void |
propagate(D sourceVal,
N target,
D targetVal,
N relatedCallSite,
boolean isUnbalancedReturn)
Propagates the flow further down the exploded super graph.
|
void |
reset()
Resets the solver to its initial state after it has been forcefully
terminated.
|
protected void |
scheduleEdgeProcessing(heros.solver.PathEdge<N,D> edge)
Dispatch the processing of a given edge.
|
void |
setMaxAbstractionPathLength(int maxAbstractionPathLength) |
void |
setMaxCalleesPerCallSite(int maxCalleesPerCallSite) |
void |
setMaxJoinPointAbstractions(int maxJoinPointAbstractions)
Sets the maximum number of abstractions that shall be recorded per join
point.
|
void |
setMemoryManager(IMemoryManager<D,N> memoryManager)
Sets the memory manager that shall be used to manage the abstractions
|
void |
setPeerGroup(SolverPeerGroup solverPeerGroup)
Sets the peer group in which this solver operates.
|
void |
setPredecessorShorteningMode(PredecessorShorteningMode mode)
Sets whether abstractions on method returns shall be connected to the
respective call abstractions to shortcut paths.
|
void |
setSolverId(boolean solverId) |
void |
solve()
Runs the solver on the configured problem.
|
protected void |
submitInitialSeeds()
Schedules the processing of initial seeds, initiating the analysis.
|
void |
terminate()
Notifies the solver that no further edges will be scheduled
|
public static com.google.common.cache.CacheBuilder<Object,Object> DEFAULT_CACHE_BUILDER
protected static final org.slf4j.Logger logger
public static final boolean DEBUG
protected InterruptableExecutor executor
protected int numThreads
protected soot.util.ConcurrentHashMultiMap<soot.SootMethod,heros.solver.PathEdge<N,D extends FastSolverLinkedNode<D,N>>> jumpFunctions
protected volatile IGarbageCollector<N,D extends FastSolverLinkedNode<D,N>> garbageCollector
protected final I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<N,soot.SootMethod> icfg
protected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D,N>>,Map<heros.solver.Pair<N,D extends FastSolverLinkedNode<D,N>>,D extends FastSolverLinkedNode<D,N>>> endSummary
protected final soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D,N>>,IFDSSolver.IncomingRecord<N,D extends FastSolverLinkedNode<D,N>>> incoming
protected final heros.FlowFunctions<N,D extends FastSolverLinkedNode<D,N>,soot.SootMethod> flowFunctions
public long propagationCount
protected final D extends FastSolverLinkedNode<D,N> zeroValue
protected final heros.FlowFunctionCache<N,D extends FastSolverLinkedNode<D,N>,soot.SootMethod> ffCache
protected final boolean followReturnsPastSeeds
protected PredecessorShorteningMode shorteningMode
protected IMemoryManager<D extends FastSolverLinkedNode<D,N>,N> memoryManager
protected boolean solverId
protected SolverPeerGroup solverPeerGroup
public IFDSSolver(heros.IFDSTabulationProblem<N,D,soot.SootMethod,I> tabulationProblem)
solve().public IFDSSolver(heros.IFDSTabulationProblem<N,D,soot.SootMethod,I> tabulationProblem, com.google.common.cache.CacheBuilder flowFunctionCacheBuilder)
CacheBuilder. The solver must then be started by calling
solve().tabulationProblem - The tabulation problem to solveflowFunctionCacheBuilder - A valid CacheBuilder or
null if no caching is to be used
for flow functions.protected IGarbageCollector<N,D> createGarbageCollector()
public void setSolverId(boolean solverId)
public void solve()
protected void submitInitialSeeds()
solve() should be called instead.protected void awaitCompletionComputeValuesAndShutdown()
protected void scheduleEdgeProcessing(heros.solver.PathEdge<N,D> edge)
edge - the edge to processprotected boolean applyEndSummaryOnCall(D d1, N n, D d2, Collection<N> returnSiteNs, soot.SootMethod sCalledProcN, D d3)
protected Set<D> computeCallFlowFunction(heros.FlowFunction<D> callFlowFunction, D d1, D d2)
callFlowFunction - The call flow function to computed1 - The abstraction at the current method's start node.d2 - The abstraction at the call siteprotected Set<D> computeCallToReturnFlowFunction(heros.FlowFunction<D> callToReturnFlowFunction, D d1, D d2)
callToReturnFlowFunction - The call-to-return flow function to computed1 - The abstraction at the current method's start
node.d2 - The abstraction at the call siteprotected void processExit(heros.solver.PathEdge<N,D> edge)
edge - an edge whose target node resembles a method exitsprotected Set<D> computeReturnFlowFunction(heros.FlowFunction<D> retFunction, D d1, D d2, N callSite, Collection<D> callerSideDs)
retFunction - The return flow function to computed1 - The abstraction at the beginning of the calleed2 - The abstraction at the exit node in the calleecallSite - The call sitecallerSideDs - The abstractions at the call siteprotected Set<D> computeNormalFlowFunction(heros.FlowFunction<D> flowFunction, D d1, D d2)
flowFunction - The normal flow function to computed1 - The abstraction at the method's start noded2 - The abstraction at the current nodeprotected void propagate(D sourceVal, N target, D targetVal, N relatedCallSite, boolean isUnbalancedReturn)
sourceVal - the source value of the propagated summary edgetarget - the target statementtargetVal - the target value at the target statementrelatedCallSite - for call and return flows the related call
statement, null otherwise (this value
is not used within this implementation but may be
useful for subclasses of IFDSSolver)isUnbalancedReturn - true if this edge is propagating an
unbalanced return (this value is not used within
this implementation but may be useful for
subclasses of IFDSSolver)public D addFunction(heros.solver.PathEdge<N,D> edge)
PathEdgeprotected Set<IFDSSolver.IncomingRecord<N,D>> incoming(D d1, soot.SootMethod m)
protected InterruptableExecutor getExecutor()
protected String getDebugName()
public void printStats()
public void setPredecessorShorteningMode(PredecessorShorteningMode mode)
mode - The strategy to use for shortening predecessor pathspublic void setMaxJoinPointAbstractions(int maxJoinPointAbstractions)
maxJoinPointAbstractions - The maximum number of abstractions per join
point, or -1 to record an arbitrary number of
join point abstractionspublic void setMemoryManager(IMemoryManager<D,N> memoryManager)
memoryManager - The memory manager that shall be used to manage the
abstractionspublic IMemoryManager<D,N> getMemoryManager()
public void forceTerminate(ISolverTerminationReason reason)
IMemoryBoundedSolverforceTerminate in interface IMemoryBoundedSolverreason - The reason why the solver is terminatedpublic boolean isTerminated()
IMemoryBoundedSolverisTerminated in interface IMemoryBoundedSolverpublic boolean isKilled()
IMemoryBoundedSolverisKilled in interface IMemoryBoundedSolverpublic void reset()
IMemoryBoundedSolverreset in interface IMemoryBoundedSolverpublic void addStatusListener(IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification listener)
IMemoryBoundedSolveraddStatusListener in interface IMemoryBoundedSolverlistener - The listener that will be notified when the status of the
solver changespublic ISolverTerminationReason getTerminationReason()
IMemoryBoundedSolvergetTerminationReason in interface IMemoryBoundedSolverpublic void setMaxCalleesPerCallSite(int maxCalleesPerCallSite)
public void setMaxAbstractionPathLength(int maxAbstractionPathLength)
public void setPeerGroup(SolverPeerGroup solverPeerGroup)
solverPeerGroup - The solver peer grouppublic void terminate()
Copyright © 2021 Fraunhofer SIT. All rights reserved.