RFR: 8329997: Add MemorySegment::reinterpretate overloads for alignment constraints
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Apr 10 15:26:11 UTC 2024
On Wed, 10 Apr 2024 15:19:31 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> This PR proposes to add two overloads `MemorySegment::reinterpretate` to allow aligned reinterpretation.
>
> test/jdk/java/foreign/TestSegments.java line 396:
>
>> 394: AtomicInteger counter = new AtomicInteger();
>> 395: try (Arena arena = Arena.ofConfined()){
>> 396: var segment = MemorySegment.ofAddress(41).reinterpret(JAVA_INT);
>
> i.e. this call (and the one below) should throw an exception.
Note - this means that the javadoc of the new methods should also document an IllegalArgumentException.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18717#discussion_r1559656059
More information about the core-libs-dev
mailing list