# HG changeset patch # User Lukas Stadler # Date 1335346427 -7200 # Node ID 796917d3bfc92707bda7291d7a3e9e2dd8ba6a22 # Parent 5dbc738b8e3e244a653fb497b7d61c1d502cb935 move cached graph eviction out of GraalCompiler diff -r 5dbc738b8e3e -r 796917d3bfc9 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 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() { public CiTargetMethod call() { diff -r 5dbc738b8e3e -r 796917d3bfc9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- 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); } diff -r 5dbc738b8e3e -r 796917d3bfc9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java --- 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(); } diff -r 5dbc738b8e3e -r 796917d3bfc9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java --- 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); + } + } + } + } } diff -r 5dbc738b8e3e -r 796917d3bfc9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- 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; diff -r 5dbc738b8e3e -r 796917d3bfc9 graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java --- 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(); }