8205923: ZGC: Verification applies load barrier before verification
authorstefank
Wed, 27 Jun 2018 15:02:53 +0200
changeset 50870 830b05ca7f58
parent 50869 be1020446dd5
child 50871 d283a214f42b
8205923: ZGC: Verification applies load barrier before verification Reviewed-by: pliden, eosterlund
src/hotspot/share/memory/iterator.hpp
src/hotspot/share/oops/instanceRefKlass.hpp
src/hotspot/share/oops/instanceRefKlass.inline.hpp
--- a/src/hotspot/share/memory/iterator.hpp	Thu Jun 28 01:10:09 2018 -0700
+++ b/src/hotspot/share/memory/iterator.hpp	Wed Jun 27 15:02:53 2018 +0200
@@ -77,7 +77,8 @@
   enum ReferenceIterationMode {
     DO_DISCOVERY,                // Apply closure and discover references
     DO_DISCOVERED_AND_DISCOVERY, // Apply closure to discovered field and do discovery
-    DO_FIELDS                    // Apply closure to all fields
+    DO_FIELDS,                   // Apply closure to all fields
+    DO_FIELDS_EXCEPT_REFERENT    // Apply closure to all fields except the referent field
   };
 
   // The default iteration mode is to do discovery.
--- a/src/hotspot/share/oops/instanceRefKlass.hpp	Thu Jun 28 01:10:09 2018 -0700
+++ b/src/hotspot/share/oops/instanceRefKlass.hpp	Wed Jun 27 15:02:53 2018 +0200
@@ -131,6 +131,10 @@
   template <typename T, class OopClosureType, class Contains>
   static void oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains);
 
+  // Apply the closure to all fields, except the referent field. No reference discovery is done.
+  template <typename T, class OopClosureType, class Contains>
+  static void oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains);
+
   template <typename T>
   static void trace_reference_gc(const char *s, oop obj) NOT_DEBUG_RETURN;
 
--- a/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Thu Jun 28 01:10:09 2018 -0700
+++ b/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Wed Jun 27 15:02:53 2018 +0200
@@ -89,17 +89,22 @@
 }
 
 template <typename T, class OopClosureType, class Contains>
+void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
+  // Explicitly apply closure to the discovered field.
+  do_discovered<T>(obj, closure, contains);
+  // Then do normal reference processing with discovery.
+  oop_oop_iterate_discovery<T>(obj, type, closure, contains);
+}
+
+template <typename T, class OopClosureType, class Contains>
 void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains) {
   do_referent<T>(obj, closure, contains);
   do_discovered<T>(obj, closure, contains);
 }
 
 template <typename T, class OopClosureType, class Contains>
-void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
-  // Explicitly apply closure to the discovered field.
+void InstanceRefKlass::oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains) {
   do_discovered<T>(obj, closure, contains);
-  // Then do normal reference processing with discovery.
-  oop_oop_iterate_discovery<T>(obj, type, closure, contains);
 }
 
 template <typename T, class OopClosureType, class Contains>
@@ -117,6 +122,10 @@
       trace_reference_gc<T>("do_fields", obj);
       oop_oop_iterate_fields<T>(obj, closure, contains);
       break;
+    case OopIterateClosure::DO_FIELDS_EXCEPT_REFERENT:
+      trace_reference_gc<T>("do_fields_except_referent", obj);
+      oop_oop_iterate_fields_except_referent<T>(obj, closure, contains);
+      break;
     default:
       ShouldNotReachHere();
   }