--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2013/12/01 16:08:12 1.118 +++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2013/12/01 16:56:07 1.119 @@ -2218,7 +2218,7 @@ public class ConcurrentHashMapV8 ex * Must be negative when shifted left by RESIZE_STAMP_SHIFT. */ static final int resizeStamp(int n) { - return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); + return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); } /** @@ -2282,14 +2282,14 @@ public class ConcurrentHashMapV8 ex int rs = resizeStamp(n); if (sc < 0) { if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || - sc == rs + MAX_RESIZERS || (nt = nextTable) == null || - transferIndex <= 0) + sc == rs + MAX_RESIZERS || (nt = nextTable) == null || + transferIndex <= 0) break; if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) transfer(tab, nt); } else if (U.compareAndSwapInt(this, SIZECTL, sc, - (rs << RESIZE_STAMP_SHIFT) + 2)) + (rs << RESIZE_STAMP_SHIFT) + 2)) transfer(tab, null); s = sumCount(); } @@ -2303,13 +2303,13 @@ public class ConcurrentHashMapV8 ex Node[] nextTab; int sc; if (tab != null && (f instanceof ForwardingNode) && (nextTab = ((ForwardingNode)f).nextTable) != null) { - int rs = resizeStamp(tab.length); + int rs = resizeStamp(tab.length); while (nextTab == nextTable && table == tab && - (sc = sizeCtl) < 0) { - if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || + (sc = sizeCtl) < 0) { + if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || sc == rs + MAX_RESIZERS || transferIndex <= 0) - break; - if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { + break; + if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { transfer(tab, nextTab); break; } @@ -2350,7 +2350,7 @@ public class ConcurrentHashMapV8 ex else if (tab == table) { int rs = resizeStamp(n); if (sc < 0) { - Node[] nt; + Node[] nt; if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || sc == rs + MAX_RESIZERS || (nt = nextTable) == null || transferIndex <= 0) @@ -2359,7 +2359,7 @@ public class ConcurrentHashMapV8 ex transfer(tab, nt); } else if (U.compareAndSwapInt(this, SIZECTL, sc, - (rs << RESIZE_STAMP_SHIFT) + 2)) + (rs << RESIZE_STAMP_SHIFT) + 2)) transfer(tab, null); } } @@ -2533,6 +2533,7 @@ public class ConcurrentHashMapV8 ex } } } + /** * Returns a list on non-TreeNodes replacing those in given list. */