[rvm-research] add SSAinHIR into opt level 1
王晨曦 <[email protected]> Sun, 6 Sep 2015 21:48:16 +0800
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <[email protected]> |
hi,everyone
I want to add the optimization plan SSAinHIR into opt level 1.
so, I make the concerned flags true in opt level 1, in the shouldPerform function.
and change the opt level in shouldPerform.
just as below show:
private static void SSAinHIR(ArrayList<OptimizationPlanElement> p) {
composeComponents(p, "SSA", new Object[]{
// Use the LST to estimate basic block frequency from branch probabilities
new OptimizationPlanCompositeElement("Basic Block Frequency Estimation",
new Object[]{new BuildLST(), new EstimateBlockFrequencies()}) {
@Override
public boolean shouldPerform(OptOptions options) {
return options.getOptLevel() >= 3;
}
},
new OptimizationPlanCompositeElement("HIR SSA transformations", new Object[]{
// Local copy propagation
new LocalCopyProp(),
// Local constant propagation
new LocalConstantProp(),
// Insert PI Nodes
new PiNodes(true),
// branch optimization
new BranchOptimizations(1, true, true), //change to opt level 1
// Compute dominators
new DominatorsPhase(true),
// compute dominance frontier
new DominanceFrontier(),
// load elimination
new LoadElimination(1),
// load elimination
new LoadElimination(2),
// load elimination
new LoadElimination(3),
// load elimination
new LoadElimination(4),
// load elimination
new LoadElimination(5),
// eliminate redundant conditional branches
new RedundantBranchElimination(),
// path sensitive constant propagation
new SSATuneUp(),
// clean up Pi Nodes
new PiNodes(false),
// Simple SSA optimizations,
new SSATuneUp(),
// Global Code Placement,
new GCP(),
// Loop versioning
new LoopVersioning(), //can't modify the flag in setOptValue
// Leave SSA
new LeaveSSA()}) {
@Override
public boolean shouldPerform(OptOptions options) {
//set flag values
boolean res = options.getOptLevel() >= 1;
if(res){
options.SSA = true;
options.SSA_LOAD_ELIMINATION = true;
options.SSA_GCP = true;
options.SSA_GCSE = true;
}
return res; //change to opt level 1
}
},
// Coalesce moves
new CoalesceMoves(),
// SSA reveals new opportunites for the following
new OptimizationPlanCompositeElement("Post SSA cleanup",
new Object[]{new LocalCopyProp(),
new LocalConstantProp(),
new Simple(3, true, true, false, false),
new EscapeTransformations(),
new BranchOptimizations(3, true, true)}) {
@Override
public boolean shouldPerform(OptOptions options) {
return options.getOptLevel() >= 3;
}
}});
}
but,there are errors in element LICM:
[echo] compositePlan:Global Code Placement
[echo] compilePhase:GCP Preparation
[echo] compilePhase:Enter SSA
[echo] compilePhase:Global CSE
[echo] compilePhase:Enter SSA
[echo] compilePhase:LICM
[echo] Compiler failure during compilation of < BootstrapCL, Ljava/lang/Object; >.clone ()Ljava/lang/Object;
[echo] java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
[echo] at java.util.ArrayList.RangeCheck(ArrayList.java:547)
[echo] at java.util.ArrayList.get(ArrayList.java:322)
[echo] at org.jikesrvm.compilers.opt.util.DFSenumerateByFinish.hasMoreElements(DFSenumerateByFinish.java:72)
[echo] at org.jikesrvm.compilers.opt.util.GraphUtilities.enumerateTopSortInternal(GraphUtilities.java:50)
[echo] at org.jikesrvm.compilers.opt.util.GraphUtilities.enumerateTopSort(GraphUtilities.java:38)
[echo] at org.jikesrvm.compilers.opt.util.GraphUtilities.enumerateTopSort(GraphUtilities.java:34)
[echo] at org.jikesrvm.compilers.opt.dfsolver.DF_System.numberEquationsTopological(DF_System.java:420)
[echo] at org.jikesrvm.compilers.opt.dfsolver.DF_System.solve(DF_System.java:77)
[echo] at org.jikesrvm.compilers.opt.controlflow.Dominators.computeApproxPostdominators(Dominators.java:135)
[echo] at org.jikesrvm.compilers.opt.ssa.LICM.initialize(LICM.java:843)
[echo] at org.jikesrvm.compilers.opt.ssa.LICM.perform(LICM.java:114)
[echo] at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:209)
I can not understand what’s wrong with this.
Any response is helpful.
Thank you very much.
Chenxi Wang
------------------------------------------------------------------------------
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers