< prev index next >

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

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2021-01
Reviewed-by: martin

@@ -106,18 +106,19 @@
     public void accumulate(long x) {
         Cell[] cs; long b, v, r; int m; Cell c;
         if ((cs = cells) != null
             || ((r = function.applyAsLong(b = base, x)) != b
                 && !casBase(b, r))) {
+            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 =
                      (r = function.applyAsLong(v = c.value, x)) == v
                      || c.cas(v, r)))
-                longAccumulate(x, function, uncontended);
+                longAccumulate(x, function, uncontended, index);
         }
     }
 
     /**
      * Returns the current value.  The returned value is <em>NOT</em>
< prev index next >