RFR: 8295124: Atomic::add to pointer type may return wrong value

Kim Barrett kbarrett at openjdk.org
Wed Oct 12 01:15:52 UTC 2022


Please review this change to the handling of Atomic pointer arithmetic. When
the value being modified is a pointer `P*`, the type of the value in the
destination passed to the platform operation is `const char*`, so a pointer
type whose pointee is size 1. This allows the platform operation to just treat
the arithmetic as a simple byte adjustment.

To demonstrate the problem described in the bug (possible incorrect result for
Atomic pointer arithmetic) and show that it is now fixed, this change also
includes some gtests for Atomic operations, including pointer arithmetic which
fails before the change and succeeds after.

Testing: mach5 tier1-3

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

Commit messages:
 - shared conversion of pointer type
 - add more gtests of Atomic

Changes: https://git.openjdk.org/jdk/pull/10667/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10667&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8295124
  Stats: 161 lines in 2 files changed: 146 ins; 3 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/10667.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10667/head:pull/10667

PR: https://git.openjdk.org/jdk/pull/10667


More information about the hotspot-runtime-dev mailing list