< prev index next >
src/java.base/share/classes/java/util/concurrent/atomic/DoubleAdder.java
Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2021-01
Reviewed-by: martin
*** 90,106 ****
Cell[] cs; long b, v; int m; Cell c;
if ((cs = cells) != null ||
!casBase(b = base,
Double.doubleToRawLongBits
(Double.longBitsToDouble(b) + x))) {
boolean uncontended = true;
if (cs == null || (m = cs.length - 1) < 0 ||
! (c = cs[getProbe() & m]) == null ||
!(uncontended = c.cas(v = c.value,
Double.doubleToRawLongBits
(Double.longBitsToDouble(v) + x))))
! doubleAccumulate(x, null, uncontended);
}
}
/**
* Returns the current sum. The returned value is <em>NOT</em> an
--- 90,107 ----
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[index & m]) == null ||
!(uncontended = c.cas(v = c.value,
Double.doubleToRawLongBits
(Double.longBitsToDouble(v) + x))))
! doubleAccumulate(x, null, uncontended, index);
}
}
/**
* Returns the current sum. The returned value is <em>NOT</em> an
< prev index next >