[foreign-abi] RFR: 8237585: Dismantle ForeignUnsafe

Jorn Vernee jvernee at openjdk.java.net
Thu Mar 19 15:23:05 UTC 2020


Hi,

This is a redo of the earlier patch to dismantle ForeignUnsafe. It replaces ForeignUnsafe with the Foreign interface,
and the InternalForeign implementation of that interface.

This PR removes the need to pass --add-exports to make ForeignUnsafe accessible, and replaces it with a runtime check
on the `jdk.incubator.foreign.Foreign` system property, which is checked when calling `Foreign::getInstance`. The
`Foreign` object returned from that method acts as an access token for accessing native interop functionality. The
SystemABI::getInstance factory has also been moved to Foreign, along with the methods that were previously found in
ForeignUnsafe. All have now been made non-static.

I've updated the tests and also removed the SysV ABI `jdk.internal.foreign.NativeInvoker.FASTPATH` which was no longer
being used.

Jorn

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

Commit messages:
 - Rename ForeignUnsafe to just Foreign, move it outside of the 'unsafe' package, and guard use of it's methods by a system property.

Changes: https://git.openjdk.java.net/panama-foreign/pull/56/files
 Webrev: https://webrevs.openjdk.java.net/panama-foreign/56/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8237585
  Stats: 499 lines in 15 files changed: 305 ins; 169 del; 25 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/56.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/56/head:pull/56

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


More information about the panama-dev mailing list