RFC (S) 8140483: Atomic*FieldUpdaters final fields should be trusted

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Oct 26 22:59:20 UTC 2015

Hi Remi,

On 10/27/2015 01:37 AM, Remi Forax wrote:
> Put the implementation of ARFU inside java.lang.invoke, it will be a
> mess in term of maintenance for Doug and Martin, but fields of
> classes in java.lang.invoke are always trusted and as a bonus you
> have access to nice annotations like @ForceInline.

Oh noes. Maintenance mess is something I don't want to contribute to.
Compared with three lines in compiler code, the A*FU impl move is very
messy. E.g. Doug continuously reminds me that JSR166 is also used
outside OpenJDK, and therefore I think this suggestion pretty much means
forking java.util.concurrent.

> Taking a look to the generated assembly, I wonder why the
> obj.getClass() == tclass is not removed. Given that in for your test
> there is no subclass of AFUBench, it should work. So my guess is that
> the type of 'this' inside the test is not propagated to the method
> 'get', am i right ?

There are, in fact, subclasses of AFUBench generated by JMH itself, so
you cannot elide the typecheck. If you would do the A*FU ops against
some pristine "holder" class, then a typecheck will be elided, and only
a nullcheck will be present.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20151027/14b3e70f/signature-0001.asc>

More information about the hotspot-compiler-dev mailing list