RFR: 8329997: Add provisions for checking memory segment alignment constraints [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Apr 16 09:43:02 UTC 2024


On Tue, 16 Apr 2024 07:49:26 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> 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).
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update JavaDoc

Marked as reviewed by mcimadamore (Reviewer).

src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 612:

> 610:      * the type of the {@linkplain #heapBase() backing heap storage}.
> 611:      * <p>
> 612:      * This method can be used to ensure, a {@code segment} is sufficiently aligned

I would drop the use of code blocks for `segment` and layout. Also remove the comma after "ensure"

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

PR Review: https://git.openjdk.org/jdk/pull/18779#pullrequestreview-2003148028
PR Review Comment: https://git.openjdk.org/jdk/pull/18779#discussion_r1567059979


More information about the core-libs-dev mailing list