Mercurial > hg > graal-compiler
changeset 14084:40fac3ef157d
fix queue code
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 05 Mar 2014 21:13:51 -0800 |
parents | 1b84e499127b |
children | af84c0b2e74f |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed Mar 05 16:22:42 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed Mar 05 21:13:51 2014 -0800 @@ -104,6 +104,13 @@ } } + public long getTaskCount() { + try (CompilationTask.BeginEnqueue beginEnqueue = new CompilationTask.BeginEnqueue()) { + // Don't allow new enqueues while reading the state of queue. + return executor.getTaskCount(); + } + } + public void execute(CompilationTask task) { // The caller is expected to have set the within enqueue state. assert CompilationTask.isWithinEnqueue(); @@ -118,6 +125,11 @@ executor.awaitTermination(2, TimeUnit.SECONDS); } } + + @Override + public String toString() { + return executor.toString(); + } } private volatile boolean bootstrapRunning; @@ -282,7 +294,7 @@ // Compile until the queue is empty. int z = 0; while (true) { - if (compileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getCompletedTaskCount())) { + if (compileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getTaskCount())) { break; }