diff src/share/vm/memory/referenceProcessor.hpp @ 3992:d1bdeef3e3e2

7098282: G1: assert(interval >= 0) failed: Sanity check, referencePolicy.cpp: 76 Summary: There is a race between one thread successfully forwarding and copying the klass mirror for the SoftReference class (including the static master clock) and another thread attempting to use the master clock while attempting to discover a soft reference object. Maintain a shadow copy of the soft reference master clock and use the shadow during reference discovery and reference processing. Reviewed-by: tonyp, brutisso, ysr
author johnc
date Wed, 12 Oct 2011 10:25:51 -0700
parents 4dfb2df418f2
children bf2d2b8b1726
line wrap: on
line diff
--- a/src/share/vm/memory/referenceProcessor.hpp	Tue Oct 11 10:21:36 2011 +0200
+++ b/src/share/vm/memory/referenceProcessor.hpp	Wed Oct 12 10:25:51 2011 -0700
@@ -201,7 +201,6 @@
     assert(_ref != _first_seen, "cyclic ref_list found");
     NOT_PRODUCT(_processed++);
   }
-
 };
 
 class ReferenceProcessor : public CHeapObj {
@@ -209,6 +208,9 @@
   // Compatibility with pre-4965777 JDK's
   static bool _pending_list_uses_discovered_field;
 
+  // The SoftReference master timestamp clock
+  static jlong _soft_ref_timestamp_clock;
+
   MemRegion   _span;                    // (right-open) interval of heap
                                         // subject to wkref discovery
 
@@ -456,19 +458,7 @@
   void      set_span(MemRegion span) { _span = span; }
 
   // start and stop weak ref discovery
-  void enable_discovery(bool verify_disabled, bool check_no_refs) {
-#ifdef ASSERT
-    // Verify that we're not currently discovering refs
-    assert(!verify_disabled || !_discovering_refs, "nested call?");
-
-    if (check_no_refs) {
-      // Verify that the discovered lists are empty
-      verify_no_references_recorded();
-    }
-#endif // ASSERT
-    _discovering_refs = true;
-  }
-
+  void enable_discovery(bool verify_disabled, bool check_no_refs);
   void disable_discovery()  { _discovering_refs = false; }
   bool discovery_enabled()  { return _discovering_refs;  }