# HG changeset patch # User Lukas Stadler # Date 1335345889 -7200 # Node ID 82e606f9ba699bb9bda2e3e4a2fdcb6a67f20247 # Parent 6519cf82d39028776a1370ba5d065242b994921b add RiGraphCache interface diff -r 6519cf82d390 -r 82e606f9ba69 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Apr 24 18:13:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Apr 25 11:24:49 2012 +0200 @@ -75,7 +75,7 @@ } - public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { + public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, final RiGraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { assert (method.accessFlags() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; if (osrBCI != -1) { throw new CiBailout("No OSR supported"); @@ -116,7 +116,7 @@ /** * Builds the graph, optimizes it. */ - public LIR emitHIR(StructuredGraph graph, CiAssumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { + public LIR emitHIR(StructuredGraph graph, CiAssumptions assumptions, RiGraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { if (graph.start().next() == null) { plan.runPhases(PhasePosition.AFTER_PARSING, graph); diff -r 6519cf82d390 -r 82e606f9ba69 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/graph/GraphCache.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/graph/GraphCache.java Tue Apr 24 18:13:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/graph/GraphCache.java Wed Apr 25 11:24:49 2012 +0200 @@ -29,10 +29,12 @@ import java.util.concurrent.atomic.*; import com.oracle.graal.compiler.*; +import com.oracle.graal.cri.*; import com.oracle.graal.nodes.*; import com.oracle.max.cri.ri.*; -public class GraphCache { +public class GraphCache implements RiGraphCache { + private static final PrintStream out = System.out; private final boolean dump; private boolean enabled = true; @@ -89,6 +91,7 @@ enabled = true; } + @Override public StructuredGraph get(RiResolvedMethod method) { if (!enabled) { return null; @@ -114,6 +117,7 @@ return result; } + @Override public void put(StructuredGraph graph) { if (!enabled) { return; @@ -134,6 +138,7 @@ } } + @Override public void clear() { graphs.clear(); currentGraphIds.clear(); @@ -145,6 +150,7 @@ putCounter.set(0); } + @Override public void removeGraphs(long[] deoptedGraphs) { for (long graphId : deoptedGraphs) { graphs.remove(graphId); diff -r 6519cf82d390 -r 82e606f9ba69 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java Tue Apr 24 18:13:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java Wed Apr 25 11:24:49 2012 +0200 @@ -239,11 +239,11 @@ private final CiTarget target; private final GraalRuntime runtime; private final CiAssumptions assumptions; - private final GraphCache cache; + private final RiGraphCache cache; private final PhasePlan plan; private final OptimisticOptimizations optimisticOpts; - public EscapeAnalysisPhase(CiTarget target, GraalRuntime runtime, CiAssumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { + public EscapeAnalysisPhase(CiTarget target, GraalRuntime runtime, CiAssumptions assumptions, RiGraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { this.runtime = runtime; this.target = target; this.assumptions = assumptions; diff -r 6519cf82d390 -r 82e606f9ba69 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java Tue Apr 24 18:13:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java Wed Apr 25 11:24:49 2012 +0200 @@ -57,7 +57,7 @@ private CiAssumptions assumptions; private final PhasePlan plan; - private final GraphCache cache; + private final RiGraphCache cache; private final WeightComputationPolicy weightComputationPolicy; private final InliningPolicy inliningPolicy; private final OptimisticOptimizations optimisticOpts; @@ -67,7 +67,7 @@ private static final DebugMetric metricInliningConsidered = Debug.metric("InliningConsidered"); private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize"); - public InliningPhase(CiTarget target, GraalRuntime runtime, Collection hints, CiAssumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { + public InliningPhase(CiTarget target, GraalRuntime runtime, Collection hints, CiAssumptions assumptions, RiGraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { this.target = target; this.runtime = runtime; this.hints = hints;