Integrated: 8341854: Incorrect clearing of ZF in fast_unlock_lightweight on x86
Fredrik Bredberg
fbredberg at openjdk.org
Wed Oct 9 16:49:02 UTC 2024
On Wed, 9 Oct 2024 13:11:58 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:
> This bug was created in [JDK-8320318](https://bugs.openjdk.org/browse/JDK-8320318).
>
> `C2_MacroAssembler::fast_unlock_lightweight()` on x86 issues a `testl(monitor, monitor);` instruction for the sole purpose of clearing the zero-flag, which should force us to go into the slow path.
>
> However, this instruction incorrectly only checks the lower 32-bits, which results in setting the zero-flag if the ObjectMonitor has all-zeros in the lower 32-bits. For some reason this seems to be quite common on macosx-x64, where we tend to get an ObjectMonitor address that is 0x0000600000000000.
>
> The reason we wanted to go into the slow path was that we've observed that there is a thread queued on either the EntryList or cxq, and there is no successor. However since we failed to clear the zero-flag, we will go into the fast path and no one will wake up the stranded thread. Thus the system will hang and any test system will timeout.
>
> Tested ok in tier1-3 on all x64 related platforms. Also ran the vm.lang.LockUnlock.testContendedLock test.
This pull request has now been integrated.
Changeset: fcc9c8d5
Author: Fredrik Bredberg <fbredberg at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/fcc9c8d570396506068e0a1d4123e32b195e6653
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8341854: Incorrect clearing of ZF in fast_unlock_lightweight on x86
Reviewed-by: stefank, aboldtch, pchilanomate, dcubed
-------------
PR: https://git.openjdk.org/jdk/pull/21422
More information about the hotspot-compiler-dev
mailing list