[jmm-dev] VarHandle.safepoint() methods

Paul Sandoz paul.sandoz at oracle.com
Thu Jan 5 18:37:31 UTC 2017

> On 5 Jan 2017, at 08:37, Andrew Haley <aph at redhat.com> wrote:
> On 05/01/17 16:34, Doug Lea wrote:
>>> I'm not proposing any change to the MappedByteBuffer API.  What
>>> would insert the call to safePointEpoch() ?
>> Some sort of annotation? I realize that this trades off one kind of
>> messiness for another, but users would otherwise need to know to
>> use your proposed getSafePoint() method vs plain get(). I can't
>> think of anything that automatically does either of these or
>> any of Gil's variants.
> But users of an unmappable MappedByteBuffer will use exactly the
> same API as any other kind of ByteBuffer.  They won't know anything
> about safepoints. That's the whole idea.  Any solution which changes
> the ByteBuffer API isn't going to fly.


If we just consider an implementation specific solution i wonder if it’s possible to annotate the wrapped MappedByteBuffer methods with a hotspot specific annotation declaring they are “no check point boundaries" scoped. When a method is compiled/inlined the scope might be coarsened. That is likely easier to optimize than Runtime.callWithNoCheckpointBoundaries?


More information about the jmm-dev mailing list