[foreign-memaccess+abi] RFR: 8291639: Improve the ability to visualize a MemorySegment in human readable forms [v18]

Per Minborg pminborg at openjdk.org
Tue Jun 13 11:45:16 UTC 2023


On Wed, 31 May 2023 12:05:02 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Clean up code
>
> src/java.base/share/classes/jdk/internal/foreign/LayoutRecordMapper.java line 470:
> 
>> 468: 
>> 469:         R[] result = (R[]) Array.newInstance(type, Math.toIntExact(count));
>> 470:         Spliterator<MemorySegment> spliterator = segment.spliterator(elementLayout);
> 
> Using MemorySegment::elements allows you to avoid interacting with the spliterator directly (which I don't think you need here?)

This was an attempt to optimize but I agree we should use a Stream instead.

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/833#discussion_r1227989494


More information about the panama-dev mailing list