Class InterProceduralEngine
- java.lang.Object
-
- com.tonic.analysis.simulation.core.InterProceduralEngine
-
public class InterProceduralEngine extends Object
Simulation engine that follows method calls up to a configurable depth, resolving callees from the ClassPool and lifting their bodies to IR on demand.
-
-
Constructor Summary
Constructors Constructor Description InterProceduralEngine(SimulationContext context)Creates an engine with an empty call stack and method cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InterProceduralEngineaddListener(SimulationListener listener)Registers a listener for simulation events.InterProceduralEngineaddListeners(SimulationListener... listenerArray)Registers several listeners for simulation events.CallStackStategetCallStack()SimulationContextgetContext()intgetMaxDepthReached()intgetMethodsSimulated()SimulationResultsimulate(IRMethod method)Simulates a method, following calls inter-procedurally when the context allows it.
-
-
-
Constructor Detail
-
InterProceduralEngine
public InterProceduralEngine(SimulationContext context)
Creates an engine with an empty call stack and method cache.- Parameters:
context- configuration and shared resources for the simulation
-
-
Method Detail
-
addListener
public InterProceduralEngine addListener(SimulationListener listener)
Registers a listener for simulation events.- Parameters:
listener- the listener to register- Returns:
- this engine
-
addListeners
public InterProceduralEngine addListeners(SimulationListener... listenerArray)
Registers several listeners for simulation events.- Parameters:
listenerArray- the listeners to register- Returns:
- this engine
-
getContext
public SimulationContext getContext()
- Returns:
- the simulation context
-
getCallStack
public CallStackState getCallStack()
- Returns:
- the current call stack
-
getMethodsSimulated
public int getMethodsSimulated()
- Returns:
- the number of methods simulated in the last run
-
getMaxDepthReached
public int getMaxDepthReached()
- Returns:
- the maximum call depth reached in the last run
-
simulate
public SimulationResult simulate(IRMethod method)
Simulates a method, following calls inter-procedurally when the context allows it.- Parameters:
method- the entry method to simulate- Returns:
- the collected simulation result
-
-