[16] RFR(S): 8248226: TestCloneAccessStressGCM fails with -XX:-ReduceBulkZeroing

Christian Hagedorn christian.hagedorn at oracle.com
Fri Jul 3 11:42:04 UTC 2020


Hi

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

C2 erroneously folds the addition in the return statement in the method 
TestCloneAccessStressGCM::test() to 0 when ReduceInitialCardMarks and 
ReduceBulkZeroing are disabled.

The problem in the testcase can be traced back to 
LoadNode::find_previous_arraycopy() called from LoadNode::Ideal() for 
the loads dest.i1, dest.i2 etc. where we do not take GC barriers into 
account (disabled ReduceInitialCardMarks) when trying to find an 
ArrayCopyNode which belongs to a clone.

As a result, we conclude that there is no ArrayCopyNode and bailout of 
the ideal transformation. Afterwards, we call LoadNode::Value() and look 
for a stored value for the allocation belonging to the clone() call. 
Since we cannot find one (because the ArrayCopyNode is initializing the 
allocation) we conclude that the field is 0 and replace the LoadNode by 
a constant 0. This happens for all the LoadNodes in the addition in the 
return statement which is then folded to 0 and returned.

This could have been prevented if ReduceBulkZeroing was enabled. Because 
in that case, the InitializationNode would have been marked as completed 
at [1] and the InitializationNode::find_captured_store() method returned 
NULL at [2] and eventually the entire LoadNode::Value() method returned 
_type (int) instead of the constant 0 because of the bailout at [3] for 
completed InitializationNodes.

Thank you!

Best regards,
Christian


[1] 
http://hg.openjdk.java.net/jdk/jdk/file/a7c030723240/src/hotspot/share/opto/library_call.cpp#l4234
[2] 
http://hg.openjdk.java.net/jdk/jdk/file/a7c030723240/src/hotspot/share/opto/memnode.cpp#l3775
[3] 
http://hg.openjdk.java.net/jdk/jdk/file/a7c030723240/src/hotspot/share/opto/memnode.cpp#l3722


More information about the hotspot-compiler-dev mailing list