[foreign-memaccess+abi] Integrated: 8264933: Improve stream support in memory segments
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Apr 23 17:00:35 UTC 2021
On Thu, 8 Apr 2021 15:56:32 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch improves stream support for memory segments - it does so in two ways:
>
> * first, tweaking the `MemorySegment::spliterator` method to take an *element layout*, instead of a full sequence layout whose size had to match that of the segment.
> * secondly, by adding convenience methods to create streams directly, w/o needing to call `StreamSupport.stream`. As for `Collection`, two methods are provided: `MemorySegment::stream` and `MemorySegment::parallelStream`.
>
> I've fixed up the documentation in places - I realized that, for example, the javadoc for `MemorySegment::spliterator` was missing a `@throws` clause for when there's a size mismatch between layout and segment.
> Also, I've removed scope liveness check on the spliterator call - after all, a spliterator is going to make slices - a liveness check will occur when the slice is accessed.
This pull request has now been integrated.
Changeset: 94660a16
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/94660a16
Stats: 60 lines in 5 files changed: 22 ins; 5 del; 33 mod
8264933: Improve stream support in memory segments
Reviewed-by: jvernee, psandoz
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/494
More information about the panama-dev
mailing list