[lworld] RFR: 8368274: [lworld] Unsafe.compareAndExchangeFlatValue() wrongly assumes padding bytes are the same for identical value objects
Quan Anh Mai
qamai at openjdk.org
Thu Jan 15 13:34:46 UTC 2026
On Wed, 12 Nov 2025 22:02:07 GMT, Chen Liang <liach at openjdk.org> wrote:
> Use the raw value get as witness, because the flat value get may ignore garbage value and cause infinite loop as a result. Waiting for a test case.
src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1786:
> 1784: V x) {
> 1785: Object[] array = newSpecialArray(valueType, 2, layout);
> 1786: return compareAndSetFlatValueAsBytes(array, o, offset, layout, valueType, expected, x) ? x : array[0];
This method should return `array[0]` in all cases.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1734#discussion_r2694405998
More information about the valhalla-dev
mailing list