[14] RFR(S): 8231412: C2: InitializeNode::detect_init_independence() bails out on simple IR shapes

Christian Hagedorn christian.hagedorn at oracle.com
Fri Oct 11 10:34:32 UTC 2019


Hi

Please review the following enhancement:
https://bugs.openjdk.java.net/browse/JDK-8231412
http://cr.openjdk.java.net/~chagedorn/8231412/webrev.00/

This enhancement addresses the early bailout of capturing a field store 
to remove unnecessary zeroing [1] in simple methods containing only 
non-escaping objects. As a consequence, some allocations were marked not 
scalar replaceable by the escape analysis which prevented their elimination.

The patch translates the recursive algorithm of the 
InitializeNode::detect_init_independence() method into an iterative one 
to avoid processing the same nodes twice. Additionally, a dominator 
check is inserted to further reduce iterations: If a CFG node dominates 
the current allocation then there cannot be any dependency beyond that 
node. In order to successfully apply this check for the sample program 
from the original discussion where this enhancement came up [2] and the 
corresponding jtreg test in the patch, the constant [3] was increased. 
As a result the field store can be captured and the escape analysis can 
remove all allocations in those methods. The larger value of the 
constant [3] had no negative impact on performance (verified with some 
standard benchmarks).

Thank you!

Best regards,
Christian


[1] 
http://hg.openjdk.java.net/jdk/jdk/file/e98509cb3867/src/hotspot/share/opto/memnode.cpp#l3602
[2] 
https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-September/035135.html
[3] 
http://hg.openjdk.java.net/jdk/jdk/file/e98509cb3867/src/hotspot/share/opto/phaseX.cpp#l902


More information about the hotspot-compiler-dev mailing list