[lworld] RFR: 8368274: [lworld] Unsafe.compareAndExchangeFlatValue() wrongly assumes padding bytes are the same for identical value objects

Tobias Hartmann thartmann at openjdk.org
Fri Dec 12 06:27:23 UTC 2025


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.

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestCompareAndExchange.java line 98:

> 96:     @Test
> 97:     public Object test70(Object expected, Object x) {
> 98:         return U.compareAndExchangeFlatValue(this, TEST63_VT_OFFSET, 4, SmallValue.class, expected, x);

Aren't existing tests using `compareAndExchangeFlatValue` in `test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java` sufficient? If not, I'd suggest adding your test case there.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1734#discussion_r2613077745


More information about the valhalla-dev mailing list