RFR: 8316961: Fallback implementations for 64-bit Atomic::{add,xchg} on 32-bit platforms

Aleksey Shipilev shade at openjdk.org
Thu Oct 19 13:42:39 UTC 2023


On Wed, 18 Oct 2023 18:58:58 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> See the bug for rationale. Looks like there is enough infrastructure to achieve what we want without significant fan-out. I checked all `atomic_*.hpp` headers for unimplemented `PlatformAdd<8>` and `PlatformXchg<8>`, and only these seem to be affected.
> 
> Unfortunately, we cannot test these apart from the existing gtest.
> 
> Additional testing:
>  - [x] linux-x86-server-fastdebug, atomic tests pass
>  - [ ] linux-arm-server-fastdebug, atomic tests pass

This situation, by the way, contradicts the requirement that `atomic.hpp` has:


  // Platform-specific implementation of cmpxchg.  Support for sizes
  // of 1, 4, and 8 are required.  The class is a function object that
  // must be default constructable, with these requirements:
  ...
  template<size_t byte_size> struct PlatformCmpxchg;


...so arguably ARM32 implementation violates `Atomic` contract here. This would require some fiddling on ARM32 side to satisfy the contract, because ARM32, AFAIU, does not guarantee the availability on 64-bit atomics.

x86_32 gets away with it by going into `.S` that does `cmpxchg8b`, available in all current x86 implementations since Pentium.

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

PR Comment: https://git.openjdk.org/jdk/pull/16252#issuecomment-1771012765


More information about the hotspot-dev mailing list