# HG changeset patch # User Christian Humer # Date 1374310633 -7200 # Node ID 1eee97b26bb62e1f422c5376a5721e187c61456b # Parent 081eac3646d5f79dab8ff89fd352da030695c096 Truffle: Added early read elimination to TruffleCache. diff -r 081eac3646d5 -r 1eee97b26bb6 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- 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);