RFR: 8368303: AlwaysAtomicAccesses is excessively strict

Albert Mingkun Yang ayang at openjdk.org
Thu Sep 25 10:55:24 UTC 2025


On Wed, 24 Sep 2025 12:55:38 GMT, Andrew Haley <aph at openjdk.org> wrote:

> The problem is that when an access is marked as volatile...

There is potentially some preexisting mixing-up btw `volatile` and `atomic`; not sure if this is intentional.


  if (is_atomic && !needs_patching) {
    gen->volatile_field_store(value, access.resolved_addr()->as_address_ptr(), access.access_emit_info());
  }


I thought `volatile_field_store` is just a misnomer -- should have been `atomic_field_store`, indicating that the caller requires the store to be atomic. Then underlying arch fulfills that contract one way or another. It's possible in certain cases (small types) that nothing extra than a plain store is required. However, how to satisfy the atomic-store requirement should be a callee responsibility. Just my 2c.

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

PR Comment: https://git.openjdk.org/jdk/pull/27432#issuecomment-3333386614


More information about the hotspot-dev mailing list