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

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

# Line 2188 | Line 2188 | public class ConcurrentHashMap<K,V> exte
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      /**
# Line 2251 | Line 2251 | public class ConcurrentHashMap<K,V> exte
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              }
# Line 2272 | Line 2272 | public class ConcurrentHashMap<K,V> exte
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                  }
# Line 2319 | Line 2319 | public class ConcurrentHashMap<K,V> exte
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)
# Line 2328 | Line 2328 | public class ConcurrentHashMap<K,V> exte
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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines