[foreign-memaccess+abi] RFR: Revert SegmentAllocator API changes [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Aug 18 10:19:40 UTC 2023


On Fri, 18 Aug 2023 06:52:03 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments
>
> src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 332:
> 
>> 330:         int size = Array.getLength(Objects.requireNonNull(array));
>> 331:         MemorySegment segment = allocateNoInit(Objects.requireNonNull(elementLayout), size);
>> 332:         if (size > 0) {
> 
> Do we need this check? Is it not so that a vast majority of provided arrays would have a size > 0 and in the rare occasion there is a zero-length array, it will still work without this check?

The check was needed to preserve semantics of the method (there was one test failure because of that - but I think we can fix the test instead).

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/868#discussion_r1298280228


More information about the panama-dev mailing list