671 |
|
* arrays sharing cache lines. The @Contended annotation alerts |
672 |
|
* JVMs to try to keep instances apart. |
673 |
|
*/ |
674 |
< |
// For now, using manual padding. |
675 |
< |
// @jdk.internal.vm.annotation.Contended |
676 |
< |
// @sun.misc.Contended |
674 |
> |
@jdk.internal.vm.annotation.Contended |
675 |
|
static final class WorkQueue { |
676 |
|
|
677 |
|
/** |
695 |
|
static final int MAXIMUM_QUEUE_CAPACITY = 1 << 26; // 64M |
696 |
|
|
697 |
|
// Instance fields |
700 |
– |
volatile long pad00, pad01, pad02, pad03, pad04, pad05, pad06, pad07; |
701 |
– |
volatile long pad08, pad09, pad0a, pad0b, pad0c, pad0d, pad0e, pad0f; |
698 |
|
volatile int phase; // versioned, negative: queued, 1: locked |
699 |
|
int stackPred; // pool stack (ctl) predecessor link |
700 |
|
int nsteals; // number of steals |
705 |
|
ForkJoinTask<?>[] array; // the elements (initially unallocated) |
706 |
|
final ForkJoinPool pool; // the containing pool (may be null) |
707 |
|
final ForkJoinWorkerThread owner; // owning thread or null if shared |
712 |
– |
volatile Object pad10, pad11, pad12, pad13, pad14, pad15, pad16, pad17; |
713 |
– |
volatile Object pad18, pad19, pad1a, pad1b, pad1c, pad1d, pad1e, pad1f; |
708 |
|
|
709 |
|
WorkQueue(ForkJoinPool pool, ForkJoinWorkerThread owner) { |
710 |
|
this.pool = pool; |
1263 |
|
|
1264 |
|
// Instance fields |
1265 |
|
|
1272 |
– |
// Segregate ctl field, For now using padding vs @Contended |
1273 |
– |
// @jdk.internal.vm.annotation.Contended("fjpctl") |
1274 |
– |
// @sun.misc.Contended("fjpctl") |
1275 |
– |
volatile long pad00, pad01, pad02, pad03, pad04, pad05, pad06, pad07; |
1276 |
– |
volatile long pad08, pad09, pad0a, pad0b, pad0c, pad0d, pad0e, pad0f; |
1277 |
– |
volatile long ctl; // main pool control |
1278 |
– |
volatile long pad10, pad11, pad12, pad13, pad14, pad15, pad16, pad17; |
1279 |
– |
volatile long pad18, pad19, pad1a, pad1b, pad1c, pad1d, pad1e; |
1280 |
– |
|
1266 |
|
volatile long stealCount; // collects worker nsteals |
1267 |
|
final long keepAlive; // milliseconds before dropping if idle |
1268 |
|
int indexSeed; // next worker index |
1274 |
|
final UncaughtExceptionHandler ueh; // per-worker UEH |
1275 |
|
final Predicate<? super ForkJoinPool> saturate; |
1276 |
|
|
1277 |
+ |
@jdk.internal.vm.annotation.Contended("fjpctl") // segregate |
1278 |
+ |
volatile long ctl; // main pool control |
1279 |
+ |
|
1280 |
|
// Creating, registering and deregistering workers |
1281 |
|
|
1282 |
|
/** |