# HG changeset patch # User Gilles Duboscq # Date 1364381611 -3600 # Node ID 54f0a88e45236060951c95cb6a330d822196a3c8 # Parent ecb2446232ac67671a0cb25170b7c8158dd8fea2 Be a little bit more careful around compilation task queuing diff -r ecb2446232ac -r 54f0a88e4523 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 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); } diff -r ecb2446232ac -r 54f0a88e4523 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 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;