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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Apr 12 14:32:52 UTC 2021


On Mon, 12 Apr 2021 12:58:09 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: b034c4d4
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/b034c4d4
Stats:     126 lines in 13 files changed: 6 ins; 99 del; 21 mod

8265072: Use MemoryAddress instead of MemorySegment in CLinker::upcallStub

Reviewed-by: jvernee

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

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


More information about the panama-dev mailing list