[concurrency-interest] @Contended (JEP-142)

Remi Forax forax at univ-mlv.fr
Tue Nov 27 17:17:43 EST 2012


On 11/27/2012 10:06 PM, Doug Lea wrote:
> On 11/27/12 15:45, Jacy Odin Grannis wrote:
>> Instead, by putting it in sun.misc, it forces library writers to make
>> more difficult choices.
>
> Yes, this is the byproduct of some very deliberate decisions of
> the form: People might do X by mistake. So let's make it as
> painful as possible to do X at all, by requiring that people
> move outside the language proper and use sun.misc.*.
> The net result is that the ranks of Unsafe users, especially ,
> grows steadily.
>
>>
>> As far as Unsafe goes...I think it's problematic that it does get 
>> used as much
>> as it does.  The Atomic FieldUpdaters exist, the big argument against 
>> them seems
>> to be the parameter safety checks.
>
> The best bet for improving this situation continues to be to wait
> for invokeDynamic field access manipulation to exist and to be
> predictably fast. 

There is two possible API, one is to export the fieldUpdater as a 
functional interface
and to store it in a static field. The VM is not ready for this, this 
should be done in an update of jdk8.
The other API is to use invokedynamic instead of a method handle,
the VM is ready for that since the release of jdk7, but Java the 
language is not ready at all,
I hope to propose something for jdk9.

> Which I think will someday happen but not soon.
> Although even then, array element versions (which is probably the
> most important/common case inside j.u.c) may escape this treatment.
>
> -Doug

Rémi



More information about the Concurrency-interest mailing list