--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2013/01/18 04:23:27 1.88 +++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2013/01/28 17:27:03 1.92 @@ -1785,8 +1785,10 @@ public class ConcurrentHashMapV8 } } if (len != 0) { - if (len > 1) + if (len > 1) { addCount(delta, len); + delta = 0L; + } break; } } @@ -1975,7 +1977,7 @@ public class ConcurrentHashMapV8 } } - /* + /** * Moves and/or copies the nodes in each bin to new table. See * above for explanation. */ @@ -3371,7 +3373,7 @@ public class ConcurrentHashMapV8 * of each (key, value). * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -3415,7 +3417,7 @@ public class ConcurrentHashMapV8 * combine values, or null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -3528,7 +3530,7 @@ public class ConcurrentHashMapV8 * of each key. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -3593,7 +3595,7 @@ public class ConcurrentHashMapV8 * null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -3706,7 +3708,7 @@ public class ConcurrentHashMapV8 * of each value. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). */ public void forEachValueSequentially @@ -3766,7 +3768,7 @@ public class ConcurrentHashMapV8 * null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -3880,7 +3882,7 @@ public class ConcurrentHashMapV8 * of each entry. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -3943,7 +3945,7 @@ public class ConcurrentHashMapV8 * or null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -4055,7 +4057,7 @@ public class ConcurrentHashMapV8 * of each (key, value). * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -4090,7 +4092,7 @@ public class ConcurrentHashMapV8 * combine values, or null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -4178,7 +4180,7 @@ public class ConcurrentHashMapV8 * of each key. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -4227,7 +4229,7 @@ public class ConcurrentHashMapV8 * null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -4315,7 +4317,7 @@ public class ConcurrentHashMapV8 * of each value. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). */ public void forEachValueInParallel @@ -4362,7 +4364,7 @@ public class ConcurrentHashMapV8 * null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -4450,7 +4452,7 @@ public class ConcurrentHashMapV8 * of each entry. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case the action is not applied). * @param action the action */ @@ -4498,7 +4500,7 @@ public class ConcurrentHashMapV8 * or null if none. * * @param transformer a function returning the transformation - * for an element, or null of there is no transformation (in + * for an element, or null if there is no transformation (in * which case it is not combined). * @param reducer a commutative associative combining function * @return the result of accumulating the given transformation @@ -6804,7 +6806,6 @@ public class ConcurrentHashMapV8 private static final int ASHIFT; static { - int ss; try { U = getUnsafe(); Class k = ConcurrentHashMapV8.class; @@ -6823,13 +6824,13 @@ public class ConcurrentHashMapV8 (ck.getDeclaredField("value")); Class sc = Node[].class; ABASE = U.arrayBaseOffset(sc); - ss = U.arrayIndexScale(sc); - ASHIFT = 31 - Integer.numberOfLeadingZeros(ss); + int scale = U.arrayIndexScale(sc); + 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 ((ss & (ss-1)) != 0) - throw new Error("data type scale not a power of two"); } /**