ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/ConcurrentHashMapV8.java
(Generate patch)

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.118 by dl, Sun Dec 1 16:08:12 2013 UTC vs.
Revision 1.119 by jsr166, Sun Dec 1 16:56:07 2013 UTC

# Line 2218 | Line 2218 | public class ConcurrentHashMapV8<K,V> ex
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      /**
# Line 2282 | Line 2282 | public class ConcurrentHashMapV8<K,V> ex
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              }
# Line 2303 | Line 2303 | public class ConcurrentHashMapV8<K,V> ex
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                  }
# Line 2350 | Line 2350 | public class ConcurrentHashMapV8<K,V> ex
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)
# Line 2359 | Line 2359 | public class ConcurrentHashMapV8<K,V> ex
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          }
# Line 2533 | Line 2533 | public class ConcurrentHashMapV8<K,V> ex
2533              }
2534          }
2535      }
2536 +
2537      /**
2538       * Returns a list on non-TreeNodes replacing those in given list.
2539       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines