This looks eerily similar to JDK-7170145, but now for Unsafe.get*Volatile handling in C1. We seem to miss the case for volatile ops like this:
$ hg diff src/share/vm/c1/c1_ValueMap.hpp
diff -r dedf248e8e3e src/share/vm/c1/c1_ValueMap.hpp
--- a/src/share/vm/c1/c1_ValueMap.hpp Mon Feb 13 10:37:33 2017 -0500
+++ b/src/share/vm/c1/c1_ValueMap.hpp Mon Feb 27 10:33:01 2017 +0100
@@ -198,7 +198,11 @@
void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
void do_RoundFP (RoundFP* x) { /* nothing to do */ }
void do_UnsafeGetRaw (UnsafeGetRaw* x) { /* nothing to do */ }
- void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
+ void do_UnsafeGetObject(UnsafeGetObject* x) {
+ if (x->is_volatile()) {
+ kill_memory();
+ }
+ }
void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
void do_ProfileReturnType (ProfileReturnType* x) { /* nothing to do */ }
void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
This might explain a few failures in jcstress, like this -- although not confirmed as the actual culprit:
http://openjdk.linaro.org/jdk9/jcstress-nightly-runs/2017/056/results/org.openjdk.jcstress.tests.coherence.varHandles.fields.opaque.ShortTest.html