Optimizations (in Simple.java)
- // Compute defList, useList, useCount fields for each register.
DefUse.computeDU(ir); - // Recompute isSSA flags
DefUse.recomputeSSA(ir); - / Simple copy propagation.
// This pass incrementally updates the register list.
copyPropagation(ir); - // Simple type propagation.
// This pass uses the register list, but doesn't modify it.
if (typeProp) {
typePropagation(ir);
} - // Perform simple bounds-check and arraylength elimination.
// This pass incrementally updates the register list
if (foldChecks) {
arrayPropagation(ir);
} - // Simple dead code elimination.
// This pass incrementally updates the register list
eliminateDeadInstructions(ir); - // constant folding
// This pass usually doesn't modify the DU, but
// if it does it will recompute it.
foldConstants(ir);
// Simple local expression folding respecting DU
if (ir.options.LOCAL_EXPRESSION_FOLDING && ExpressionFolding.performLocal(ir)) {
// constant folding again
foldConstants(ir);
} - // Try to remove conditional branches with constant operands
// If it actually constant folds a branch,
// this pass will recompute the DU
if (foldBranches) {
simplifyConstantBranches(ir);
} - // Should we sort commutative use operands
if (sortRegisters) {
sortCommutativeRegisterUses(ir);
}
Next We add Timer Code, Make a Method Size API call, Make A Method Name API Call
Timer:
startTime = System.nanoTime();
DefUse.computeDU(ir);
EndTime = System.nanoTime();
Method Name and Method Size:
final int methodinstructionSize = ir.numberInstructions();
try{ //Debug Execution Time output
// Create file
FileWriter fstream = new FileWriter("computeDUmethodExecutionTime.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write("\nExecution Time: " + (EndTime - startTime) + " nano Seconds" + " Instructs: " + methodinstructionSize + " Method: " + ir.getMethod().getName().toString());
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
./rvm -classpath dacapo-2006-10-MR2.jar Harness fop
We are left with ASCII files for each individual optimization containing data on Method Size, Method Execution Time, and Name
Execution Time: 21200 nano Seconds Instructs: 37 Method: stringToGlyph
Execution Time: 13520 nano Seconds Instructs: 53 Method: scanDigits
Execution Time: 17480 nano Seconds Instructs: 72 Method: getExplicit
Execution Time: 108801 nano Seconds Instructs: 508 Method: getShorthand
Graphs (Size vs Time)
Array Propagation
computeDU
copyPropagation
eliminateDeadInstructions
recomputeSSA
sortRegisters
typePropagation
[1] http://jikesrvm.svn.sourceforge.net/viewvc/jikesrvm/rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simple.java?revision=16061&view=markup
No comments:
Post a Comment