On Wed, 22 Feb 2023 18:23:54 GMT, Jorn Vernee <[email protected]> wrote:
>> Martin Doerr has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Clean fix for NativeMemorySegmentImpl issue with byteSize 0.
>
> src/java.base/share/classes/jdk/internal/foreign/PlatformLayouts.java line
> 266:
>
>> 264: * The {@code T*} native type.
>> 265: */
>> 266: public static final ValueLayout.OfAddress C_POINTER =
>> ValueLayout.ADDRESS.withBitAlignment(64);
>
> I think this is where the issue with the check in `MemorySegment::copy` comes
> from. Note how other platforms add a call to `asUnbounded` for the created
> layout, which makes any pointer boxed using this layout writable/readable
> (such as the in memory return pointer for upcalls).
Thanks for the hint! You found it pretty quickly. I had missed that when
rebasing my early prototype. Fixed.
-------------
PR: https://git.openjdk.org/jdk/pull/12708