changeset 5290:82e606f9ba69

add RiGraphCache interface
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 25 Apr 2012 11:24:49 +0200
parents 6519cf82d390
children 5dbc738b8e3e
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/graph/GraphCache.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java
diffstat 4 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);
--- 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;
--- 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<? extends Invoke> hints, CiAssumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) {
+    public InliningPhase(CiTarget target, GraalRuntime runtime, Collection<? extends Invoke> hints, CiAssumptions assumptions, RiGraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) {
         this.target = target;
         this.runtime = runtime;
         this.hints = hints;