2218 |
|
* Must be negative when shifted left by RESIZE_STAMP_SHIFT. |
2219 |
|
*/ |
2220 |
|
static final int resizeStamp(int n) { |
2221 |
< |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
2221 |
> |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
2222 |
|
} |
2223 |
|
|
2224 |
|
/** |
2282 |
|
int rs = resizeStamp(n); |
2283 |
|
if (sc < 0) { |
2284 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2285 |
< |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2286 |
< |
transferIndex <= 0) |
2285 |
> |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2286 |
> |
transferIndex <= 0) |
2287 |
|
break; |
2288 |
|
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) |
2289 |
|
transfer(tab, nt); |
2290 |
|
} |
2291 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
2292 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2292 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2293 |
|
transfer(tab, null); |
2294 |
|
s = sumCount(); |
2295 |
|
} |
2303 |
|
Node<K,V>[] nextTab; int sc; |
2304 |
|
if (tab != null && (f instanceof ForwardingNode) && |
2305 |
|
(nextTab = ((ForwardingNode<K,V>)f).nextTable) != null) { |
2306 |
< |
int rs = resizeStamp(tab.length); |
2306 |
> |
int rs = resizeStamp(tab.length); |
2307 |
|
while (nextTab == nextTable && table == tab && |
2308 |
< |
(sc = sizeCtl) < 0) { |
2309 |
< |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2308 |
> |
(sc = sizeCtl) < 0) { |
2309 |
> |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2310 |
|
sc == rs + MAX_RESIZERS || transferIndex <= 0) |
2311 |
< |
break; |
2312 |
< |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
2311 |
> |
break; |
2312 |
> |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
2313 |
|
transfer(tab, nextTab); |
2314 |
|
break; |
2315 |
|
} |
2350 |
|
else if (tab == table) { |
2351 |
|
int rs = resizeStamp(n); |
2352 |
|
if (sc < 0) { |
2353 |
< |
Node<K,V>[] nt; |
2353 |
> |
Node<K,V>[] nt; |
2354 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
2355 |
|
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
2356 |
|
transferIndex <= 0) |
2359 |
|
transfer(tab, nt); |
2360 |
|
} |
2361 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
2362 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2362 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
2363 |
|
transfer(tab, null); |
2364 |
|
} |
2365 |
|
} |
2533 |
|
} |
2534 |
|
} |
2535 |
|
} |
2536 |
+ |
|
2537 |
|
/** |
2538 |
|
* Returns a list on non-TreeNodes replacing those in given list. |
2539 |
|
*/ |