changeset 8525:54f0a88e4523

Be a little bit more careful around compilation task queuing
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 27 Mar 2013 11:53:31 +0100
parents ecb2446232ac
children 3a105dec912f
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Mar 27 11:51:53 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Mar 27 11:53:31 2013 +0100
@@ -88,6 +88,10 @@
         return inProgress;
     }
 
+    public boolean isCancelled() {
+        return cancelled;
+    }
+
     public int getEntryBCI() {
         return entryBCI;
     }
@@ -106,10 +110,10 @@
                 }
             }
             runCompilation();
-            if (method.currentTask() == this && entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI) {
+        } finally {
+            if (method.currentTask() == this) {
                 method.setCurrentTask(null);
             }
-        } finally {
             inProgress = false;
             withinEnqueue.set(Boolean.TRUE);
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Mar 27 11:51:53 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Mar 27 11:53:31 2013 +0100
@@ -439,7 +439,7 @@
         if (osrCompilation && bootstrapRunning) {
             // no OSR compilations during bootstrap - the compiler is just too slow at this point,
             // and we know that there are no endless loops
-            return current != null;
+            return current != null && (current.isInProgress() || !current.isCancelled());
         }
 
         if (CompilationTask.withinEnqueue.get()) {
@@ -447,7 +447,7 @@
             // java.util.concurrent.BlockingQueue is used to implement the compilation worker
             // queues. If a compiler thread triggers a compilation, then it may be blocked trying
             // to add something to its own queue.
-            return current != null;
+            return current != null && (current.isInProgress() || !current.isCancelled());
         }
         CompilationTask.withinEnqueue.set(Boolean.TRUE);
 
@@ -464,7 +464,7 @@
                         // normally compilation tasks will only be re-queued when they get a
                         // priority boost, so cancel the old task and add a new one
                         current.cancel();
-                    } else {
+                    } else if (!current.isCancelled()) {
                         // without a prioritizing compile queue it makes no sense to re-queue the
                         // compilation task
                         return true;