RFR: 8369207: _Copy_conjoint_{jshorts,jints,jlongs}_atomic on Linux/BSD AArch64 do not prevent tearing

Justin King jcking at openjdk.org
Wed Oct 8 12:33:02 UTC 2025


On Mon, 6 Oct 2025 14:17:52 GMT, Justin King <jcking at openjdk.org> wrote:

> Ensure the compiler cannot optimize the copy loops by replacing them with `memcpy` which is allowed to copy byte by byte potentially introducing tearing. Currently there is nothing preventing the compiler from doing this. We add `volatile` which prevents the compiler from making this optimization in the future.
> 
> Currently the code generates to `ldp` and `stp`, this change does have the side affect of forcing it to do `ldr` and `str`. If that seems unacceptable from a performance standpoint we can hand-roll assembly to do `ldp` and `stp`.

Moving this back to draft until discussions in #27642 finish.

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

PR Comment: https://git.openjdk.org/jdk/pull/27647#issuecomment-3381292689


More information about the hotspot-runtime-dev mailing list