[foreign-abi] RFR: 8254260: Consider splitting binding recipe operators that serve a dual role

Jorn Vernee jvernee at openjdk.java.net
Fri Oct 9 12:39:16 UTC 2020


On Fri, 9 Oct 2020 12:05:03 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java line 344:
>> 
>>> 342:                                 Map<VMStorage, Integer> retIndexMap) throws Throwable {
>>> 343:         boolean hasBufferCopies = bufferCopySize != 0;
>>> 344:         NativeScope scope = hasBufferCopies ? NativeScope.boundedScope(bufferCopySize) : null;
>> 
>> If Allocator had a close() method, this could be simplified a little?
>
> This is not really a problem with Allocator, it's a problem with having either a NativeScope, or having none (null),
> which will result in an NPE when trying to reference `scope::allocateNative`. That's why this code is conditional.

I'm experimenting with this a bit. Seems like there is some room for improvement.

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

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


More information about the panama-dev mailing list