[jmm-dev] VarHandle.safepoint() methods
Doug Lea
dl at cs.oswego.edu
Thu Jan 5 13:41:51 UTC 2017
On 01/05/2017 07:55 AM, Doug Lea wrote:
> A complementary approach would be to allow programmers
> to manually insert safepoint checks, such that the JVM would
> not insert one if already there.
>
> As in (for some field x, VH X, and local r:)
> r = X.get(this);
> ...
> if (VarHandles.checkPointed()) // returns true if safepoint
> r = X.getAcquire(this);
>
Or, more plausibly, using epoch-based indicators:
r = X.get(this);
e = varHandles.getEpoch();
...
if (VarHandles.checkPointedEpoch() != e) // true if safepoint
r = X.getAcquire(this);
-Doug
More information about the jmm-dev
mailing list