[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:40 UTC 2021
On Mon, 21 Jun 2021 20:42:40 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> test/jdk/java/foreign/TestMemoryCopy.java line 49:
>>
>>> 47: * These tests exercise the MemoryCopy copyFromArray(...) and copyToArray(...).
>>> 48: * To make these tests more challenging the segment is a view of the given array,
>>> 49: * which makes the copy operations overlapping self-copies. Thus, this checks the claim:
>>
>> I'm not sure I understand this claim; it seems to me that the test sets up an array view segment, but then copies the contents into a new array (using toArray) as src/dst to do the actual copying? i.e. the source and destination seem disjoint.
>
> This comment was in the original patch - I'll fix or drop it.
I think what you are seeing the extra copy is in the creation of the `truthSegment`, where an extra copy had to be used because there is no API (yet), to help the code determine which direction the copy should be performed in a self-copy scenario. If the call to the MemoryCopy API does not perform the self-copy correctly, comparing its result with the `truthSegment` will definitely reveal an error.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/555
More information about the panama-dev
mailing list