[foreign-memaccess+abi] RFR: 8265072: Use MemoryAddress instead of MemorySegment in CLinker::upcallStub [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Apr 12 13:22:19 UTC 2021


> Now that ResourceScope is there to handle lifecycle, we no longer need to return a full segment from CLinker::upcallStub, a memory address is sufficient.
> 
> As the javadoc states, even when using implicit scopes, the address will keep the scope alive. When explicit deallocation is used, an external ResourceScope instance likely exists, which can be closed to free the stub.
> 
> This removes the need to protect against dereference of the upcall segment, and makes the API cleaner.
> 
> In the future we might considering adding an function-pointer-like abstraction. For now it seems unnecessary.
> 
> One test (TestUpcallStubs) has been removed, as it was mostly related to checking the properties of the segment returned by the upcall stub call.

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

  Fix package-level javadoc

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/497/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/497/files/997a9390..134ea261

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=497&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=497&range=00-01

  Stats: 9 lines in 1 file changed: 4 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/497.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/497/head:pull/497

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


More information about the panama-dev mailing list