ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/ForkJoinWorkerThread.java
(Generate patch)

Comparing jsr166/src/jsr166y/ForkJoinWorkerThread.java (file contents):
Revision 1.28 by dl, Mon Aug 3 13:40:07 2009 UTC vs.
Revision 1.30 by jsr166, Tue Oct 6 19:02:48 2009 UTC

# Line 90 | Line 90 | public class ForkJoinWorkerThread extend
90       * AtomicIntegers and AtomicReferenceArrays for the indices and
91       * array is significantly slower because of memory locality and
92       * indirection effects.)
93 <     *
93 >     *
94       * Further, performance on most platforms is very sensitive to
95       * placement and sizing of the (resizable) queue array.  Even
96       * though these queues don't usually become all that big, the
# Line 415 | Line 415 | public class ForkJoinWorkerThread extend
415  
416      // Intrinsics-based support for queue operations.
417  
418 +    private static long slotOffset(int i) {
419 +        return ((long) i << qShift) + qBase;
420 +    }
421 +
422      /**
423       * Adds in store-order the given task at given slot of q to null.
424       * Caller must ensure q is non-null and index is in range.
425       */
426      private static void setSlot(ForkJoinTask<?>[] q, int i,
427                                  ForkJoinTask<?> t) {
428 <        UNSAFE.putOrderedObject(q, (i << qShift) + qBase, t);
428 >        UNSAFE.putOrderedObject(q, slotOffset(i), t);
429      }
430  
431      /**
# Line 430 | Line 434 | public class ForkJoinWorkerThread extend
434       */
435      private static boolean casSlotNull(ForkJoinTask<?>[] q, int i,
436                                         ForkJoinTask<?> t) {
437 <        return UNSAFE.compareAndSwapObject(q, (i << qShift) + qBase, t, null);
437 >        return UNSAFE.compareAndSwapObject(q, slotOffset(i), t, null);
438      }
439  
440      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines