< prev index next >

src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp

Print this page
rev 11545 : [mq]: 8159978-collection-set-as-array
rev 11546 : [mq]: 8159978-erikh-review


  90 
  91     if (_regions_visited == 10) {
  92       if (_sts->should_yield()) {
  93         _sts->yield();
  94         // A gc may have occurred and our sampling data is stale and further
  95         // traversal of the collection set is unsafe
  96         return true;
  97       }
  98       _regions_visited = 0;
  99     }
 100     return false;
 101   }
 102 
 103   size_t sampled_rs_lengths() const { return _sampled_rs_lengths; }
 104 };
 105 
 106 void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
 107   SuspendibleThreadSetJoiner sts;
 108   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 109   G1Policy* g1p = g1h->g1_policy();
 110   G1CollectionSet* g1cs = g1h->collection_set();
 111 
 112   if (G1CollectedHeap::heap()->g1_policy()->adaptive_young_list_length()) {
 113     G1YoungRemSetSamplingClosure cl(&sts);
 114     g1cs->iterate(&cl);


 115 
 116     if (cl.complete()) {
 117       g1p->revise_young_list_target_length_if_necessary(cl.sampled_rs_lengths());
 118     }
 119   }
 120 }


  90 
  91     if (_regions_visited == 10) {
  92       if (_sts->should_yield()) {
  93         _sts->yield();
  94         // A gc may have occurred and our sampling data is stale and further
  95         // traversal of the collection set is unsafe
  96         return true;
  97       }
  98       _regions_visited = 0;
  99     }
 100     return false;
 101   }
 102 
 103   size_t sampled_rs_lengths() const { return _sampled_rs_lengths; }
 104 };
 105 
 106 void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
 107   SuspendibleThreadSetJoiner sts;
 108   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 109   G1Policy* g1p = g1h->g1_policy();

 110 
 111   if (g1p->adaptive_young_list_length()) {
 112     G1YoungRemSetSamplingClosure cl(&sts);
 113 
 114     G1CollectionSet* g1cs = g1h->collection_set();
 115     g1cs->iterate(&cl, true);
 116 
 117     if (cl.complete()) {
 118       g1p->revise_young_list_target_length_if_necessary(cl.sampled_rs_lengths());
 119     }
 120   }
 121 }
< prev index next >