< prev index next >

src/java.base/share/classes/java/util/concurrent/atomic/DoubleAdder.java

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2020-06
Reviewed-by: martin

@@ -90,17 +90,18 @@
         Cell[] cs; long b, v; int m; Cell c;
         if ((cs = cells) != null ||
             !casBase(b = base,
                      Double.doubleToRawLongBits
                      (Double.longBitsToDouble(b) + x))) {
+            int index = getProbe();
             boolean uncontended = true;
             if (cs == null || (m = cs.length - 1) < 0 ||
-                (c = cs[getProbe() & m]) == null ||
+                (c = cs[index & m]) == null ||
                 !(uncontended = c.cas(v = c.value,
                                       Double.doubleToRawLongBits
                                       (Double.longBitsToDouble(v) + x))))
-                doubleAccumulate(x, null, uncontended);
+                doubleAccumulate(x, null, uncontended, index);
         }
     }
 
     /**
      * Returns the current sum.  The returned value is <em>NOT</em> an
< prev index next >