comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 17844:8847586c9037

8016302: Change type of the number of GC workers to unsigned int (2) Reviewed-by: tschatzl, jwilhelm
author vkempik
date Thu, 03 Apr 2014 17:49:31 +0400
parents bfdf528be8e8
children 270d7cb38f40
comparison
equal deleted inserted replaced
17843:81d7a4b28dc5 17844:8847586c9037
100 RefineCardTableEntryClosure(SuspendibleThreadSet* sts, 100 RefineCardTableEntryClosure(SuspendibleThreadSet* sts,
101 G1RemSet* g1rs, 101 G1RemSet* g1rs,
102 ConcurrentG1Refine* cg1r) : 102 ConcurrentG1Refine* cg1r) :
103 _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true) 103 _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true)
104 {} 104 {}
105 bool do_card_ptr(jbyte* card_ptr, int worker_i) { 105 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
106 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false); 106 bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false);
107 // This path is executed by the concurrent refine or mutator threads, 107 // This path is executed by the concurrent refine or mutator threads,
108 // concurrently, and so we do not care if card_ptr contains references 108 // concurrently, and so we do not care if card_ptr contains references
109 // that point into the collection set. 109 // that point into the collection set.
110 assert(!oops_into_cset, "should be"); 110 assert(!oops_into_cset, "should be");
129 ClearLoggedCardTableEntryClosure() : 129 ClearLoggedCardTableEntryClosure() :
130 _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) 130 _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set())
131 { 131 {
132 for (int i = 0; i < 256; i++) _histo[i] = 0; 132 for (int i = 0; i < 256; i++) _histo[i] = 0;
133 } 133 }
134 bool do_card_ptr(jbyte* card_ptr, int worker_i) { 134 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
135 if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) { 135 if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) {
136 _calls++; 136 _calls++;
137 unsigned char* ujb = (unsigned char*)card_ptr; 137 unsigned char* ujb = (unsigned char*)card_ptr;
138 int ind = (int)(*ujb); 138 int ind = (int)(*ujb);
139 _histo[ind]++; 139 _histo[ind]++;
158 CardTableModRefBS* _ctbs; 158 CardTableModRefBS* _ctbs;
159 public: 159 public:
160 RedirtyLoggedCardTableEntryClosure() : 160 RedirtyLoggedCardTableEntryClosure() :
161 _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) {} 161 _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) {}
162 162
163 bool do_card_ptr(jbyte* card_ptr, int worker_i) { 163 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
164 if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) { 164 if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) {
165 _calls++; 165 _calls++;
166 *card_ptr = 0; 166 *card_ptr = 0;
167 } 167 }
168 return true; 168 return true;
2312 #endif // PRODUCT 2312 #endif // PRODUCT
2313 2313
2314 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, 2314 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl,
2315 DirtyCardQueue* into_cset_dcq, 2315 DirtyCardQueue* into_cset_dcq,
2316 bool concurrent, 2316 bool concurrent,
2317 int worker_i) { 2317 uint worker_i) {
2318 // Clean cards in the hot card cache 2318 // Clean cards in the hot card cache
2319 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); 2319 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
2320 hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq); 2320 hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq);
2321 2321
2322 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); 2322 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2860 } 2860 }
2861 } 2861 }
2862 2862
2863 // Given the id of a worker, obtain or calculate a suitable 2863 // Given the id of a worker, obtain or calculate a suitable
2864 // starting region for iterating over the current collection set. 2864 // starting region for iterating over the current collection set.
2865 HeapRegion* G1CollectedHeap::start_cset_region_for_worker(int worker_i) { 2865 HeapRegion* G1CollectedHeap::start_cset_region_for_worker(uint worker_i) {
2866 assert(get_gc_time_stamp() > 0, "should have been updated by now"); 2866 assert(get_gc_time_stamp() > 0, "should have been updated by now");
2867 2867
2868 HeapRegion* result = NULL; 2868 HeapRegion* result = NULL;
2869 unsigned gc_time_stamp = get_gc_time_stamp(); 2869 unsigned gc_time_stamp = get_gc_time_stamp();
2870 2870
5119 g1_process_strong_roots(bool is_scavenging, 5119 g1_process_strong_roots(bool is_scavenging,
5120 ScanningOption so, 5120 ScanningOption so,
5121 OopClosure* scan_non_heap_roots, 5121 OopClosure* scan_non_heap_roots,
5122 OopsInHeapRegionClosure* scan_rs, 5122 OopsInHeapRegionClosure* scan_rs,
5123 G1KlassScanClosure* scan_klasses, 5123 G1KlassScanClosure* scan_klasses,
5124 int worker_i) { 5124 uint worker_i) {
5125 5125
5126 // First scan the strong roots 5126 // First scan the strong roots
5127 double ext_roots_start = os::elapsedTime(); 5127 double ext_roots_start = os::elapsedTime();
5128 double closure_app_time_sec = 0.0; 5128 double closure_app_time_sec = 0.0;
5129 5129
5303 } 5303 }
5304 } 5304 }
5305 5305
5306 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure { 5306 class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure {
5307 public: 5307 public:
5308 bool do_card_ptr(jbyte* card_ptr, int worker_i) { 5308 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
5309 *card_ptr = CardTableModRefBS::dirty_card_val(); 5309 *card_ptr = CardTableModRefBS::dirty_card_val();
5310 return true; 5310 return true;
5311 } 5311 }
5312 }; 5312 };
5313 5313