changeset 5292:796917d3bfc9

move cached graph eviction out of GraalCompiler
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 25 Apr 2012 11:33:47 +0200
parents 5dbc738b8e3e
children 60e658e50fce 1e3d4518813e
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java
diffstat 6 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Apr 25 11:33:47 2012 +0200
@@ -80,16 +80,6 @@
         if (osrBCI != -1) {
             throw new CiBailout("No OSR supported");
         }
-        if (cache != null) {
-            long[] deoptedGraphs = runtime.getDeoptedLeafGraphIds();
-            if (deoptedGraphs != null) {
-                if (deoptedGraphs.length == 0) {
-                    cache.clear();
-                } else {
-                    cache.removeGraphs(deoptedGraphs);
-                }
-            }
-        }
 
         return Debug.scope("GraalCompiler", new Object[] {graph, method, this}, new Callable<CiTargetMethod>() {
             public CiTargetMethod call() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Apr 25 11:33:47 2012 +0200
@@ -26,6 +26,7 @@
 
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
+import com.oracle.graal.cri.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.ri.*;
 import com.oracle.graal.nodes.*;
@@ -90,7 +91,6 @@
             if (GraalOptions.DynamicCompilePriority) {
                 int threadPriority = priority < GraalOptions.SlowQueueCutoff ? Thread.NORM_PRIORITY : Thread.MIN_PRIORITY;
                 if (Thread.currentThread().getPriority() != threadPriority) {
-    //                out.print(threadPriority);
                     Thread.currentThread().setPriority(threadPriority);
                 }
             }
@@ -118,6 +118,7 @@
 
                     @Override
                     public CiTargetMethod call() throws Exception {
+                        compiler.evictDeoptedGraphs();
                         StructuredGraph graph = new StructuredGraph(method);
                         return compiler.getCompiler().compileMethod(method, graph, -1, compiler.getCache(), plan, optimisticOpts);
                     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java	Wed Apr 25 11:33:47 2012 +0200
@@ -22,13 +22,12 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.graph.*;
-import com.oracle.graal.cri.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.ri.*;
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.cri.ri.*;
 
 public interface Compiler {
 
@@ -37,8 +36,9 @@
     GraalCompiler getCompiler();
     RiType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve);
     HotSpotVMConfig getConfig();
-    GraalRuntime getRuntime();
+    HotSpotRuntime getRuntime();
     CiTarget getTarget();
     GraphCache getCache();
+    void evictDeoptedGraphs();
 
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java	Wed Apr 25 11:33:47 2012 +0200
@@ -256,4 +256,17 @@
         }
         return runtime;
     }
+
+    public void evictDeoptedGraphs() {
+        if (cache != null) {
+            long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds();
+            if (deoptedGraphs != null) {
+                if (deoptedGraphs.length == 0) {
+                    cache.clear();
+                } else {
+                    cache.removeGraphs(deoptedGraphs);
+                }
+            }
+        }
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Wed Apr 25 11:33:47 2012 +0200
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.oracle.graal.compiler.*;
+import com.oracle.graal.compiler.graph.*;
 import com.oracle.graal.compiler.phases.*;
 import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition;
 import com.oracle.graal.compiler.target.*;
@@ -502,11 +503,6 @@
     }
 
     @Override
-    public long[] getDeoptedLeafGraphIds() {
-        return compiler.getCompilerToVM().getDeoptedLeafGraphIds();
-    }
-
-    @Override
     public int encodeDeoptActionAndReason(RiDeoptAction action, RiDeoptReason reason) {
         final int actionShift = 0;
         final int reasonShift = 3;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java	Wed Apr 25 11:33:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java	Wed Apr 25 11:33:47 2012 +0200
@@ -40,5 +40,4 @@
 
     CiTargetMethod compile(RiResolvedMethod method, StructuredGraph graph);
 
-    long[] getDeoptedLeafGraphIds();
 }