2188 |
|
* Must be negative when shifted left by RESIZE_STAMP_SHIFT. |
2189 |
|
*/ |
2190 |
|
static final int resizeStamp(int n) { |
2191 |
< |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
2191 |
> |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
2192 |
|
} |
2193 |
|
|
2194 |
|
/** |
2251 |
|
int rs = resizeStamp(n); |
2252 |
|
if (sc < 0) { |
2253 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2254 |
< |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2255 |
< |
transferIndex <= 0) |
2254 |
> |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2255 |
> |
transferIndex <= 0) |
2256 |
|
break; |
2257 |
|
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) |
2258 |
|
transfer(tab, nt); |
2259 |
|
} |
2260 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
2261 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2261 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2262 |
|
transfer(tab, null); |
2263 |
|
s = sumCount(); |
2264 |
|
} |
2272 |
|
Node<K,V>[] nextTab; int sc; |
2273 |
|
if (tab != null && (f instanceof ForwardingNode) && |
2274 |
|
(nextTab = ((ForwardingNode<K,V>)f).nextTable) != null) { |
2275 |
< |
int rs = resizeStamp(tab.length); |
2275 |
> |
int rs = resizeStamp(tab.length); |
2276 |
|
while (nextTab == nextTable && table == tab && |
2277 |
< |
(sc = sizeCtl) < 0) { |
2278 |
< |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2277 |
> |
(sc = sizeCtl) < 0) { |
2278 |
> |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2279 |
|
sc == rs + MAX_RESIZERS || transferIndex <= 0) |
2280 |
< |
break; |
2281 |
< |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
2280 |
> |
break; |
2281 |
> |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
2282 |
|
transfer(tab, nextTab); |
2283 |
|
break; |
2284 |
|
} |
2319 |
|
else if (tab == table) { |
2320 |
|
int rs = resizeStamp(n); |
2321 |
|
if (sc < 0) { |
2322 |
< |
Node<K,V>[] nt; |
2322 |
> |
Node<K,V>[] nt; |
2323 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2324 |
|
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2325 |
|
transferIndex <= 0) |
2328 |
|
transfer(tab, nt); |
2329 |
|
} |
2330 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
2331 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2331 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2332 |
|
transfer(tab, null); |
2333 |
|
} |
2334 |
|
} |