|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.driver.CompilerPhase org.jikesrvm.compilers.opt.controlflow.StaticSplitting
public class StaticSplitting
Static splitting based on very simple hints left by guarded inlining (off blocks marked as infrequent) and semantic knowledge of tests. The goal of this pass is to create 'common-case' traces. This is done by eliminating merge points where uncommon-case code merges back into common case code by code duplication. We rely on a later pass to eliminate redundant tests on the common-case trace.
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.
Nested Class Summary | |
---|---|
private static class |
StaticSplitting.CandInfo
|
Field Summary | |
---|---|
private BranchOptimizations |
branchOpts
|
private StaticSplitting.CandInfo |
cands
|
private static boolean |
DEBUG
|
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase |
---|
container |
Constructor Summary | |
---|---|
StaticSplitting()
|
Method Summary | |
---|---|
private boolean |
containsOSRPoint(BasicBlock bb)
|
private BasicBlock |
findColdPrev(BasicBlock bb)
Return the cold predecessor to the argument block. |
private BasicBlock |
findColdSucc(BasicBlock bb,
Instruction test)
Return the off-trace successor of b (on and off relative to the argument test) |
private Instruction |
getCandidateTest(BasicBlock bb)
Return the candidate test in b, or null if
b does not have one. |
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)
Split 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. |
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase |
---|
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, reportAdditionalStats, setContainer, verify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private final BranchOptimizations branchOpts
private StaticSplitting.CandInfo cands
Constructor Detail |
---|
public StaticSplitting()
Method Detail |
---|
public CompilerPhase newExecution(IR ir)
newExecution
in class CompilerPhase
ir
- not used
public String getName()
getName
in class CompilerPhase
public boolean shouldPerform(OptOptions options)
CompilerPhase
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilation
public 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)
private void splitCandidate(StaticSplitting.CandInfo ci, IR ir)
ci
- description of the split candidate.private Instruction getCandidateTest(BasicBlock bb)
null
if
b does not have one.
private BasicBlock findColdPrev(BasicBlock bb)
null
.
private BasicBlock findColdSucc(BasicBlock bb, Instruction test)
private boolean tooBig(BasicBlock bb, int maxCost)
private boolean containsOSRPoint(BasicBlock bb)
private void pushCandidate(BasicBlock cand, BasicBlock prev, BasicBlock succ, Instruction test)
private boolean haveCandidates()
private StaticSplitting.CandInfo nextCandidate()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |