JDK-8211320 : AArch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:11,12
Priority:P3
Status:Resolved
Resolution:Fixed
CPU:aarch64
Submitted:2018-10-01
Updated:2020-11-18
Resolved:2018-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Intrinsics for unsafe.compareAndSetByte() and unsafe.compareAndSetShort() don't properly deal with sign extension: load exclusive doesn't sign extend loaded value but comparison is done with sign extended value.
Comments
Fix Request
This is a very important correctness fix, and needs to be backported to 11u, specifically 11.0.3. The risk is very low for every other platform. Patch applies to 11u cleanly, passes x86_64 and AArch64 build. New regression test passes on x86_64 and AArch64 after the patch. The same test fails on AArch64 without the patch.
14-03-2019
This bug should be fixed in 11u. It's a Java compatibility bug, breaks programs. Byte and short CAS is unusual, or it would be a P1.