RFR (XS) 7901097: Blackhole methods should be non-inlined
Aleksey Shipilev
aleksey.shipilev at oracle.com
Thu Nov 13 13:56:02 UTC 2014
Hi,
Our current Blackhole code relies on the a few assumptions:
a) compilers do not reorder operations around volatiles a lot; it also
does not speculate about their values.
b) compilers does not do partial escape analysis; it also does not
re-materialize the objects once they are scalarized.
These assumptions may be broken at any time (I think Graal had already
broken (b)), and therefore we might want to add another assumption:
c) compilers do not do inter-procedural optimizations without inlining
That is, if we force Blackhole methods to be non-inlineable, we will
have a defense-in-depth from the compiler that does violate either of
(a), (b), or (c). We are still in danger of the compiler that violates
all three, but this risk is miniscule at this point.
This change is very simple:
http://cr.openjdk.java.net/~shade/7901097/webrev.01/
https://bugs.openjdk.java.net/browse/CODETOOLS-7901097
...but it obviously has an impact on Blackhole performance:
http://cr.openjdk.java.net/~shade/7901097/performance.txt
On ARM, the method calls costs quite a lot, and we can do nothing about
it. On x86, we have 3x slower Blackholes, but still in vicinity of 2-3ns
per consume. I think this is a fair price to pay for "defense-in-depth"
on dead-code elimination front.
Thanks,
-Aleksey.
More information about the jmh-dev
mailing list