diff src/share/vm/opto/parse3.cpp @ 14663:3edd4a71588b

8031818: Experimental VM flag for enforcing safe object construction Summary: -XX:+AlwaysSafeConstructors to unconditionally emit the trailing constructor barrier. Reviewed-by: kvn, roland
author shade
date Mon, 03 Mar 2014 15:31:27 +0400
parents 3c3953fb3f2a
children 92aa6797d639
line wrap: on
line diff
--- a/src/share/vm/opto/parse3.cpp	Mon Mar 03 15:54:45 2014 +0400
+++ b/src/share/vm/opto/parse3.cpp	Mon Mar 03 15:31:27 2014 +0400
@@ -334,13 +334,23 @@
     }
   }
 
+  if (is_field) {
+    set_wrote_fields(true);
+  }
+
   // If the field is final, the rules of Java say we are in <init> or <clinit>.
   // Note the presence of writes to final non-static fields, so that we
   // can insert a memory barrier later on to keep the writes from floating
   // out of the constructor.
   // Any method can write a @Stable field; insert memory barriers after those also.
   if (is_field && (field->is_final() || field->is_stable())) {
-    set_wrote_final(true);
+    if (field->is_final()) {
+        set_wrote_final(true);
+    }
+    if (field->is_stable()) {
+        set_wrote_stable(true);
+    }
+
     // Preserve allocation ptr to create precedent edge to it in membar
     // generated on exit from constructor.
     if (C->eliminate_boxing() &&