RFR(S): 8238780: [lworld] C2: Partially initialized value type buffer might be observed by other thread

Tobias Hartmann tobias.hartmann at oracle.com
Wed Feb 12 15:33:28 UTC 2020


Hi,

please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8238780
http://cr.openjdk.java.net/~thartmann/8238780/webrev.00/

Similar to what we have for the clone intrinsic [1], the inline type buffer initialization in
ValueTypeNode::allocate, ValueTypeNode::finish_larval and LateInlineCallGenerator::do_late_inline()
needs a barrier to not let C2 reorder initializing stores with a subsequent store that would make
this buffer accessible by other threads. TestBufferTearing.java triggers this reliably for both
cases with the help of -XX:+Stress(G/L)CM. It disables field and array element flattening to ensure
that writes are atomic (we could also use nullable containers).

This change also includes some refactoring, an additional test and a new test suite option to
run the tests without compile commands for extended testing.

Thanks to John for finding and debugging this issue [2]!

Best regards,
Tobias

[1] http://hg.openjdk.java.net/jdk/jdk/file/5a3b04593405/src/hotspot/share/opto/library_call.cpp#l4218
[2] https://mail.openjdk.java.net/pipermail/valhalla-dev/2019-December/006696.html


More information about the valhalla-dev mailing list