Details
Description
The generalized jbyte version has to perform a real cmpxchg on a full word (jint) so it has to isolate the correct byte within the word. We have a loop:
while (cur_as_bytes[offset] == compare_value) {
jint res = cmpxchg(new_val, dest_int, cur);
if (res == cur) break;
cur = res;
new_val = cur;
new_val_as_bytes[offset] = exchange_value;
}
but if we fail the initial comparison there is no fence, as required by the semantics for cmpxchg as defined in atomic.hpp.
This was discovered during the review ofJDK-8155949.
while (cur_as_bytes[offset] == compare_value) {
jint res = cmpxchg(new_val, dest_int, cur);
if (res == cur) break;
cur = res;
new_val = cur;
new_val_as_bytes[offset] = exchange_value;
}
but if we fail the initial comparison there is no fence, as required by the semantics for cmpxchg as defined in atomic.hpp.
This was discovered during the review of
Attachments
Issue Links
- relates to
-
JDK-8155949 Support relaxed semantics in cmpxchg
-
- Resolved
-