[foreign-memaccess] [Rev 02] RFR: JDK-8243284: Remove Foreign class

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Apr 22 10:20:38 UTC 2020


> The Foreign class is currently used for 3 methods:
> 
> * withSize, which takes an unchecked address and gives it a size
> * asUnconfined, which takes an existing segment and turns it into an unconfined segment
> * asMallocSegment, which takes an unchecked address and converts that into a segment which can be closed, and where
>   closed is mapped into "free"
> 
> This patch replaces all these with this method:
> 
> static MemorySegment ofNativeUnsafe(MemoryAddress addr, long bytesSize, Thread owner, AutoCloseable cleanup, Object
> attachment)
> Which is then moved directly into MemorySegment - so that we can garbage-collect the Foreign class.
> 
> I've also made some changes on the JDK property - new name is simply "jdk.foreign" and I now made sure that it cannot
> be bypassed with a simple static initializer.

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Update src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
  
  Co-Authored-By: Jorn Vernee <JornVernee at users.noreply.github.com>

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/122/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/122/files/10b7929a..0367c75f

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/122/webrev.02
 - incr: https://webrevs.openjdk.java.net/panama-foreign/122/webrev.01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/122.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/122/head:pull/122

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


More information about the panama-dev mailing list