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 |
|
/** |
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 |
|
/** |