JEP 171: Fence Intrinsics

Remi Forax forax at univ-mlv.fr
Mon Dec 3 10:26:40 PST 2012


On 12/03/2012 06:54 PM, Doug Lea wrote:
> On 12/03/12 12:45, David Chase wrote:
>> Is this the right place to comment on this? I think these should not 
>> go in
>> Unsafe; fence intrinsics belong with compareAndSet in 
>> j.u.concurrent.atomic.
>
> They cannot. The methods cannot be spec'ed using only the concepts
> in the JLS/JMM. So they are not "Java methods", but "JVM methods".
> (This is the same rationale for placing @Contended in sun.misc.)
> Someday, a serious effort is needed to enable rigorous specs
> of core intrinsics along these lines (possible even with a
> Java-level JMM memory model overhaul). But I don't think anyone
> wants to hold these methods hostage for years until this happens.

as stated in the JEP, this methods are not unsafe, so while I think they 
belong to sun.misc,
I would prefer have them in sun.misc.Fences as static methods instead of 
putting them
in sun.misc.Unsafe because getting the sun.misc.Unsafe instance requires 
some privileges.

>
> -Doug
>

Rémi



More information about the hotspot-dev mailing list