1.1 --- a/src/share/vm/gc_implementation/g1/g1RemSet.cpp Thu Aug 15 10:05:50 2013 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1RemSet.cpp Thu Aug 15 10:52:18 2013 +0200 1.3 @@ -104,15 +104,25 @@ 1.4 class ScanRSClosure : public HeapRegionClosure { 1.5 size_t _cards_done, _cards; 1.6 G1CollectedHeap* _g1h; 1.7 + 1.8 OopsInHeapRegionClosure* _oc; 1.9 + CodeBlobToOopClosure* _code_root_cl; 1.10 + 1.11 G1BlockOffsetSharedArray* _bot_shared; 1.12 CardTableModRefBS *_ct_bs; 1.13 - int _worker_i; 1.14 - int _block_size; 1.15 - bool _try_claimed; 1.16 + 1.17 + double _strong_code_root_scan_time_sec; 1.18 + int _worker_i; 1.19 + int _block_size; 1.20 + bool _try_claimed; 1.21 + 1.22 public: 1.23 - ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) : 1.24 + ScanRSClosure(OopsInHeapRegionClosure* oc, 1.25 + CodeBlobToOopClosure* code_root_cl, 1.26 + int worker_i) : 1.27 _oc(oc), 1.28 + _code_root_cl(code_root_cl), 1.29 + _strong_code_root_scan_time_sec(0.0), 1.30 _cards(0), 1.31 _cards_done(0), 1.32 _worker_i(worker_i), 1.33 @@ -160,6 +170,12 @@ 1.34 card_start, card_start + G1BlockOffsetSharedArray::N_words); 1.35 } 1.36 1.37 + void scan_strong_code_roots(HeapRegion* r) { 1.38 + double scan_start = os::elapsedTime(); 1.39 + r->strong_code_roots_do(_code_root_cl); 1.40 + _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start); 1.41 + } 1.42 + 1.43 bool doHeapRegion(HeapRegion* r) { 1.44 assert(r->in_collection_set(), "should only be called on elements of CS."); 1.45 HeapRegionRemSet* hrrs = r->rem_set(); 1.46 @@ -173,6 +189,7 @@ 1.47 // _try_claimed || r->claim_iter() 1.48 // is true: either we're supposed to work on claimed-but-not-complete 1.49 // regions, or we successfully claimed the region. 1.50 + 1.51 HeapRegionRemSetIterator iter(hrrs); 1.52 size_t card_index; 1.53 1.54 @@ -205,30 +222,43 @@ 1.55 } 1.56 } 1.57 if (!_try_claimed) { 1.58 + // Scan the strong code root list attached to the current region 1.59 + scan_strong_code_roots(r); 1.60 + 1.61 hrrs->set_iter_complete(); 1.62 } 1.63 return false; 1.64 } 1.65 + 1.66 + double strong_code_root_scan_time_sec() { 1.67 + return _strong_code_root_scan_time_sec; 1.68 + } 1.69 + 1.70 size_t cards_done() { return _cards_done;} 1.71 size_t cards_looked_up() { return _cards;} 1.72 }; 1.73 1.74 -void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, int worker_i) { 1.75 +void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, 1.76 + CodeBlobToOopClosure* code_root_cl, 1.77 + int worker_i) { 1.78 double rs_time_start = os::elapsedTime(); 1.79 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); 1.80 1.81 - ScanRSClosure scanRScl(oc, worker_i); 1.82 + ScanRSClosure scanRScl(oc, code_root_cl, worker_i); 1.83 1.84 _g1->collection_set_iterate_from(startRegion, &scanRScl); 1.85 scanRScl.set_try_claimed(); 1.86 _g1->collection_set_iterate_from(startRegion, &scanRScl); 1.87 1.88 - double scan_rs_time_sec = os::elapsedTime() - rs_time_start; 1.89 + double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) 1.90 + - scanRScl.strong_code_root_scan_time_sec(); 1.91 1.92 - assert( _cards_scanned != NULL, "invariant" ); 1.93 + assert(_cards_scanned != NULL, "invariant"); 1.94 _cards_scanned[worker_i] = scanRScl.cards_done(); 1.95 1.96 _g1p->phase_times()->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0); 1.97 + _g1p->phase_times()->record_strong_code_root_scan_time(worker_i, 1.98 + scanRScl.strong_code_root_scan_time_sec() * 1000.0); 1.99 } 1.100 1.101 // Closure used for updating RSets and recording references that 1.102 @@ -288,7 +318,8 @@ 1.103 } 1.104 1.105 void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, 1.106 - int worker_i) { 1.107 + CodeBlobToOopClosure* code_root_cl, 1.108 + int worker_i) { 1.109 #if CARD_REPEAT_HISTO 1.110 ct_freq_update_histo_and_reset(); 1.111 #endif 1.112 @@ -328,7 +359,7 @@ 1.113 _g1p->phase_times()->record_update_rs_time(worker_i, 0.0); 1.114 } 1.115 if (G1UseParallelRSetScanning || (worker_i == 0)) { 1.116 - scanRS(oc, worker_i); 1.117 + scanRS(oc, code_root_cl, worker_i); 1.118 } else { 1.119 _g1p->phase_times()->record_scan_rs_time(worker_i, 0.0); 1.120 }