[foreign-memaccess] RFR: Move MemoryAddress::copy

Jorn Vernee jvernee at openjdk.java.net
Fri May 15 14:28:26 UTC 2020


On Fri, 15 May 2020 13:45:26 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> As discussed, this patch moves `MemoryAddress::copy` as an *instance* method of `MemorySegment`, namely
> `MemorySegment::copyFrom`. I chose the `copyFrom` suggestion from John, since it allows us more freedom, in the future,
> to add overloads for different sources for the copy operation.
> I've rewrorked the documentation a bit to speak about segment offsets rather than addresses.
> 
> I believe all use cases touched by this change actually lead to simpler code, which is good.
> 
> I've also added a benchmark for some of the bulk operations such as fill and copyFrom - the numbers I've got look good:
> 
> Benchmark             Mode  Cnt       Score       Error  Units
> BulkOps.segment_copy  avgt   30  441675.750 ? 12794.881  ns/op
> BulkOps.segment_fill  avgt   30  122465.908 ?  1760.711  ns/op
> BulkOps.unsafe_copy   avgt   30  430153.694 ?  9055.253  ns/op
> BulkOps.unsafe_fill   avgt   30  120413.079 ?  3799.484  ns/op
> 
> Cheers

Marked as reviewed by jvernee (Committer).

test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java line 9:

> 8:  *  particular file as subject to the "Classpath" exception as provided
> 9:  *  by Oracle in the LICENSE file that accompanied this code.
> 10:  *

Wrong copyright
Suggestion:

 *  published by the Free Software Foundation.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/169


More information about the panama-dev mailing list