RFR (M): 8184334: Generalizing Atomic with templates

Andrew Dinn adinn at redhat.com
Wed Aug 2 09:53:02 UTC 2017

On 02/08/17 09:31, Andrew Haley wrote:
> There are eight such changes required in the HotSpot codebase.
> I strongly believe that these changes make the code better.  They show
> exactly where types do not match.  In the case of the random
> generator, they show that there is a type mismatch which is IMO
> probably wrong, and it wouldn't hurt to fix it.
I am of the same opinion. If there were hundreds of such changes
required then I would agree that this might i) indicate that there is
some fundamental issue which implies the need to cater for mix and match
argument types to cmpxchg or ii) the code base is in a terrible state.
With a count of 8 I am very strongly led to conclude that neither of the
above is an issue.

That's not to say I can't/don't admire the nicer points of Erik's
implementation. It's very clever and very interesting that you can do
something like this with templates but ... it is clearly hard to follow.
As a result, I think it is likely to cause more maintenance overhead
and, hence, be more risky than the (demonstrably) rare alternative need
to correctly cast the occasional argument to a cmpxchg call.

Of course, that's merely another 2c in the balance.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the hotspot-dev mailing list