[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 Wed, 30 Sep 2020 09:58:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> 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()` ?
Yes - this is a dumb holder for accumulated state - my question in the review header was as to whether we're fine with
it being dumb and mutable and thread unsafe, since that is reflected in the javadoc
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/361
More information about the panama-dev
mailing list