< prev index next >

src/share/vm/gc/shared/referenceProcessor.cpp

Print this page
rev 10513 : 8149343: assert(rp->num_q() == no_of_gc_workers) failed: sanity
rev 10514 : [mq]: initialize
rev 10516 : [mq]: code_review_2

@@ -132,11 +132,11 @@
 #ifndef PRODUCT
 void ReferenceProcessor::verify_no_references_recorded() {
   guarantee(!_discovering_refs, "Discovering refs?");
   for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
     guarantee(_discovered_refs[i].is_empty(),
-              "Found non-empty discovered list");
+              "Found non-empty discovered list at %u", i);
   }
 }
 #endif
 
 void ReferenceProcessor::weak_oops_do(OopClosure* f) {

@@ -681,23 +681,31 @@
 private:
   bool _clear_referent;
 };
 
 #ifndef PRODUCT
-void ReferenceProcessor::log_reflist_counts(DiscoveredList ref_lists[], size_t total_refs) {
+void ReferenceProcessor::log_reflist_counts(DiscoveredList ref_lists[], uint active_length, size_t total_refs) {
   if (!log_is_enabled(Trace, gc, ref)) {
     return;
   }
 
   stringStream st;
-  for (uint i = 0; i < _max_num_q; ++i) {
+  for (uint i = 0; i < active_length; ++i) {
     st.print(SIZE_FORMAT " ", ref_lists[i].length());
   }
   log_develop_trace(gc, ref)("%s= " SIZE_FORMAT, st.as_string(), total_refs);
+  for (uint i = active_length; i < _max_num_q; i++)
+    assert(ref_lists[i].length() == 0, "%u unexpected References in %u",
+           ref_lists[i].length(), i); 
 }
 #endif
 
+void ReferenceProcessor::set_active_mt_degree(uint v) {
+  _num_q = v;
+  _next_id = 0;
+}
+
 // Balances reference queues.
 // Move entries from all queues[0, 1, ..., _max_num_q-1] to
 // queues[0, 1, ..., _num_q-1] because only the first _num_q
 // corresponding to the active workers will be processed.
 void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[])

@@ -707,11 +715,11 @@
   log_develop_trace(gc, ref)("Balance ref_lists ");
 
   for (uint i = 0; i < _max_num_q; ++i) {
     total_refs += ref_lists[i].length();
     }
-  log_reflist_counts(ref_lists, total_refs);
+  log_reflist_counts(ref_lists, _max_num_q, total_refs);
   size_t avg_refs = total_refs / _num_q + 1;
   uint to_idx = 0;
   for (uint from_idx = 0; from_idx < _max_num_q; from_idx++) {
     bool move_all = false;
     if (from_idx >= _num_q) {

@@ -769,14 +777,14 @@
       }
     }
   }
 #ifdef ASSERT
   size_t balanced_total_refs = 0;
-  for (uint i = 0; i < _max_num_q; ++i) {
+  for (uint i = 0; i < _num_q; ++i) {
     balanced_total_refs += ref_lists[i].length();
     }
-  log_reflist_counts(ref_lists, balanced_total_refs);
+  log_reflist_counts(ref_lists, _num_q, balanced_total_refs);
   assert(total_refs == balanced_total_refs, "Balancing was incomplete");
 #endif
 }
 
 void ReferenceProcessor::balance_all_queues() {

@@ -866,11 +874,11 @@
     // fashion to each of the lists.
     if (_processing_is_mt) {
       id = next_id();
     }
   }
-  assert(id < _max_num_q, "Id is out-of-bounds (call Freud?)");
+  assert(id < _max_num_q, "Id is out-of-bounds id %u and max id %u)", id, _max_num_q);
 
   // Get the discovered queue to which we will add
   DiscoveredList* list = NULL;
   switch (rt) {
     case REF_OTHER:
< prev index next >