Class JitReachabilityModel
The implements the Reachability phase of the JitCompiler using a simple graph traversal.
The result is the set of basic blocks and edges that
are actually reachable from a passage's entries.
The traversal is seeded with each of the passage's entry points, and then each outbound flow is
considered. Consider a conditional branch. The control-flow graph will have two outbound flows,
one for the branch case, and one for the fall-through case. It's possible the data-flow phase
detected its condition was constant, and so it would be re-written as an unconditional branch or
nop, so we must examine the actual JitOp presented, not just the original p-code op, when
determining which flows can be taken. We perform this traversal in the downstream direction only.
-
Constructor Summary
ConstructorsConstructorDescriptionJitReachabilityModel(JitAnalysisContext context, JitControlFlowModel cfm, JitDataFlowModel dfm) Create the reachability model -
Method Summary
Modifier and TypeMethodDescriptionvoidFor diagnostics: Dump the analysis result to stderbooleanCheck whether the given block can be reachedbooleanCheck whether the given flow can be taken
-
Constructor Details
-
JitReachabilityModel
public JitReachabilityModel(JitAnalysisContext context, JitControlFlowModel cfm, JitDataFlowModel dfm) Create the reachability model- Parameters:
context- the analysis contextcfm- the control-flow modeldfm- the data-flow model.- Implementation Notes:
- We're being a bit lazy here requiring the DFM, because we use the re-written JitOps so that reachability heeds folded indirect and conditional branches. If we don't want this dependency, we could inspect the folded constants for the ops ourselves.
-
-
Method Details
-
isReachable
Check whether the given block can be reached- Parameters:
block- the block to check- Returns:
- true if reachable, i.e., non-removable
-
isTakeable
Check whether the given flow can be taken- Parameters:
flow- the flow to check- Returns:
- true if it can be taken, i.e., analysis must consider this edge.
-
dumpResult
public void dumpResult()For diagnostics: Dump the analysis result to stder- See Also:
-