1006 |
|
private static final int ABASE; |
1007 |
|
private static final int ASHIFT; |
1008 |
|
static { |
1009 |
– |
int s; |
1009 |
|
try { |
1010 |
|
U = sun.misc.Unsafe.getUnsafe(); |
1011 |
|
Class<?> k = WorkQueue.class; |
1013 |
|
QLOCK = U.objectFieldOffset |
1014 |
|
(k.getDeclaredField("qlock")); |
1015 |
|
ABASE = U.arrayBaseOffset(ak); |
1016 |
< |
s = U.arrayIndexScale(ak); |
1016 |
> |
int scale = U.arrayIndexScale(ak); |
1017 |
> |
if ((scale & (scale - 1)) != 0) |
1018 |
> |
throw new Error("data type scale not a power of two"); |
1019 |
> |
ASHIFT = 31 - Integer.numberOfLeadingZeros(scale); |
1020 |
|
} catch (Exception e) { |
1021 |
|
throw new Error(e); |
1022 |
|
} |
1021 |
– |
if ((s & (s-1)) != 0) |
1022 |
– |
throw new Error("data type scale not a power of two"); |
1023 |
– |
ASHIFT = 31 - Integer.numberOfLeadingZeros(s); |
1023 |
|
} |
1024 |
|
} |
1025 |
|
|
3285 |
|
private static final long QLOCK; |
3286 |
|
|
3287 |
|
static { |
3288 |
< |
int s; // initialize field offsets for CAS etc |
3288 |
> |
// initialize field offsets for CAS etc |
3289 |
|
try { |
3290 |
|
U = sun.misc.Unsafe.getUnsafe(); |
3291 |
|
Class<?> k = ForkJoinPool.class; |
3305 |
|
(wk.getDeclaredField("qlock")); |
3306 |
|
Class<?> ak = ForkJoinTask[].class; |
3307 |
|
ABASE = U.arrayBaseOffset(ak); |
3308 |
< |
s = U.arrayIndexScale(ak); |
3309 |
< |
ASHIFT = 31 - Integer.numberOfLeadingZeros(s); |
3308 |
> |
int scale = U.arrayIndexScale(ak); |
3309 |
> |
if ((scale & (scale - 1)) != 0) |
3310 |
> |
throw new Error("data type scale not a power of two"); |
3311 |
> |
ASHIFT = 31 - Integer.numberOfLeadingZeros(scale); |
3312 |
|
} catch (Exception e) { |
3313 |
|
throw new Error(e); |
3314 |
|
} |
3314 |
– |
if ((s & (s-1)) != 0) |
3315 |
– |
throw new Error("data type scale not a power of two"); |
3315 |
|
|
3316 |
|
ForkJoinWorkerThreadFactory fac = defaultForkJoinWorkerThreadFactory = |
3317 |
|
new DefaultForkJoinWorkerThreadFactory(); |