[foreign-memaccess+abi] RFR: 8273905: Foreign API refresh [v11]
Athijegannathan Sundararajan
sundar at openjdk.java.net
Wed Sep 22 10:22:55 UTC 2021
On Wed, 22 Sep 2021 09:36:01 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> As outlined in [1], there are areas of the foreign API we'd like to improve upon, such as:
>>
>> * dereference: there is a mismatch between API points which create segments (which take a layout) and dereference API points, which do not take layouts
>>
>> * role of `MemoryAddress`: in Java 17, `MemoryAddress` has become a stateful carrier, which is attached to a scope. This is inconvenient, as in most cases, a memory address is just a raw pointer that arises when interacting with native code.
>>
>> * resource scopes: the API for scopes has too many flavors to pick from, many of which overlap. The fact that scopes and segment allocators are unrelated forces clients to introduce ad hoc conversions from scopes to allocators, and library developers to add overloads. Finally, the API for acquiring scopes doesn't work well with try-with-resources, and could also be simplified.
>>
>> I will add separate comments to explain how the API has changed to resolve the above issues.
>>
>> [1] - https://mail.openjdk.java.net/pipermail/panama-dev/2021-September/014946.html
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>
> * Add scope check to UpcallStub::address
> * Beefed up SafeFunctionAccessTest
src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/VaList.java line 1:
> 1: package jdk.incubator.foreign;
copyright header is missing
test/micro/org/openjdk/bench/jdk/incubator/foreign/CLayouts.java line 1:
> 1: package org.openjdk.bench.jdk.incubator.foreign;
copyright header missing
test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNewHeap.java line 2:
> 1: /*
> 2: * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
new file. (c) year 2021
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/576
More information about the panama-dev
mailing list