1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Mar 16 09:52:57 2012 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu Apr 05 13:57:23 2012 -0400 1.3 @@ -42,9 +42,7 @@ 1.4 class G1CMIsAliveClosure: public BoolObjectClosure { 1.5 G1CollectedHeap* _g1; 1.6 public: 1.7 - G1CMIsAliveClosure(G1CollectedHeap* g1) : 1.8 - _g1(g1) 1.9 - {} 1.10 + G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { } 1.11 1.12 void do_object(oop obj) { 1.13 ShouldNotCallThis(); 1.14 @@ -111,11 +109,6 @@ 1.15 return offsetToHeapWord(heapWordToOffset(addr) + 1); 1.16 } 1.17 1.18 - void mostly_disjoint_range_union(BitMap* from_bitmap, 1.19 - size_t from_start_index, 1.20 - HeapWord* to_start_word, 1.21 - size_t word_num); 1.22 - 1.23 // debugging 1.24 NOT_PRODUCT(bool covers(ReservedSpace rs) const;) 1.25 }; 1.26 @@ -258,60 +251,6 @@ 1.27 void oops_do(OopClosure* f); 1.28 }; 1.29 1.30 -class CMRegionStack VALUE_OBJ_CLASS_SPEC { 1.31 - MemRegion* _base; 1.32 - jint _capacity; 1.33 - jint _index; 1.34 - jint _oops_do_bound; 1.35 - bool _overflow; 1.36 -public: 1.37 - CMRegionStack(); 1.38 - ~CMRegionStack(); 1.39 - void allocate(size_t size); 1.40 - 1.41 - // This is lock-free; assumes that it will only be called in parallel 1.42 - // with other "push" operations (no pops). 1.43 - void push_lock_free(MemRegion mr); 1.44 - 1.45 - // Lock-free; assumes that it will only be called in parallel 1.46 - // with other "pop" operations (no pushes). 1.47 - MemRegion pop_lock_free(); 1.48 - 1.49 -#if 0 1.50 - // The routines that manipulate the region stack with a lock are 1.51 - // not currently used. They should be retained, however, as a 1.52 - // diagnostic aid. 1.53 - 1.54 - // These two are the implementations that use a lock. They can be 1.55 - // called concurrently with each other but they should not be called 1.56 - // concurrently with the lock-free versions (push() / pop()). 1.57 - void push_with_lock(MemRegion mr); 1.58 - MemRegion pop_with_lock(); 1.59 -#endif 1.60 - 1.61 - bool isEmpty() { return _index == 0; } 1.62 - bool isFull() { return _index == _capacity; } 1.63 - 1.64 - bool overflow() { return _overflow; } 1.65 - void clear_overflow() { _overflow = false; } 1.66 - 1.67 - int size() { return _index; } 1.68 - 1.69 - // It iterates over the entries in the region stack and it 1.70 - // invalidates (i.e. assigns MemRegion()) the ones that point to 1.71 - // regions in the collection set. 1.72 - bool invalidate_entries_into_cset(); 1.73 - 1.74 - // This gives an upper bound up to which the iteration in 1.75 - // invalidate_entries_into_cset() will reach. This prevents 1.76 - // newly-added entries to be unnecessarily scanned. 1.77 - void set_oops_do_bound() { 1.78 - _oops_do_bound = _index; 1.79 - } 1.80 - 1.81 - void setEmpty() { _index = 0; clear_overflow(); } 1.82 -}; 1.83 - 1.84 class ForceOverflowSettings VALUE_OBJ_CLASS_SPEC { 1.85 private: 1.86 #ifndef PRODUCT 1.87 @@ -408,7 +347,6 @@ 1.88 friend class ConcurrentMarkThread; 1.89 friend class CMTask; 1.90 friend class CMBitMapClosure; 1.91 - friend class CSetMarkOopClosure; 1.92 friend class CMGlobalObjectClosure; 1.93 friend class CMRemarkTask; 1.94 friend class CMConcurrentMarkingTask; 1.95 @@ -443,7 +381,6 @@ 1.96 CMBitMap _markBitMap2; 1.97 CMBitMapRO* _prevMarkBitMap; // completed mark bitmap 1.98 CMBitMap* _nextMarkBitMap; // under-construction mark bitmap 1.99 - bool _at_least_one_mark_complete; 1.100 1.101 BitMap _region_bm; 1.102 BitMap _card_bm; 1.103 @@ -457,7 +394,6 @@ 1.104 1.105 // For gray objects 1.106 CMMarkStack _markStack; // Grey objects behind global finger. 1.107 - CMRegionStack _regionStack; // Grey regions behind global finger. 1.108 HeapWord* volatile _finger; // the global finger, region aligned, 1.109 // always points to the end of the 1.110 // last claimed region 1.111 @@ -502,18 +438,6 @@ 1.112 // verbose level 1.113 CMVerboseLevel _verbose_level; 1.114 1.115 - // These two fields are used to implement the optimisation that 1.116 - // avoids pushing objects on the global/region stack if there are 1.117 - // no collection set regions above the lowest finger. 1.118 - 1.119 - // This is the lowest finger (among the global and local fingers), 1.120 - // which is calculated before a new collection set is chosen. 1.121 - HeapWord* _min_finger; 1.122 - // If this flag is true, objects/regions that are marked below the 1.123 - // finger should be pushed on the stack(s). If this is flag is 1.124 - // false, it is safe not to push them on the stack(s). 1.125 - bool _should_gray_objects; 1.126 - 1.127 // All of these times are in ms. 1.128 NumberSeq _init_times; 1.129 NumberSeq _remark_times; 1.130 @@ -604,7 +528,7 @@ 1.131 CMTaskQueueSet* task_queues() { return _task_queues; } 1.132 1.133 // Access / manipulation of the overflow flag which is set to 1.134 - // indicate that the global stack or region stack has overflown 1.135 + // indicate that the global stack has overflown 1.136 bool has_overflown() { return _has_overflown; } 1.137 void set_has_overflown() { _has_overflown = true; } 1.138 void clear_has_overflown() { _has_overflown = false; } 1.139 @@ -684,68 +608,6 @@ 1.140 bool mark_stack_overflow() { return _markStack.overflow(); } 1.141 bool mark_stack_empty() { return _markStack.isEmpty(); } 1.142 1.143 - // (Lock-free) Manipulation of the region stack 1.144 - bool region_stack_push_lock_free(MemRegion mr) { 1.145 - // Currently we only call the lock-free version during evacuation 1.146 - // pauses. 1.147 - assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped"); 1.148 - 1.149 - _regionStack.push_lock_free(mr); 1.150 - if (_regionStack.overflow()) { 1.151 - set_has_overflown(); 1.152 - return false; 1.153 - } 1.154 - return true; 1.155 - } 1.156 - 1.157 - // Lock-free version of region-stack pop. Should only be 1.158 - // called in tandem with other lock-free pops. 1.159 - MemRegion region_stack_pop_lock_free() { 1.160 - return _regionStack.pop_lock_free(); 1.161 - } 1.162 - 1.163 -#if 0 1.164 - // The routines that manipulate the region stack with a lock are 1.165 - // not currently used. They should be retained, however, as a 1.166 - // diagnostic aid. 1.167 - 1.168 - bool region_stack_push_with_lock(MemRegion mr) { 1.169 - // Currently we only call the lock-based version during either 1.170 - // concurrent marking or remark. 1.171 - assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(), 1.172 - "if we are at a safepoint it should be the remark safepoint"); 1.173 - 1.174 - _regionStack.push_with_lock(mr); 1.175 - if (_regionStack.overflow()) { 1.176 - set_has_overflown(); 1.177 - return false; 1.178 - } 1.179 - return true; 1.180 - } 1.181 - 1.182 - MemRegion region_stack_pop_with_lock() { 1.183 - // Currently we only call the lock-based version during either 1.184 - // concurrent marking or remark. 1.185 - assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(), 1.186 - "if we are at a safepoint it should be the remark safepoint"); 1.187 - 1.188 - return _regionStack.pop_with_lock(); 1.189 - } 1.190 -#endif 1.191 - 1.192 - int region_stack_size() { return _regionStack.size(); } 1.193 - bool region_stack_overflow() { return _regionStack.overflow(); } 1.194 - bool region_stack_empty() { return _regionStack.isEmpty(); } 1.195 - 1.196 - // Iterate over any regions that were aborted while draining the 1.197 - // region stack (any such regions are saved in the corresponding 1.198 - // CMTask) and invalidate (i.e. assign to the empty MemRegion()) 1.199 - // any regions that point into the collection set. 1.200 - bool invalidate_aborted_regions_in_cset(); 1.201 - 1.202 - // Returns true if there are any aborted memory regions. 1.203 - bool has_aborted_regions(); 1.204 - 1.205 CMRootRegions* root_regions() { return &_root_regions; } 1.206 1.207 bool concurrent_marking_in_progress() { 1.208 @@ -774,10 +636,6 @@ 1.209 return _task_queues->steal(task_num, hash_seed, obj); 1.210 } 1.211 1.212 - // It grays an object by first marking it. Then, if it's behind the 1.213 - // global finger, it also pushes it on the global stack. 1.214 - void deal_with_reference(oop obj); 1.215 - 1.216 ConcurrentMark(ReservedSpace rs, int max_regions); 1.217 ~ConcurrentMark(); 1.218 1.219 @@ -810,22 +668,6 @@ 1.220 inline void grayRoot(oop obj, size_t word_size, 1.221 uint worker_id, HeapRegion* hr = NULL); 1.222 1.223 - // It's used during evacuation pauses to gray a region, if 1.224 - // necessary, and it's MT-safe. It assumes that the caller has 1.225 - // marked any objects on that region. If _should_gray_objects is 1.226 - // true and we're still doing concurrent marking, the region is 1.227 - // pushed on the region stack, if it is located below the global 1.228 - // finger, otherwise we do nothing. 1.229 - void grayRegionIfNecessary(MemRegion mr); 1.230 - 1.231 - // It's used during evacuation pauses to mark and, if necessary, 1.232 - // gray a single object and it's MT-safe. It assumes the caller did 1.233 - // not mark the object. If _should_gray_objects is true and we're 1.234 - // still doing concurrent marking, the objects is pushed on the 1.235 - // global stack, if it is located below the global finger, otherwise 1.236 - // we do nothing. 1.237 - void markAndGrayObjectIfNecessary(oop p); 1.238 - 1.239 // It iterates over the heap and for each object it comes across it 1.240 // will dump the contents of its reference fields, as well as 1.241 // liveness information for the object and its referents. The dump 1.242 @@ -869,10 +711,6 @@ 1.243 // Do concurrent phase of marking, to a tentative transitive closure. 1.244 void markFromRoots(); 1.245 1.246 - // Process all unprocessed SATB buffers. It is called at the 1.247 - // beginning of an evacuation pause. 1.248 - void drainAllSATBBuffers(); 1.249 - 1.250 void checkpointRootsFinal(bool clear_all_soft_refs); 1.251 void checkpointRootsFinalWork(); 1.252 void cleanup(); 1.253 @@ -899,10 +737,6 @@ 1.254 _markStack.note_end_of_gc(); 1.255 } 1.256 1.257 - // Iterate over the oops in the mark stack and all local queues. It 1.258 - // also calls invalidate_entries_into_cset() on the region stack. 1.259 - void oops_do(OopClosure* f); 1.260 - 1.261 // Verify that there are no CSet oops on the stacks (taskqueues / 1.262 // global mark stack), enqueued SATB buffers, per-thread SATB 1.263 // buffers, and fingers (global / per-task). The boolean parameters 1.264 @@ -919,40 +753,6 @@ 1.265 // unless the force parameter is true. 1.266 void update_g1_committed(bool force = false); 1.267 1.268 - void complete_marking_in_collection_set(); 1.269 - 1.270 - // It indicates that a new collection set is being chosen. 1.271 - void newCSet(); 1.272 - 1.273 - // It registers a collection set heap region with CM. This is used 1.274 - // to determine whether any heap regions are located above the finger. 1.275 - void registerCSetRegion(HeapRegion* hr); 1.276 - 1.277 - // Resets the region fields of any active CMTask whose region fields 1.278 - // are in the collection set (i.e. the region currently claimed by 1.279 - // the CMTask will be evacuated and may be used, subsequently, as 1.280 - // an alloc region). When this happens the region fields in the CMTask 1.281 - // are stale and, hence, should be cleared causing the worker thread 1.282 - // to claim a new region. 1.283 - void reset_active_task_region_fields_in_cset(); 1.284 - 1.285 - // Registers the maximum region-end associated with a set of 1.286 - // regions with CM. Again this is used to determine whether any 1.287 - // heap regions are located above the finger. 1.288 - void register_collection_set_finger(HeapWord* max_finger) { 1.289 - // max_finger is the highest heap region end of the regions currently 1.290 - // contained in the collection set. If this value is larger than 1.291 - // _min_finger then we need to gray objects. 1.292 - // This routine is like registerCSetRegion but for an entire 1.293 - // collection of regions. 1.294 - if (max_finger > _min_finger) { 1.295 - _should_gray_objects = true; 1.296 - } 1.297 - } 1.298 - 1.299 - // Returns "true" if at least one mark has been completed. 1.300 - bool at_least_one_mark_complete() { return _at_least_one_mark_complete; } 1.301 - 1.302 bool isMarked(oop p) const { 1.303 assert(p != NULL && p->is_oop(), "expected an oop"); 1.304 HeapWord* addr = (HeapWord*)p; 1.305 @@ -1164,23 +964,6 @@ 1.306 // limit of the region this task is scanning, NULL if we're not scanning one 1.307 HeapWord* _region_limit; 1.308 1.309 - // This is used only when we scan regions popped from the region 1.310 - // stack. It records what the last object on such a region we 1.311 - // scanned was. It is used to ensure that, if we abort region 1.312 - // iteration, we do not rescan the first part of the region. This 1.313 - // should be NULL when we're not scanning a region from the region 1.314 - // stack. 1.315 - HeapWord* _region_finger; 1.316 - 1.317 - // If we abort while scanning a region we record the remaining 1.318 - // unscanned portion and check this field when marking restarts. 1.319 - // This avoids having to push on the region stack while other 1.320 - // marking threads may still be popping regions. 1.321 - // If we were to push the unscanned portion directly to the 1.322 - // region stack then we would need to using locking versions 1.323 - // of the push and pop operations. 1.324 - MemRegion _aborted_region; 1.325 - 1.326 // the number of words this task has scanned 1.327 size_t _words_scanned; 1.328 // When _words_scanned reaches this limit, the regular clock is 1.329 @@ -1268,8 +1051,6 @@ 1.330 int _global_transfers_to; 1.331 int _global_transfers_from; 1.332 1.333 - int _region_stack_pops; 1.334 - 1.335 int _regions_claimed; 1.336 int _objs_found_on_bitmap; 1.337 1.338 @@ -1347,15 +1128,6 @@ 1.339 bool has_timed_out() { return _has_timed_out; } 1.340 bool claimed() { return _claimed; } 1.341 1.342 - // Support routines for the partially scanned region that may be 1.343 - // recorded as a result of aborting while draining the CMRegionStack 1.344 - MemRegion aborted_region() { return _aborted_region; } 1.345 - void set_aborted_region(MemRegion mr) 1.346 - { _aborted_region = mr; } 1.347 - 1.348 - // Clears any recorded partially scanned region 1.349 - void clear_aborted_region() { set_aborted_region(MemRegion()); } 1.350 - 1.351 void set_cm_oop_closure(G1CMOopClosure* cm_oop_closure); 1.352 1.353 // It grays the object by marking it and, if necessary, pushing it 1.354 @@ -1385,22 +1157,12 @@ 1.355 // buffers are available. 1.356 void drain_satb_buffers(); 1.357 1.358 - // It keeps popping regions from the region stack and processing 1.359 - // them until the region stack is empty. 1.360 - void drain_region_stack(BitMapClosure* closure); 1.361 - 1.362 // moves the local finger to a new location 1.363 inline void move_finger_to(HeapWord* new_finger) { 1.364 assert(new_finger >= _finger && new_finger < _region_limit, "invariant"); 1.365 _finger = new_finger; 1.366 } 1.367 1.368 - // moves the region finger to a new location 1.369 - inline void move_region_finger_to(HeapWord* new_finger) { 1.370 - assert(new_finger < _cm->finger(), "invariant"); 1.371 - _region_finger = new_finger; 1.372 - } 1.373 - 1.374 CMTask(int task_num, ConcurrentMark *cm, 1.375 size_t* marked_bytes, BitMap* card_bm, 1.376 CMTaskQueue* task_queue, CMTaskQueueSet* task_queues);