[foreign-memaccess+abi] RFR: 8273905: Foreign API refresh
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu Sep 16 17:56:10 UTC 2021
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
-------------
Commit messages:
- Changes to finalize the foreign memory access/linker APIs.
Changes: https://git.openjdk.java.net/panama-foreign/pull/576/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=576&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8273905
Stats: 13220 lines in 165 files changed: 4729 ins; 6259 del; 2232 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/576.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/576/head:pull/576
PR: https://git.openjdk.java.net/panama-foreign/pull/576
More information about the panama-dev
mailing list