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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Sep 30 10:02:16 UTC 2020


On Tue, 29 Sep 2020 22:20:50 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert commented lines in StdLibTest
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java line 909:
> 
>> 907:      * @see MemorySegment#handoff(HandoffTransform)
>> 908:      */
>> 909:     interface HandoffTransform {
> 
> There might be a use-case for starting out with the existing confinement properties of a segment, say if just
> registering a cleaner or adding an attachment e.g. `HandoffTransform.ofSegment`, which is not a good name since it
> would imply the acceptance of a segment parameter, whereas it would be applied to the segment that accepts the handoff
> transform. That way it's not necessary to query a segment before constructing the correct transform.  I suspect there
> will only be one implementation of `HandoffTransform`, since it's really just a dumb holder of accumulated state, so it
> could be made into a `final class` (value-based) with a non-public constructor.

`HandoffTransform.identity()` ?

> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 317:
> 
>> 315:
>> 316:         final Thread ownerThread;
>> 317:         List<Runnable> cleanupActions = new ArrayList<>();
> 
> Mark all fields as `final`

will do

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

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


More information about the panama-dev mailing list