ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jdk7/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/jdk7/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.37 by dl, Sun Dec 1 16:08:16 2013 UTC vs.
Revision 1.38 by jsr166, Sun Dec 1 16:56:07 2013 UTC

# Line 1562 | Line 1562 | public class ConcurrentHashMap<K,V> impl
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      /**
# Line 1626 | Line 1626 | public class ConcurrentHashMap<K,V> impl
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              }
# Line 1647 | Line 1647 | public class ConcurrentHashMap<K,V> impl
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                  }
# Line 1694 | Line 1694 | public class ConcurrentHashMap<K,V> impl
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)
# Line 1703 | Line 1703 | public class ConcurrentHashMap<K,V> impl
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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines