RFR: 8316961: Fallback implementations for 64-bit Atomic::{add,xchg} on 32-bit platforms [v3]
Erik Österlund
eosterlund at openjdk.org
Mon Oct 23 09:43:39 UTC 2023
On Mon, 23 Oct 2023 09:10:50 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Yes, it is confusing. `Atomic` docs still mention `supports_cx8` as the pre-check for using 64-bit atomics, which gets extra confusing if it was only intended to serve as availability check for Java accesses:
>
> https://github.com/openjdk/jdk/blob/729f4c5d141cdc272249c4c69efd05f96a654137/src/hotspot/share/runtime/atomic.hpp#L58-L62
>
> So I would like to go forward with this PR. The only question that remains for me is whether to protect the gtest cases with `supports_cx8` (satisfying the `Atomic` contract), or drop the checks there, thus giving the early warning for platform maintainers that they are actually expected to implement 64-bit atomics regardless.
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. If we wanted to be really fancy, we could have an array that is say 8 * number of CPUs large, where addresses are hashed to a PlatformMutex to reduce contention a bit. But perhaps that's more than you bargained for with this PR!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16252#issuecomment-1774807729
More information about the hotspot-dev
mailing list