RFR(S): 8153267: nmethod's exception cache not multi-thread safe

Andrew Haley aph at redhat.com
Mon Apr 4 14:01:32 UTC 2016

On 04/04/2016 01:57 PM, Doerr, Martin wrote:

> there are many places in hotspot where we rely on ordering by
> address dependency. That sounds feasible to me since we're not
> supporting Alpha processors.  The load of the ExceptionCache pointer
> is only used to access elements of the cache, not to establish
> ordering of other accesses.
> I don't think compilers are allowed to break anything here because I
> have made the field volatile. This prevents optimizers from
> reordering, optimizing out or duplicating some of the loads.  All
> supported processors respect the ordering (due to address
> dependency), too, so I believe we're ok.

That sounds alright, at least from an informal reasoning

> I'm not sure if this is what you're concerned about. Did I miss
> anything?

I don't think so.  I presume you've read Hans Boehm's paper where he
points out that it's very hard to rely on dependencies for memory
ordering in any high-level language [1].  For that reason I tend to
err on the side of caution when reasoning about memory.  You're
sailing a bit too close to the rocks for my comfort.  :-)


[1]  http://www.hboehm.info/c++mm/dependencies.html

More information about the hotspot-compiler-dev mailing list