[foreign-memaccess+abi] RFR: 8265072: Use MemoryAddress instead of MemorySegment in CLinker::upcallStub
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Apr 12 13:03:09 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.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.java.net/panama-foreign/pull/497/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=497&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8265072
Stats: 117 lines in 12 files changed: 2 ins; 99 del; 16 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