[concurrency-interest] Here's why Atomic*FieldReference access checking is broken

Peter Levart peter.levart at gmail.com
Wed Oct 8 11:09:15 EDT 2014

On 10/08/2014 02:33 PM, Remi Forax wrote:
> There is another way to do exactly the same things, make ccClass 
> constant foldable for
> the JIT without asking to load a bunch of classes. The implementation 
> of the Updater
> can be moved into java.lang.invoke and use the annotation @Stable, in 
> that case,
> the field ccCache will be considered as constant if the updater is 
> constant itself,
> this trick doesn't come from me but from Paul Sandoz which currently 
> works on
> this area as Doug mention. 

That's really cool, Remi!

Just by moving the nested 
AtomicIntegerFieldUpdater.AtomicIntegerFieldUpdaterImpl class to 
java.lang.invoke package, annotating the final instance fields 'tclass', 
'cclass' and 'offset' with @Stable annotation and simplifying the 
invocation check, I get the same benchmark results. Why are those JVM 
pearls so hidden in the java.lang.invoke package?

Now let me try to get something similar from AtomicReferenceFieldUpdater...

Regards, Peter

More information about the Concurrency-interest mailing list