# HG changeset patch # User Doug Simon # Date 1336573263 -7200 # Node ID 7cf71c7961c667ec703967ab8e5438e15a69210b # Parent 67e63e8dcbd23c539ee341d58a682ab829552a18 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits diff -r 67e63e8dcbd2 -r 7cf71c7961c6 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Tue May 08 22:51:36 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed May 09 16:21:03 2012 +0200 @@ -160,8 +160,6 @@ } } - - /** * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths * that are otherwise not exercised during bootstrapping and lead to later deoptimization when application code is @@ -237,18 +235,27 @@ compileMethod((HotSpotMethodResolved) riMethod, 0, false, 10); } + private static void shutdownCompileQueue(ThreadPoolExecutor queue) throws InterruptedException { + if (queue != null) { + queue.shutdown(); + if (Debug.isEnabled() && GraalOptions.Dump != null) { + // Wait 5 seconds to try and flush out all graph dumps + queue.awaitTermination(5, TimeUnit.SECONDS); + } + } + } + public void shutdownCompiler() throws Throwable { try { assert !CompilationTask.withinEnqueue.get(); CompilationTask.withinEnqueue.set(Boolean.TRUE); - compileQueue.shutdown(); - if (slowCompileQueue != null) { - slowCompileQueue.shutdown(); - } + shutdownCompileQueue(compileQueue); + shutdownCompileQueue(slowCompileQueue); } finally { CompilationTask.withinEnqueue.set(Boolean.FALSE); } + if (Debug.isEnabled()) { List topLevelMaps = DebugValueMap.getTopLevelMaps(); List debugValues = KeyRegistry.getDebugValues();