[foreign-abi] RFR: 8237585: Dismantle ForeignUnsafe

Jorn Vernee jvernee at openjdk.java.net
Tue Feb 25 15:09:31 UTC 2020


Removes ForeignUnsafe, moves `getUnsafeBase` and `getUnsafeAccess` to `MemoryAddress`, and moves `ofNativeUnchecked` to `MemorySegment`.

I've added a warning about the safety of these methods to the javadoc.

Use of the methods is guarded by a check against a system property, `jdk.incubator.foreign.permitUnsafeInterop` for the first 2, and `jdk.incubator.foreign.permitUncheckedSegments` for the latter. This needs to be set to `true` when running an application, or otherwise the use of these methods results in an `IllegalAccessError` being thrown.

I've updated the test accordingly, and also remove the FASTPATH option from the SysV ABI implementation, since it was not actually being used, but still causing the tests to be run multiple times.

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

Commits:
 - 5c58877a: Slightly touch up javadoc
 - 6abdd478: Remove ForeignUnsafe.java, and move it's method to MemoryAddress and MemorySegment

Changes: https://git.openjdk.java.net/panama-foreign/pull/31/files
 Webrev: https://webrevs.openjdk.java.net/panama-foreign/31/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8237585
  Stats: 176 lines in 10 files changed: 78 ins; 91 del; 7 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/31.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/31/head:pull/31

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


More information about the panama-dev mailing list