RFC (S) 8140483: Atomic*FieldUpdaters final fields should be trusted
Vitaly Davidovich
vitalyd at gmail.com
Mon Oct 26 23:18:15 UTC 2015
>
> 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.
If the A*FU op is inlined into caller, I'd hope the null check is removed
as well. Likewise, if it's inlined into caller, `this` class is known at
JIT time of the caller, so should be able to fold obj.getClass() == tclass
to true or false?
On Mon, Oct 26, 2015 at 6:59 PM, Aleksey Shipilev <
aleksey.shipilev at oracle.com> wrote:
> 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.
>
> Thanks,
> -Aleksey
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20151026/0b31e62c/attachment.html>
More information about the hotspot-compiler-dev
mailing list