diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-09-30 17:02:19 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-09-30 17:02:19 +0000 |
commit | efa181e5777fe72ce686bc8a3671b50fa3e601de (patch) | |
tree | be88e1584256506d3940b57839b21248bf8c6163 /src | |
parent | 4f62a386bbea074d39cf03967a76c1538a7c343d (diff) | |
download | scala-efa181e5777fe72ce686bc8a3671b50fa3e601de.tar.gz scala-efa181e5777fe72ce686bc8a3671b50fa3e601de.tar.bz2 scala-efa181e5777fe72ce686bc8a3671b50fa3e601de.zip |
Enabled 1.6 optimizations in ForkJoinPool.
Diffstat (limited to 'src')
3 files changed, 8 insertions, 14 deletions
diff --git a/src/library/scala/concurrent/forkjoin/ForkJoinPool.java b/src/library/scala/concurrent/forkjoin/ForkJoinPool.java index ba30f3a161..92ee56c961 100644 --- a/src/library/scala/concurrent/forkjoin/ForkJoinPool.java +++ b/src/library/scala/concurrent/forkjoin/ForkJoinPool.java @@ -12,10 +12,6 @@ import java.util.concurrent.atomic.*; import sun.misc.Unsafe; import java.lang.reflect.*; -interface RunnableFuture<T> extends Runnable { - //TR placeholder for java.util.concurrent.RunnableFuture -} - /** * An {@link ExecutorService} for running {@link ForkJoinTask}s. A * ForkJoinPool provides the entry point for submissions from @@ -61,7 +57,7 @@ interface RunnableFuture<T> extends Runnable { * pools with greater than the maximum result in * IllegalArgumentExceptions. */ -public class ForkJoinPool /*extends AbstractExecutorService*/ { +public class ForkJoinPool extends AbstractExecutorService { /* * See the extended comments interspersed below for design, @@ -1337,7 +1333,7 @@ public class ForkJoinPool /*extends AbstractExecutorService*/ { */ void awaitSyncRelease(ForkJoinPool p) { while (thread != null && !p.syncIsReleasable(this)) - LockSupport.park();//TR park(this); + LockSupport.park(this); } /** @@ -1346,7 +1342,7 @@ public class ForkJoinPool /*extends AbstractExecutorService*/ { void awaitSpareRelease() { while (thread != null) { if (!Thread.interrupted()) - LockSupport.park();//TR park(this); + LockSupport.park(this); } } } diff --git a/src/library/scala/concurrent/forkjoin/ForkJoinWorkerThread.java b/src/library/scala/concurrent/forkjoin/ForkJoinWorkerThread.java index 941f5ec0cb..b4d889750c 100644 --- a/src/library/scala/concurrent/forkjoin/ForkJoinWorkerThread.java +++ b/src/library/scala/concurrent/forkjoin/ForkJoinWorkerThread.java @@ -405,8 +405,7 @@ public class ForkJoinWorkerThread extends Thread { */ private static void setSlot(ForkJoinTask<?>[] q, int i, ForkJoinTask<?> t){ -//TR _unsafe.putOrderedObject(q, (i << qShift) + qBase, t); - _unsafe.putObjectVolatile((Object)q, (i << qShift) + qBase, (Object)t); + _unsafe.putOrderedObject(q, (i << qShift) + qBase, t); } /** @@ -422,8 +421,7 @@ public class ForkJoinWorkerThread extends Thread { * Sets sp in store-order. */ private void storeSp(int s) { -//TR _unsafe.putOrderedInt(this, spOffset, s); - _unsafe.putIntVolatile(this, spOffset, s); + _unsafe.putOrderedInt(this, spOffset, s); } // Main queue methods diff --git a/src/library/scala/concurrent/forkjoin/LinkedTransferQueue.java b/src/library/scala/concurrent/forkjoin/LinkedTransferQueue.java index 3055e3b68f..3b46c176ff 100644 --- a/src/library/scala/concurrent/forkjoin/LinkedTransferQueue.java +++ b/src/library/scala/concurrent/forkjoin/LinkedTransferQueue.java @@ -121,7 +121,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E> } final void clearNext() { - nextUpdater.set(this,this);//TR;lazySet(this, this); + nextUpdater.lazySet(this, this); } } @@ -304,12 +304,12 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E> else if (s.waiter == null) s.waiter = w; else if (mode != TIMEOUT) { - LockSupport.park();//TR(this); + LockSupport.park(this); s.waiter = null; spins = -1; } else if (nanos > spinForTimeoutThreshold) { - LockSupport.parkNanos(nanos);//(this, nanos); + LockSupport.parkNanos(this, nanos); s.waiter = null; spins = -1; } |