public class StaticSplitting extends CompilerPhase
We use semantic knowledge of the tests to reduce the code replicated. The key idea is that for a guarded inlining, it is correct to take the 'off' branch even if test would select the on-branch. Therefore we can avoid replicating the on-branch code downstream of the replicated test, at the possible cost of trapping an execution in the uncommon-case trace that might have been able to use a subset of to common-case trace.
Modifier and Type | Class and Description |
---|---|
private static class |
StaticSplitting.CandInfo |
Modifier and Type | Field and Description |
---|---|
private BranchOptimizations |
branchOpts |
private StaticSplitting.CandInfo |
cands |
private static boolean |
DEBUG |
container
Constructor and Description |
---|
StaticSplitting() |
Modifier and Type | Method and Description |
---|---|
private boolean |
containsOSRPoint(BasicBlock bb) |
private BasicBlock |
findColdPrev(BasicBlock bb) |
private BasicBlock |
findColdSucc(Instruction test) |
private Instruction |
getCandidateTest(BasicBlock bb) |
String |
getName() |
private boolean |
haveCandidates() |
CompilerPhase |
newExecution(IR ir)
Return this instance of this phase.
|
private StaticSplitting.CandInfo |
nextCandidate() |
void |
perform(IR ir)
Do simplistic static splitting to create hot traces
with that do not have incoming edges from
blocks that are statically predicted to be cold.
|
boolean |
printingEnabled(OptOptions options,
boolean before)
Returns true if the phase wants the IR dumped before and/or after it runs.
|
private void |
pushCandidate(BasicBlock cand,
BasicBlock prev,
BasicBlock succ,
Instruction test) |
boolean |
shouldPerform(OptOptions options)
This method determines if the phase should be run, based on the
Options object it is passed.
|
private void |
simpleCandidateSearch(IR ir)
Identify candidate blocks by using a very
simplistic algorithm.
|
private void |
splitCandidate(StaticSplitting.CandInfo ci,
IR ir)
Splits a node where we can safely not
replicate the on-branch in the cloned node.
|
private boolean |
tooBig(BasicBlock bb,
int maxCost)
Simplistic cost estimate; since we
are doing the splitting based on
static hints, we are only willing to
copy a very small amount of code.
|
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, reportAdditionalStats, setContainer, verify
private static final boolean DEBUG
private final BranchOptimizations branchOpts
private StaticSplitting.CandInfo cands
public StaticSplitting()
public CompilerPhase newExecution(IR ir)
newExecution
in class CompilerPhase
ir
- not usedpublic String getName()
getName
in class CompilerPhase
public boolean shouldPerform(OptOptions options)
CompilerPhase
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilationpublic boolean printingEnabled(OptOptions options, boolean before)
CompilerPhase
printingEnabled
in class CompilerPhase
options
- the compiler options for the compilationbefore
- true when invoked before perform, false otherwise.public void perform(IR ir)
perform
in class CompilerPhase
ir
- The IR on which to apply the phaseprivate void simpleCandidateSearch(IR ir)
ir
- the governing IRprivate void splitCandidate(StaticSplitting.CandInfo ci, IR ir)
ci
- description of the split candidate.ir
- the governing IRprivate Instruction getCandidateTest(BasicBlock bb)
bb
- a basic blocknull
if
there is no single test (i.e. no test or multiple tests)private BasicBlock findColdPrev(BasicBlock bb)
bb
- a basic blocknull
.private BasicBlock findColdSucc(Instruction test)
test
- an instruction for a candidate testprivate boolean tooBig(BasicBlock bb, int maxCost)
bb
- block to checkmaxCost
- maximum cost that is acceptableprivate boolean containsOSRPoint(BasicBlock bb)
private void pushCandidate(BasicBlock cand, BasicBlock prev, BasicBlock succ, Instruction test)
private boolean haveCandidates()
private StaticSplitting.CandInfo nextCandidate()