--- jsr166/src/jsr166y/ForkJoinPool.java 2013/01/13 21:56:12 1.174 +++ jsr166/src/jsr166y/ForkJoinPool.java 2013/01/19 20:39:43 1.175 @@ -1026,7 +1026,6 @@ public class ForkJoinPool extends Abstra private static final int ABASE; private static final int ASHIFT; static { - int s; try { U = getUnsafe(); Class k = WorkQueue.class; @@ -1034,13 +1033,13 @@ public class ForkJoinPool extends Abstra QLOCK = U.objectFieldOffset (k.getDeclaredField("qlock")); ABASE = U.arrayBaseOffset(ak); - s = U.arrayIndexScale(ak); + int scale = U.arrayIndexScale(ak); + if ((scale & (scale - 1)) != 0) + throw new Error("data type scale not a power of two"); + ASHIFT = 31 - Integer.numberOfLeadingZeros(scale); } catch (Exception e) { throw new Error(e); } - if ((s & (s-1)) != 0) - throw new Error("data type scale not a power of two"); - ASHIFT = 31 - Integer.numberOfLeadingZeros(s); } } @@ -3330,7 +3329,7 @@ public class ForkJoinPool extends Abstra private static final long QLOCK; static { - int s; // initialize field offsets for CAS etc + // initialize field offsets for CAS etc try { U = getUnsafe(); Class k = ForkJoinPool.class; @@ -3350,13 +3349,13 @@ public class ForkJoinPool extends Abstra (wk.getDeclaredField("qlock")); Class ak = ForkJoinTask[].class; ABASE = U.arrayBaseOffset(ak); - s = U.arrayIndexScale(ak); - ASHIFT = 31 - Integer.numberOfLeadingZeros(s); + int scale = U.arrayIndexScale(ak); + if ((scale & (scale - 1)) != 0) + throw new Error("data type scale not a power of two"); + ASHIFT = 31 - Integer.numberOfLeadingZeros(scale); } catch (Exception e) { throw new Error(e); } - if ((s & (s-1)) != 0) - throw new Error("data type scale not a power of two"); submitters = new ThreadLocal(); ForkJoinWorkerThreadFactory fac = defaultForkJoinWorkerThreadFactory =