comparison 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
comparison
equal deleted inserted replaced
3991:3f24f946bc2d 3992:d1bdeef3e3e2
199 _ref = _next; 199 _ref = _next;
200 } 200 }
201 assert(_ref != _first_seen, "cyclic ref_list found"); 201 assert(_ref != _first_seen, "cyclic ref_list found");
202 NOT_PRODUCT(_processed++); 202 NOT_PRODUCT(_processed++);
203 } 203 }
204
205 }; 204 };
206 205
207 class ReferenceProcessor : public CHeapObj { 206 class ReferenceProcessor : public CHeapObj {
208 protected: 207 protected:
209 // Compatibility with pre-4965777 JDK's 208 // Compatibility with pre-4965777 JDK's
210 static bool _pending_list_uses_discovered_field; 209 static bool _pending_list_uses_discovered_field;
210
211 // The SoftReference master timestamp clock
212 static jlong _soft_ref_timestamp_clock;
211 213
212 MemRegion _span; // (right-open) interval of heap 214 MemRegion _span; // (right-open) interval of heap
213 // subject to wkref discovery 215 // subject to wkref discovery
214 216
215 bool _discovering_refs; // true when discovery enabled 217 bool _discovering_refs; // true when discovery enabled
454 // get and set span 456 // get and set span
455 MemRegion span() { return _span; } 457 MemRegion span() { return _span; }
456 void set_span(MemRegion span) { _span = span; } 458 void set_span(MemRegion span) { _span = span; }
457 459
458 // start and stop weak ref discovery 460 // start and stop weak ref discovery
459 void enable_discovery(bool verify_disabled, bool check_no_refs) { 461 void enable_discovery(bool verify_disabled, bool check_no_refs);
460 #ifdef ASSERT
461 // Verify that we're not currently discovering refs
462 assert(!verify_disabled || !_discovering_refs, "nested call?");
463
464 if (check_no_refs) {
465 // Verify that the discovered lists are empty
466 verify_no_references_recorded();
467 }
468 #endif // ASSERT
469 _discovering_refs = true;
470 }
471
472 void disable_discovery() { _discovering_refs = false; } 462 void disable_discovery() { _discovering_refs = false; }
473 bool discovery_enabled() { return _discovering_refs; } 463 bool discovery_enabled() { return _discovering_refs; }
474 464
475 // whether discovery is atomic wrt other collectors 465 // whether discovery is atomic wrt other collectors
476 bool discovery_is_atomic() const { return _discovery_is_atomic; } 466 bool discovery_is_atomic() const { return _discovery_is_atomic; }