[foreign-memaccess] [Rev 02] RFR: Add MemorySegment::fill

Chris Hegarty chegar at openjdk.java.net
Fri May 15 08:50:53 UTC 2020


> Hi,
> 
> As part of feedback on the Foreign Memory API (when experimenting with
> its usage internally in the JDK), a small number of potential usability
> enhancements could be made to the API. This is the second such.
> 
> This change proposes to add a new method:
>   MemorySegment::fill
> 
> Which fills a value into the given memory segment. Fill can be useful to
> initialize or reset the memory of a segment, similar(ish) to memset.
> 
> There are obviously different ways to provide such functionality, e.g.
> accepting a fill value with a bit width greater than 8 bits, but on
> balance this single method will likely satisfy the majority of simple
> use-cases. Other more advanced initialization scenarios would likely be
> served better from an interaction with the Vector API, or some such.

Chris Hegarty has updated the pull request incrementally with one additional commit since the last revision:

  Make `fill` an instance method on MemortSegment.
  
  The copy method will be renamed and moved to an instance method on segment as a follow on PR.

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/161/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/161/files/af894de2..1a8ed181

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

  Stats: 83 lines in 3 files changed: 30 ins; 40 del; 13 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/161.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/161/head:pull/161

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


More information about the panama-dev mailing list