changeset 10826:1eee97b26bb6

Truffle: Added early read elimination to TruffleCache.
author Christian Humer <christian.humer@gmail.com>
date Sat, 20 Jul 2013 10:57:13 +0200
parents 081eac3646d5
children da9d33c7b6de
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Sat Jul 20 10:52:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Sat Jul 20 10:57:13 2013 +0200
@@ -107,6 +107,7 @@
                     }
 
                     Assumptions tmpAssumptions = new Assumptions(false);
+
                     optimizeGraph(newGraph, tmpAssumptions);
 
                     HighTierContext context = new HighTierContext(metaAccessProvider, tmpAssumptions, replacements);
@@ -153,9 +154,11 @@
 
         CanonicalizerPhase.Instance canonicalizerPhase = new CanonicalizerPhase.Instance(metaAccessProvider, assumptions, !AOTCompilation.getValue(), null, null);
 
+        EarlyReadEliminationPhase earlyRead = new EarlyReadEliminationPhase(new CanonicalizerPhase(true));
+        HighTierContext context = new HighTierContext(metaAccessProvider, assumptions, replacements);
         Integer maxNodes = TruffleCompilerOptions.TruffleOperationCacheMaxNodes.getValue();
 
-        contractGraph(newGraph, eliminate, convertDeoptimizeToGuardPhase, canonicalizerPhase);
+        contractGraph(newGraph, eliminate, convertDeoptimizeToGuardPhase, canonicalizerPhase, earlyRead, context);
 
         while (newGraph.getNodeCount() <= maxNodes) {
 
@@ -168,7 +171,7 @@
                 break;
             }
 
-            contractGraph(newGraph, eliminate, convertDeoptimizeToGuardPhase, canonicalizerPhase);
+            contractGraph(newGraph, eliminate, convertDeoptimizeToGuardPhase, canonicalizerPhase, earlyRead, context);
         }
 
         if (newGraph.getNodeCount() > maxNodes && (TruffleCompilerOptions.TraceTruffleCacheDetails.getValue() || TruffleCompilerOptions.TraceTrufflePerformanceWarnings.getValue())) {
@@ -177,10 +180,13 @@
     }
 
     private static void contractGraph(StructuredGraph newGraph, ConditionalEliminationPhase eliminate, ConvertDeoptimizeToGuardPhase convertDeoptimizeToGuardPhase,
-                    CanonicalizerPhase.Instance canonicalizerPhase) {
+                    CanonicalizerPhase.Instance canonicalizerPhase, EarlyReadEliminationPhase earlyRead, HighTierContext context) {
         // Canonicalize / constant propagate.
         canonicalizerPhase.apply(newGraph);
 
+        // Early read eliminiation
+        earlyRead.apply(newGraph, context);
+
         // Convert deopt to guards.
         convertDeoptimizeToGuardPhase.apply(newGraph);