[foreign-abi] RFR: 8253823: Investigate ways to make handoff-like operation more explicit [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Sep 30 13:11:04 UTC 2020


On Wed, 30 Sep 2020 12:22:27 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> So, mentioning that cleanup actions are called on `MemorySegment#close` is a good thing.
>> Regarding Cleaners - your comment makes me wonder - cleaners are the only thing that is NOT propagated, should we
>> propagate them for consistency; this way what you get out of handoff is a segment that has SAME characteristics as old
>> segment - except some _additional_ stuff and, possibly, a different owner thread.
>
> I think if we can propagate them (technically), we should. I don't know if there's a way to unregister them from the
> old scope as well? (i.e. prevent unecessary cleaner thread churn)

when I looked into it - seemed like there was no way to unregister a cleaner. You can downcast the Cleanable when you
register back to a PhantomCleanable, and that has a remove() method, but I think throws UOE. Which is why we need all
that mess with CleanupAction having a state in them.

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

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


More information about the panama-dev mailing list