413 |
|
|
414 |
|
// Intrinsics-based support for queue operations. |
415 |
|
|
416 |
+ |
private static long slotOffset(int i) { |
417 |
+ |
return ((long) i << qShift) + qBase; |
418 |
+ |
} |
419 |
+ |
|
420 |
|
/** |
421 |
|
* Adds in store-order the given task at given slot of q to null. |
422 |
|
* Caller must ensure q is non-null and index is in range. |
423 |
|
*/ |
424 |
|
private static void setSlot(ForkJoinTask<?>[] q, int i, |
425 |
|
ForkJoinTask<?> t) { |
426 |
< |
UNSAFE.putOrderedObject(q, (i << qShift) + qBase, t); |
426 |
> |
UNSAFE.putOrderedObject(q, slotOffset(i), t); |
427 |
|
} |
428 |
|
|
429 |
|
/** |
432 |
|
*/ |
433 |
|
private static boolean casSlotNull(ForkJoinTask<?>[] q, int i, |
434 |
|
ForkJoinTask<?> t) { |
435 |
< |
return UNSAFE.compareAndSwapObject(q, (i << qShift) + qBase, t, null); |
435 |
> |
return UNSAFE.compareAndSwapObject(q, slotOffset(i), t, null); |
436 |
|
} |
437 |
|
|
438 |
|
/** |