RFR: 8329997: Add provisions for checking memory segment alignment constraints

Per Minborg pminborg at openjdk.org
Mon Apr 15 07:55:04 UTC 2024


This PR proposes to add a new method `MemorySegment::maxByteAlignment` that returns the maximum byte alignment of a segment (both heap and native segments).

Clients can then use this method to determine if a segment is properly aligned for any given layout (e.g. following a `MemorySegment::reinterpret` operation).

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

Commit messages:
 - Fix imports and copyright
 - Update maxByteAlignment docs
 - Improve doc and tests
 - Add a MS::maxByteAlignment method

Changes: https://git.openjdk.org/jdk/pull/18779/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18779&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329997
  Stats: 134 lines in 4 files changed: 128 ins; 2 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/18779.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18779/head:pull/18779

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


More information about the core-libs-dev mailing list