RFR: 8316961: Fallback implementations for 64-bit Atomic::{add,xchg} on 32-bit platforms [v3]
Aleksey Shipilev
shade at openjdk.org
Mon Oct 23 14:29:39 UTC 2023
On Mon, 23 Oct 2023 09:40:47 GMT, Erik Ă–sterlund <eosterlund at openjdk.org> wrote:
> It would be nice if Atomic used a PlatformMutex or something internally, for platforms that don't have supports_cx8, so we could just assume that this stuff works across all platforms, just maybe "a bit" slower on some platforms.
Yes, providing the locked implementation was my initial intent as well, but now that I looked into it, it seems to be too much hassle for little, if any, gain. In other words, we can already assume 8-byte atomics work on all platforms we build for. Even Zero -- which runs on obscurest platforms imaginable -- goes into GCC built-ins for `PlatformCmpxchg<8>`, `PlatformXchg<8>` and `PlatformAdd<8>`! So there is already a better path than locking.
Note that I only found ARMv6 "issue" due to a test bug. `PlatformXchg<8>` is actually implemented for ARM v6 with the help of kernel helpers. So if we do locking/gcc-builtins implementation for the case where kernel helpers are not available, it would require some massaging for how ARM32 platform atomics are arranged. From which I hope to weasel out in this PR :)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16252#issuecomment-1775326377
More information about the hotspot-dev
mailing list