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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri May 15 14:45:13 UTC 2020


> 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

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Fixed copyright

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/169/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/169/files/3776b9e9..7da26e8c

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/169/webrev.01
 - incr: https://webrevs.openjdk.java.net/panama-foreign/169/webrev.00-01

  Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/169.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/169/head:pull/169

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


More information about the panama-dev mailing list