1562 |
|
* Must be negative when shifted left by RESIZE_STAMP_SHIFT. |
1563 |
|
*/ |
1564 |
|
static final int resizeStamp(int n) { |
1565 |
< |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
1565 |
> |
return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1)); |
1566 |
|
} |
1567 |
|
|
1568 |
|
/** |
1626 |
|
int rs = resizeStamp(n); |
1627 |
|
if (sc < 0) { |
1628 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
1629 |
< |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
1630 |
< |
transferIndex <= 0) |
1629 |
> |
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
1630 |
> |
transferIndex <= 0) |
1631 |
|
break; |
1632 |
|
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) |
1633 |
|
transfer(tab, nt); |
1634 |
|
} |
1635 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
1636 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
1636 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
1637 |
|
transfer(tab, null); |
1638 |
|
s = sumCount(); |
1639 |
|
} |
1647 |
|
Node<K,V>[] nextTab; int sc; |
1648 |
|
if (tab != null && (f instanceof ForwardingNode) && |
1649 |
|
(nextTab = ((ForwardingNode<K,V>)f).nextTable) != null) { |
1650 |
< |
int rs = resizeStamp(tab.length); |
1650 |
> |
int rs = resizeStamp(tab.length); |
1651 |
|
while (nextTab == nextTable && table == tab && |
1652 |
< |
(sc = sizeCtl) < 0) { |
1653 |
< |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
1652 |
> |
(sc = sizeCtl) < 0) { |
1653 |
> |
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
1654 |
|
sc == rs + MAX_RESIZERS || transferIndex <= 0) |
1655 |
< |
break; |
1656 |
< |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
1655 |
> |
break; |
1656 |
> |
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { |
1657 |
|
transfer(tab, nextTab); |
1658 |
|
break; |
1659 |
|
} |
1694 |
|
else if (tab == table) { |
1695 |
|
int rs = resizeStamp(n); |
1696 |
|
if (sc < 0) { |
1697 |
< |
Node<K,V>[] nt; |
1697 |
> |
Node<K,V>[] nt; |
1698 |
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || |
1699 |
|
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || |
1700 |
|
transferIndex <= 0) |
1703 |
|
transfer(tab, nt); |
1704 |
|
} |
1705 |
|
else if (U.compareAndSwapInt(this, SIZECTL, sc, |
1706 |
< |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
1706 |
> |
(rs << RESIZE_STAMP_SHIFT) + 2)) |
1707 |
|
transfer(tab, null); |
1708 |
|
} |
1709 |
|
} |