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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri May 15 09:45:28 UTC 2020

On Fri, 15 May 2020 08:50:53 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

>> 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.

Very good sir, thanks.


Marked as reviewed by mcimadamore (Committer).

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

More information about the panama-dev mailing list