Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 3777:e8b0b0392037
7046182: G1: remove unnecessary iterations over the collection set
Summary: Remove two unnecessary iterations over the collection set which are supposed to prepare the RSet's of the CSet regions for parallel iterations (we'll make sure this is done incrementally). I'll piggyback on this CR the removal of the G1_REM_SET_LOGGING code.
Reviewed-by: brutisso, johnc
author | tonyp |
---|---|
date | Tue, 21 Jun 2011 15:23:07 -0400 |
parents | c3f1170908be |
children | f44782f04dd4 |
comparison
equal
deleted
inserted
replaced
3776:23d434c6290d | 3777:e8b0b0392037 |
---|---|
1083 return (int)MAX2(DirtyCardQueueSet::num_par_ids() + ConcurrentG1Refine::thread_num(), ParallelGCThreads); | 1083 return (int)MAX2(DirtyCardQueueSet::num_par_ids() + ConcurrentG1Refine::thread_num(), ParallelGCThreads); |
1084 } | 1084 } |
1085 | 1085 |
1086 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, | 1086 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, |
1087 HeapRegion* hr) | 1087 HeapRegion* hr) |
1088 : _bosa(bosa), _other_regions(hr), _iter_state(Unclaimed) { } | 1088 : _bosa(bosa), _other_regions(hr) { |
1089 | 1089 reset_for_par_iteration(); |
1090 } | |
1090 | 1091 |
1091 void HeapRegionRemSet::setup_remset_size() { | 1092 void HeapRegionRemSet::setup_remset_size() { |
1092 // Setup sparse and fine-grain tables sizes. | 1093 // Setup sparse and fine-grain tables sizes. |
1093 // table_size = base * (log(region_size / 1M) + 1) | 1094 // table_size = base * (log(region_size / 1M) + 1) |
1094 int region_size_log_mb = MAX2((int)HeapRegion::LogOfHRGrainBytes - (int)LOG_M, 0); | 1095 int region_size_log_mb = MAX2((int)HeapRegion::LogOfHRGrainBytes - (int)LOG_M, 0); |
1099 G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1); | 1100 G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1); |
1100 } | 1101 } |
1101 guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity"); | 1102 guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity"); |
1102 } | 1103 } |
1103 | 1104 |
1104 void HeapRegionRemSet::init_for_par_iteration() { | |
1105 _iter_state = Unclaimed; | |
1106 } | |
1107 | |
1108 bool HeapRegionRemSet::claim_iter() { | 1105 bool HeapRegionRemSet::claim_iter() { |
1109 if (_iter_state != Unclaimed) return false; | 1106 if (_iter_state != Unclaimed) return false; |
1110 jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_state), Unclaimed); | 1107 jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_state), Unclaimed); |
1111 return (res == Unclaimed); | 1108 return (res == Unclaimed); |
1112 } | 1109 } |
1116 } | 1113 } |
1117 | 1114 |
1118 bool HeapRegionRemSet::iter_is_complete() { | 1115 bool HeapRegionRemSet::iter_is_complete() { |
1119 return _iter_state == Complete; | 1116 return _iter_state == Complete; |
1120 } | 1117 } |
1121 | |
1122 | 1118 |
1123 void HeapRegionRemSet::init_iterator(HeapRegionRemSetIterator* iter) const { | 1119 void HeapRegionRemSet::init_iterator(HeapRegionRemSetIterator* iter) const { |
1124 iter->initialize(this); | 1120 iter->initialize(this); |
1125 } | 1121 } |
1126 | 1122 |
1130 init_iterator(&iter); | 1126 init_iterator(&iter); |
1131 size_t card_index; | 1127 size_t card_index; |
1132 while (iter.has_next(card_index)) { | 1128 while (iter.has_next(card_index)) { |
1133 HeapWord* card_start = | 1129 HeapWord* card_start = |
1134 G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); | 1130 G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); |
1135 gclog_or_tty->print_cr(" Card " PTR_FORMAT ".", card_start); | 1131 gclog_or_tty->print_cr(" Card " PTR_FORMAT, card_start); |
1136 } | 1132 } |
1137 // XXX | 1133 // XXX |
1138 if (iter.n_yielded() != occupied()) { | 1134 if (iter.n_yielded() != occupied()) { |
1139 gclog_or_tty->print_cr("Yielded disagrees with occupied:"); | 1135 gclog_or_tty->print_cr("Yielded disagrees with occupied:"); |
1140 gclog_or_tty->print_cr(" %6d yielded (%6d coarse, %6d fine).", | 1136 gclog_or_tty->print_cr(" %6d yielded (%6d coarse, %6d fine).", |
1157 } | 1153 } |
1158 | 1154 |
1159 void HeapRegionRemSet::clear() { | 1155 void HeapRegionRemSet::clear() { |
1160 _other_regions.clear(); | 1156 _other_regions.clear(); |
1161 assert(occupied() == 0, "Should be clear."); | 1157 assert(occupied() == 0, "Should be clear."); |
1158 reset_for_par_iteration(); | |
1159 } | |
1160 | |
1161 void HeapRegionRemSet::reset_for_par_iteration() { | |
1162 _iter_state = Unclaimed; | |
1163 _iter_claimed = 0; | |
1164 // It's good to check this to make sure that the two methods are in sync. | |
1165 assert(verify_ready_for_par_iteration(), "post-condition"); | |
1162 } | 1166 } |
1163 | 1167 |
1164 void HeapRegionRemSet::scrub(CardTableModRefBS* ctbs, | 1168 void HeapRegionRemSet::scrub(CardTableModRefBS* ctbs, |
1165 BitMap* region_bm, BitMap* card_bm) { | 1169 BitMap* region_bm, BitMap* card_bm) { |
1166 _other_regions.scrub(ctbs, region_bm, card_bm); | 1170 _other_regions.scrub(ctbs, region_bm, card_bm); |