[foreign-memaccess+abi] RFR: Add support for high-level functions to copy to and from Java arrays [v2]
Lee Rhodes
github.com+12941506+leerho at openjdk.java.net
Mon Jun 21 22:15:39 UTC 2021
On Mon, 21 Jun 2021 16:54:26 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove alignment constraints from MemoryCopy layouts
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryCopy.java line 137:
>
>> 135: MemorySegment srcSegmentSlice =
>> 136: MemorySegment.ofArray(srcArray).asSlice(srcIndexChars * 2L, srcCopyLengthChars * 2L);
>> 137: MemorySegment dstSegmentSlice = dstSegment.asSlice(dstOffsetBytes, srcCopyLengthChars * 2L);
>
> Little weird to see `srcCopyLengthChars` being used for the destination slice. But the length is the same for both of course. Maybe just drop the `src` prefix? (it's a nit though).
The variable name `srcCopyLengthChars` is for clarity to the user of the API, who does not see the implementation code. Because there are two different types of units in the method call, one in Chars and one in Bytes, it is important to clarify the units of the measure as well as which of source or destination it is associated with.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/555
More information about the panama-dev
mailing list