1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Oct 07 09:42:18 2009 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Oct 07 10:09:57 2009 -0400 1.3 @@ -237,7 +237,7 @@ 1.4 _index = next_index; 1.5 for (int i = 0; i < n; i++) { 1.6 int ind = start + i; 1.7 - guarantee(ind < _capacity, "By overflow test above."); 1.8 + assert(ind < _capacity, "By overflow test above."); 1.9 _base[ind] = ptr_arr[i]; 1.10 } 1.11 } 1.12 @@ -310,12 +310,12 @@ 1.13 if (res == index) { 1.14 MemRegion mr = _base[next_index]; 1.15 if (mr.start() != NULL) { 1.16 - tmp_guarantee_CM( mr.end() != NULL, "invariant" ); 1.17 - tmp_guarantee_CM( mr.word_size() > 0, "invariant" ); 1.18 + assert(mr.end() != NULL, "invariant"); 1.19 + assert(mr.word_size() > 0, "invariant"); 1.20 return mr; 1.21 } else { 1.22 // that entry was invalidated... let's skip it 1.23 - tmp_guarantee_CM( mr.end() == NULL, "invariant" ); 1.24 + assert(mr.end() == NULL, "invariant"); 1.25 } 1.26 } 1.27 // Otherwise, we need to try again. 1.28 @@ -328,10 +328,10 @@ 1.29 for (int i = 0; i < _oops_do_bound; ++i) { 1.30 MemRegion mr = _base[i]; 1.31 if (mr.start() != NULL) { 1.32 - tmp_guarantee_CM( mr.end() != NULL, "invariant"); 1.33 - tmp_guarantee_CM( mr.word_size() > 0, "invariant" ); 1.34 + assert(mr.end() != NULL, "invariant"); 1.35 + assert(mr.word_size() > 0, "invariant"); 1.36 HeapRegion* hr = g1h->heap_region_containing(mr.start()); 1.37 - tmp_guarantee_CM( hr != NULL, "invariant" ); 1.38 + assert(hr != NULL, "invariant"); 1.39 if (hr->in_collection_set()) { 1.40 // The region points into the collection set 1.41 _base[i] = MemRegion(); 1.42 @@ -339,7 +339,7 @@ 1.43 } 1.44 } else { 1.45 // that entry was invalidated... let's skip it 1.46 - tmp_guarantee_CM( mr.end() == NULL, "invariant" ); 1.47 + assert(mr.end() == NULL, "invariant"); 1.48 } 1.49 } 1.50 return result; 1.51 @@ -542,7 +542,7 @@ 1.52 gclog_or_tty->print_cr("CL Sleep Factor %1.4lf", cleanup_sleep_factor()); 1.53 #endif 1.54 1.55 - guarantee( parallel_marking_threads() > 0, "peace of mind" ); 1.56 + guarantee(parallel_marking_threads() > 0, "peace of mind"); 1.57 _parallel_workers = new WorkGang("G1 Parallel Marking Threads", 1.58 (int) parallel_marking_threads(), false, true); 1.59 if (_parallel_workers == NULL) 1.60 @@ -569,8 +569,7 @@ 1.61 return; 1.62 1.63 MemRegion committed = _g1h->g1_committed(); 1.64 - tmp_guarantee_CM( committed.start() == _heap_start, 1.65 - "start shouldn't change" ); 1.66 + assert(committed.start() == _heap_start, "start shouldn't change"); 1.67 HeapWord* new_end = committed.end(); 1.68 if (new_end > _heap_end) { 1.69 // The heap has been expanded. 1.70 @@ -592,9 +591,10 @@ 1.71 _heap_start = committed.start(); 1.72 _heap_end = committed.end(); 1.73 1.74 - guarantee( _heap_start != NULL && 1.75 - _heap_end != NULL && 1.76 - _heap_start < _heap_end, "heap bounds should look ok" ); 1.77 + // Separated the asserts so that we know which one fires. 1.78 + assert(_heap_start != NULL, "heap bounds should look ok"); 1.79 + assert(_heap_end != NULL, "heap bounds should look ok"); 1.80 + assert(_heap_start < _heap_end, "heap bounds should look ok"); 1.81 1.82 // reset all the marking data structures and any necessary flags 1.83 clear_marking_state(); 1.84 @@ -614,7 +614,7 @@ 1.85 } 1.86 1.87 void ConcurrentMark::set_phase(size_t active_tasks, bool concurrent) { 1.88 - guarantee( active_tasks <= _max_task_num, "we should not have more" ); 1.89 + assert(active_tasks <= _max_task_num, "we should not have more"); 1.90 1.91 _active_tasks = active_tasks; 1.92 // Need to update the three data structures below according to the 1.93 @@ -634,8 +634,8 @@ 1.94 // We currently assume that the concurrent flag has been set to 1.95 // false before we start remark. At this point we should also be 1.96 // in a STW phase. 1.97 - guarantee( !concurrent_marking_in_progress(), "invariant" ); 1.98 - guarantee( _finger == _heap_end, "only way to get here" ); 1.99 + assert(!concurrent_marking_in_progress(), "invariant"); 1.100 + assert(_finger == _heap_end, "only way to get here"); 1.101 update_g1_committed(true); 1.102 } 1.103 } 1.104 @@ -933,8 +933,8 @@ 1.105 // initial-mark that the committed space is expanded during the 1.106 // pause without CM observing this change. So the assertions below 1.107 // is a bit conservative; but better than nothing. 1.108 - tmp_guarantee_CM( _g1h->g1_committed().contains(addr), 1.109 - "address should be within the heap bounds" ); 1.110 + assert(_g1h->g1_committed().contains(addr), 1.111 + "address should be within the heap bounds"); 1.112 1.113 if (!_nextMarkBitMap->isMarked(addr)) 1.114 _nextMarkBitMap->parMark(addr); 1.115 @@ -960,12 +960,15 @@ 1.116 if (mr.start() < finger) { 1.117 // The finger is always heap region aligned and it is not possible 1.118 // for mr to span heap regions. 1.119 - tmp_guarantee_CM( mr.end() <= finger, "invariant" ); 1.120 - 1.121 - tmp_guarantee_CM( mr.start() <= mr.end() && 1.122 - _heap_start <= mr.start() && 1.123 - mr.end() <= _heap_end, 1.124 - "region boundaries should fall within the committed space" ); 1.125 + assert(mr.end() <= finger, "invariant"); 1.126 + 1.127 + // Separated the asserts so that we know which one fires. 1.128 + assert(mr.start() <= mr.end(), 1.129 + "region boundaries should fall within the committed space"); 1.130 + assert(_heap_start <= mr.start(), 1.131 + "region boundaries should fall within the committed space"); 1.132 + assert(mr.end() <= _heap_end, 1.133 + "region boundaries should fall within the committed space"); 1.134 if (verbose_low()) 1.135 gclog_or_tty->print_cr("[global] region ["PTR_FORMAT", "PTR_FORMAT") " 1.136 "below the finger, pushing it", 1.137 @@ -1014,14 +1017,14 @@ 1.138 1.139 public: 1.140 void work(int worker_i) { 1.141 - guarantee( Thread::current()->is_ConcurrentGC_thread(), 1.142 - "this should only be done by a conc GC thread" ); 1.143 + assert(Thread::current()->is_ConcurrentGC_thread(), 1.144 + "this should only be done by a conc GC thread"); 1.145 1.146 double start_vtime = os::elapsedVTime(); 1.147 1.148 ConcurrentGCThread::stsJoin(); 1.149 1.150 - guarantee( (size_t)worker_i < _cm->active_tasks(), "invariant" ); 1.151 + assert((size_t) worker_i < _cm->active_tasks(), "invariant"); 1.152 CMTask* the_task = _cm->task(worker_i); 1.153 the_task->record_start_time(); 1.154 if (!_cm->has_aborted()) { 1.155 @@ -1059,7 +1062,7 @@ 1.156 } while (!_cm->has_aborted() && the_task->has_aborted()); 1.157 } 1.158 the_task->record_end_time(); 1.159 - guarantee( !the_task->has_aborted() || _cm->has_aborted(), "invariant" ); 1.160 + guarantee(!the_task->has_aborted() || _cm->has_aborted(), "invariant"); 1.161 1.162 ConcurrentGCThread::stsLeave(); 1.163 1.164 @@ -1182,8 +1185,7 @@ 1.165 void mark_card_num_range(intptr_t start_card_num, intptr_t last_card_num) { 1.166 for (intptr_t i = start_card_num; i <= last_card_num; i++) { 1.167 #if CARD_BM_TEST_MODE 1.168 - guarantee(_card_bm->at(i - _bottom_card_num), 1.169 - "Should already be set."); 1.170 + guarantee(_card_bm->at(i - _bottom_card_num), "Should already be set."); 1.171 #else 1.172 _card_bm->par_at_put(i - _bottom_card_num, 1); 1.173 #endif 1.174 @@ -1442,7 +1444,7 @@ 1.175 } 1.176 assert(calccl.complete(), "Shouldn't have yielded!"); 1.177 1.178 - guarantee( (size_t)i < _n_workers, "invariant" ); 1.179 + assert((size_t) i < _n_workers, "invariant"); 1.180 _live_bytes[i] = calccl.tot_live(); 1.181 _used_bytes[i] = calccl.tot_used(); 1.182 } 1.183 @@ -1774,14 +1776,14 @@ 1.184 hd->rem_set()->clear(); 1.185 HeapRegion* next_hd = hd->next_from_unclean_list(); 1.186 (void)list->pop(); 1.187 - guarantee(list->hd() == next_hd, "how not?"); 1.188 + assert(list->hd() == next_hd, "how not?"); 1.189 _g1h->put_region_on_unclean_list(hd); 1.190 if (!hd->isHumongous()) { 1.191 // Add this to the _free_regions count by 1. 1.192 _g1h->finish_free_region_work(0, 0, 1, NULL); 1.193 } 1.194 hd = list->hd(); 1.195 - guarantee(hd == next_hd, "how not?"); 1.196 + assert(hd == next_hd, "how not?"); 1.197 } 1.198 } 1.199 } 1.200 @@ -1931,9 +1933,6 @@ 1.201 g1h->set_par_threads(n_workers); 1.202 g1h->workers()->run_task(&remarkTask); 1.203 g1h->set_par_threads(0); 1.204 - 1.205 - SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); 1.206 - guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); 1.207 } else { 1.208 G1CollectedHeap::StrongRootsScope srs(g1h); 1.209 // this is remark, so we'll use up all available threads 1.210 @@ -1945,10 +1944,9 @@ 1.211 // active_workers will be fewer. The extra ones will just bail out 1.212 // immediately. 1.213 remarkTask.work(0); 1.214 - 1.215 - SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); 1.216 - guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); 1.217 } 1.218 + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); 1.219 + guarantee(satb_mq_set.completed_buffers_num() == 0, "invariant"); 1.220 1.221 print_stats(); 1.222 1.223 @@ -1989,7 +1987,7 @@ 1.224 str = "outside G1 reserved"; 1.225 else { 1.226 HeapRegion* hr = _g1h->heap_region_containing(obj); 1.227 - guarantee( hr != NULL, "invariant" ); 1.228 + guarantee(hr != NULL, "invariant"); 1.229 if (hr->obj_allocated_since_prev_marking(obj)) { 1.230 str = "over TAMS"; 1.231 if (_bitmap->isMarked((HeapWord*) obj)) 1.232 @@ -2125,7 +2123,7 @@ 1.233 HeapWord* objAddr = (HeapWord*) obj; 1.234 assert(obj->is_oop_or_null(true /* ignore mark word */), "Error"); 1.235 if (_g1h->is_in_g1_reserved(objAddr)) { 1.236 - tmp_guarantee_CM( obj != NULL, "is_in_g1_reserved should ensure this" ); 1.237 + assert(obj != NULL, "is_in_g1_reserved should ensure this"); 1.238 HeapRegion* hr = _g1h->heap_region_containing(obj); 1.239 if (_g1h->is_obj_ill(obj, hr)) { 1.240 if (verbose_high()) 1.241 @@ -2167,7 +2165,7 @@ 1.242 satb_mq_set.iterate_closure_all_threads(); 1.243 1.244 satb_mq_set.set_closure(NULL); 1.245 - guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); 1.246 + assert(satb_mq_set.completed_buffers_num() == 0, "invariant"); 1.247 } 1.248 1.249 void ConcurrentMark::markPrev(oop p) { 1.250 @@ -2200,7 +2198,7 @@ 1.251 // _heap_end will not change underneath our feet; it only changes at 1.252 // yield points. 1.253 while (finger < _heap_end) { 1.254 - tmp_guarantee_CM( _g1h->is_in_g1_reserved(finger), "invariant" ); 1.255 + assert(_g1h->is_in_g1_reserved(finger), "invariant"); 1.256 1.257 // is the gap between reading the finger and doing the CAS too long? 1.258 1.259 @@ -2222,7 +2220,7 @@ 1.260 1.261 // notice that _finger == end cannot be guaranteed here since, 1.262 // someone else might have moved the finger even further 1.263 - guarantee( _finger >= end, "the finger should have moved forward" ); 1.264 + assert(_finger >= end, "the finger should have moved forward"); 1.265 1.266 if (verbose_low()) 1.267 gclog_or_tty->print_cr("[%d] we were successful with region = " 1.268 @@ -2234,8 +2232,8 @@ 1.269 "returning it ", task_num, curr_region); 1.270 return curr_region; 1.271 } else { 1.272 - tmp_guarantee_CM( limit == bottom, 1.273 - "the region limit should be at bottom" ); 1.274 + assert(limit == bottom, 1.275 + "the region limit should be at bottom"); 1.276 if (verbose_low()) 1.277 gclog_or_tty->print_cr("[%d] region "PTR_FORMAT" is empty, " 1.278 "returning NULL", task_num, curr_region); 1.279 @@ -2244,7 +2242,7 @@ 1.280 return NULL; 1.281 } 1.282 } else { 1.283 - guarantee( _finger > finger, "the finger should have moved forward" ); 1.284 + assert(_finger > finger, "the finger should have moved forward"); 1.285 if (verbose_low()) 1.286 gclog_or_tty->print_cr("[%d] somebody else moved the finger, " 1.287 "global finger = "PTR_FORMAT", " 1.288 @@ -2282,7 +2280,7 @@ 1.289 if (_regionStack.invalidate_entries_into_cset()) { 1.290 // otherwise, any gray objects copied during the evacuation pause 1.291 // might not be visited. 1.292 - guarantee( _should_gray_objects, "invariant" ); 1.293 + assert(_should_gray_objects, "invariant"); 1.294 } 1.295 } 1.296 1.297 @@ -2715,12 +2713,12 @@ 1.298 1.299 bool do_bit(size_t offset) { 1.300 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset); 1.301 - tmp_guarantee_CM( _nextMarkBitMap->isMarked(addr), "invariant" ); 1.302 - tmp_guarantee_CM( addr < _cm->finger(), "invariant" ); 1.303 + assert(_nextMarkBitMap->isMarked(addr), "invariant"); 1.304 + assert( addr < _cm->finger(), "invariant"); 1.305 1.306 if (_scanning_heap_region) { 1.307 statsOnly( _task->increase_objs_found_on_bitmap() ); 1.308 - tmp_guarantee_CM( addr >= _task->finger(), "invariant" ); 1.309 + assert(addr >= _task->finger(), "invariant"); 1.310 // We move that task's local finger along. 1.311 _task->move_finger_to(addr); 1.312 } else { 1.313 @@ -2765,8 +2763,9 @@ 1.314 virtual void do_oop( oop* p) { do_oop_work(p); } 1.315 1.316 template <class T> void do_oop_work(T* p) { 1.317 - tmp_guarantee_CM( _g1h->is_in_g1_reserved((HeapWord*) p), "invariant" ); 1.318 - tmp_guarantee_CM( !_g1h->heap_region_containing((HeapWord*) p)->is_on_free_list(), "invariant" ); 1.319 + assert(_g1h->is_in_g1_reserved((HeapWord*) p), "invariant"); 1.320 + assert(!_g1h->heap_region_containing((HeapWord*) p)->is_on_free_list(), 1.321 + "invariant"); 1.322 1.323 oop obj = oopDesc::load_decode_heap_oop(p); 1.324 if (_cm->verbose_high()) 1.325 @@ -2783,8 +2782,11 @@ 1.326 }; 1.327 1.328 void CMTask::setup_for_region(HeapRegion* hr) { 1.329 - tmp_guarantee_CM( hr != NULL && !hr->continuesHumongous(), 1.330 - "claim_region() should have filtered out continues humongous regions" ); 1.331 + // Separated the asserts so that we know which one fires. 1.332 + assert(hr != NULL, 1.333 + "claim_region() should have filtered out continues humongous regions"); 1.334 + assert(!hr->continuesHumongous(), 1.335 + "claim_region() should have filtered out continues humongous regions"); 1.336 1.337 if (_cm->verbose_low()) 1.338 gclog_or_tty->print_cr("[%d] setting up for region "PTR_FORMAT, 1.339 @@ -2812,9 +2814,9 @@ 1.340 // as the region is not supposed to be empty in the first place) 1.341 _finger = bottom; 1.342 } else if (limit >= _region_limit) { 1.343 - tmp_guarantee_CM( limit >= _finger, "peace of mind" ); 1.344 + assert(limit >= _finger, "peace of mind"); 1.345 } else { 1.346 - tmp_guarantee_CM( limit < _region_limit, "only way to get here" ); 1.347 + assert(limit < _region_limit, "only way to get here"); 1.348 // This can happen under some pretty unusual circumstances. An 1.349 // evacuation pause empties the region underneath our feet (NTAMS 1.350 // at bottom). We then do some allocation in the region (NTAMS 1.351 @@ -2832,7 +2834,7 @@ 1.352 } 1.353 1.354 void CMTask::giveup_current_region() { 1.355 - tmp_guarantee_CM( _curr_region != NULL, "invariant" ); 1.356 + assert(_curr_region != NULL, "invariant"); 1.357 if (_cm->verbose_low()) 1.358 gclog_or_tty->print_cr("[%d] giving up region "PTR_FORMAT, 1.359 _task_id, _curr_region); 1.360 @@ -2850,7 +2852,7 @@ 1.361 } 1.362 1.363 void CMTask::reset(CMBitMap* nextMarkBitMap) { 1.364 - guarantee( nextMarkBitMap != NULL, "invariant" ); 1.365 + guarantee(nextMarkBitMap != NULL, "invariant"); 1.366 1.367 if (_cm->verbose_low()) 1.368 gclog_or_tty->print_cr("[%d] resetting", _task_id); 1.369 @@ -2916,7 +2918,7 @@ 1.370 HeapWord* objAddr = (HeapWord*) obj; 1.371 assert(obj->is_oop_or_null(true /* ignore mark word */), "Error"); 1.372 if (_g1h->is_in_g1_reserved(objAddr)) { 1.373 - tmp_guarantee_CM( obj != NULL, "is_in_g1_reserved should ensure this" ); 1.374 + assert(obj != NULL, "is_in_g1_reserved should ensure this"); 1.375 HeapRegion* hr = _g1h->heap_region_containing(obj); 1.376 if (_g1h->is_obj_ill(obj, hr)) { 1.377 if (_cm->verbose_high()) 1.378 @@ -2977,10 +2979,11 @@ 1.379 1.380 void CMTask::push(oop obj) { 1.381 HeapWord* objAddr = (HeapWord*) obj; 1.382 - tmp_guarantee_CM( _g1h->is_in_g1_reserved(objAddr), "invariant" ); 1.383 - tmp_guarantee_CM( !_g1h->heap_region_containing(objAddr)->is_on_free_list(), "invariant" ); 1.384 - tmp_guarantee_CM( !_g1h->is_obj_ill(obj), "invariant" ); 1.385 - tmp_guarantee_CM( _nextMarkBitMap->isMarked(objAddr), "invariant" ); 1.386 + assert(_g1h->is_in_g1_reserved(objAddr), "invariant"); 1.387 + assert(!_g1h->heap_region_containing(objAddr)->is_on_free_list(), 1.388 + "invariant"); 1.389 + assert(!_g1h->is_obj_ill(obj), "invariant"); 1.390 + assert(_nextMarkBitMap->isMarked(objAddr), "invariant"); 1.391 1.392 if (_cm->verbose_high()) 1.393 gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj); 1.394 @@ -2999,7 +3002,7 @@ 1.395 // stack, we should have definitely removed some entries from the 1.396 // local queue. So, there must be space on it. 1.397 bool success = _task_queue->push(obj); 1.398 - tmp_guarantee_CM( success, "invariant" ); 1.399 + assert(success, "invariant"); 1.400 } 1.401 1.402 statsOnly( int tmp_size = _task_queue->size(); 1.403 @@ -3009,9 +3012,9 @@ 1.404 } 1.405 1.406 void CMTask::reached_limit() { 1.407 - tmp_guarantee_CM( _words_scanned >= _words_scanned_limit || 1.408 - _refs_reached >= _refs_reached_limit , 1.409 - "shouldn't have been called otherwise" ); 1.410 + assert(_words_scanned >= _words_scanned_limit || 1.411 + _refs_reached >= _refs_reached_limit , 1.412 + "shouldn't have been called otherwise"); 1.413 regular_clock_call(); 1.414 } 1.415 1.416 @@ -3169,8 +3172,8 @@ 1.417 oop buffer[global_stack_transfer_size]; 1.418 int n; 1.419 _cm->mark_stack_pop(buffer, global_stack_transfer_size, &n); 1.420 - tmp_guarantee_CM( n <= global_stack_transfer_size, 1.421 - "we should not pop more than the given limit" ); 1.422 + assert(n <= global_stack_transfer_size, 1.423 + "we should not pop more than the given limit"); 1.424 if (n > 0) { 1.425 // yes, we did actually pop at least one entry 1.426 1.427 @@ -3182,7 +3185,7 @@ 1.428 bool success = _task_queue->push(buffer[i]); 1.429 // We only call this when the local queue is empty or under a 1.430 // given target limit. So, we do not expect this push to fail. 1.431 - tmp_guarantee_CM( success, "invariant" ); 1.432 + assert(success, "invariant"); 1.433 } 1.434 1.435 statsOnly( int tmp_size = _task_queue->size(); 1.436 @@ -3222,10 +3225,9 @@ 1.437 gclog_or_tty->print_cr("[%d] popped "PTR_FORMAT, _task_id, 1.438 (void*) obj); 1.439 1.440 - tmp_guarantee_CM( _g1h->is_in_g1_reserved((HeapWord*) obj), 1.441 - "invariant" ); 1.442 - tmp_guarantee_CM( !_g1h->heap_region_containing(obj)->is_on_free_list(), 1.443 - "invariant" ); 1.444 + assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); 1.445 + assert(!_g1h->heap_region_containing(obj)->is_on_free_list(), 1.446 + "invariant"); 1.447 1.448 scan_object(obj); 1.449 1.450 @@ -3247,7 +3249,7 @@ 1.451 1.452 // We have a policy to drain the local queue before we attempt to 1.453 // drain the global stack. 1.454 - tmp_guarantee_CM( partially || _task_queue->size() == 0, "invariant" ); 1.455 + assert(partially || _task_queue->size() == 0, "invariant"); 1.456 1.457 // Decide what the target size is, depending whether we're going to 1.458 // drain it partially (so that other tasks can steal if they run out 1.459 @@ -3328,9 +3330,9 @@ 1.460 1.461 _draining_satb_buffers = false; 1.462 1.463 - tmp_guarantee_CM( has_aborted() || 1.464 - concurrent() || 1.465 - satb_mq_set.completed_buffers_num() == 0, "invariant" ); 1.466 + assert(has_aborted() || 1.467 + concurrent() || 1.468 + satb_mq_set.completed_buffers_num() == 0, "invariant"); 1.469 1.470 if (ParallelGCThreads > 0) 1.471 satb_mq_set.set_par_closure(_task_id, NULL); 1.472 @@ -3346,8 +3348,8 @@ 1.473 if (has_aborted()) 1.474 return; 1.475 1.476 - tmp_guarantee_CM( _region_finger == NULL, 1.477 - "it should be NULL when we're not scanning a region" ); 1.478 + assert(_region_finger == NULL, 1.479 + "it should be NULL when we're not scanning a region"); 1.480 1.481 if (!_cm->region_stack_empty()) { 1.482 if (_cm->verbose_low()) 1.483 @@ -3363,12 +3365,12 @@ 1.484 gclog_or_tty->print_cr("[%d] we are scanning region " 1.485 "["PTR_FORMAT", "PTR_FORMAT")", 1.486 _task_id, mr.start(), mr.end()); 1.487 - tmp_guarantee_CM( mr.end() <= _cm->finger(), 1.488 - "otherwise the region shouldn't be on the stack" ); 1.489 + assert(mr.end() <= _cm->finger(), 1.490 + "otherwise the region shouldn't be on the stack"); 1.491 assert(!mr.is_empty(), "Only non-empty regions live on the region stack"); 1.492 if (_nextMarkBitMap->iterate(bc, mr)) { 1.493 - tmp_guarantee_CM( !has_aborted(), 1.494 - "cannot abort the task without aborting the bitmap iteration" ); 1.495 + assert(!has_aborted(), 1.496 + "cannot abort the task without aborting the bitmap iteration"); 1.497 1.498 // We finished iterating over the region without aborting. 1.499 regular_clock_call(); 1.500 @@ -3380,14 +3382,14 @@ 1.501 statsOnly(if (mr.start() != NULL) ++_region_stack_pops ); 1.502 } 1.503 } else { 1.504 - guarantee( has_aborted(), "currently the only way to do so" ); 1.505 + assert(has_aborted(), "currently the only way to do so"); 1.506 1.507 // The only way to abort the bitmap iteration is to return 1.508 // false from the do_bit() method. However, inside the 1.509 // do_bit() method we move the _region_finger to point to the 1.510 // object currently being looked at. So, if we bail out, we 1.511 // have definitely set _region_finger to something non-null. 1.512 - guarantee( _region_finger != NULL, "invariant" ); 1.513 + assert(_region_finger != NULL, "invariant"); 1.514 1.515 // The iteration was actually aborted. So now _region_finger 1.516 // points to the address of the object we last scanned. If we 1.517 @@ -3573,21 +3575,21 @@ 1.518 *****************************************************************************/ 1.519 1.520 void CMTask::do_marking_step(double time_target_ms) { 1.521 - guarantee( time_target_ms >= 1.0, "minimum granularity is 1ms" ); 1.522 - guarantee( concurrent() == _cm->concurrent(), "they should be the same" ); 1.523 - 1.524 - guarantee( concurrent() || _cm->region_stack_empty(), 1.525 - "the region stack should have been cleared before remark" ); 1.526 - guarantee( _region_finger == NULL, 1.527 - "this should be non-null only when a region is being scanned" ); 1.528 + assert(time_target_ms >= 1.0, "minimum granularity is 1ms"); 1.529 + assert(concurrent() == _cm->concurrent(), "they should be the same"); 1.530 + 1.531 + assert(concurrent() || _cm->region_stack_empty(), 1.532 + "the region stack should have been cleared before remark"); 1.533 + assert(_region_finger == NULL, 1.534 + "this should be non-null only when a region is being scanned"); 1.535 1.536 G1CollectorPolicy* g1_policy = _g1h->g1_policy(); 1.537 - guarantee( _task_queues != NULL, "invariant" ); 1.538 - guarantee( _task_queue != NULL, "invariant" ); 1.539 - guarantee( _task_queues->queue(_task_id) == _task_queue, "invariant" ); 1.540 - 1.541 - guarantee( !_claimed, 1.542 - "only one thread should claim this task at any one time" ); 1.543 + assert(_task_queues != NULL, "invariant"); 1.544 + assert(_task_queue != NULL, "invariant"); 1.545 + assert(_task_queues->queue(_task_id) == _task_queue, "invariant"); 1.546 + 1.547 + assert(!_claimed, 1.548 + "only one thread should claim this task at any one time"); 1.549 1.550 // OK, this doesn't safeguard again all possible scenarios, as it is 1.551 // possible for two threads to set the _claimed flag at the same 1.552 @@ -3658,9 +3660,8 @@ 1.553 do { 1.554 if (!has_aborted() && _curr_region != NULL) { 1.555 // This means that we're already holding on to a region. 1.556 - tmp_guarantee_CM( _finger != NULL, 1.557 - "if region is not NULL, then the finger " 1.558 - "should not be NULL either" ); 1.559 + assert(_finger != NULL, "if region is not NULL, then the finger " 1.560 + "should not be NULL either"); 1.561 1.562 // We might have restarted this task after an evacuation pause 1.563 // which might have evacuated the region we're holding on to 1.564 @@ -3692,13 +3693,13 @@ 1.565 giveup_current_region(); 1.566 regular_clock_call(); 1.567 } else { 1.568 - guarantee( has_aborted(), "currently the only way to do so" ); 1.569 + assert(has_aborted(), "currently the only way to do so"); 1.570 // The only way to abort the bitmap iteration is to return 1.571 // false from the do_bit() method. However, inside the 1.572 // do_bit() method we move the _finger to point to the 1.573 // object currently being looked at. So, if we bail out, we 1.574 // have definitely set _finger to something non-null. 1.575 - guarantee( _finger != NULL, "invariant" ); 1.576 + assert(_finger != NULL, "invariant"); 1.577 1.578 // Region iteration was actually aborted. So now _finger 1.579 // points to the address of the object we last scanned. If we 1.580 @@ -3725,9 +3726,10 @@ 1.581 while (!has_aborted() && _curr_region == NULL && !_cm->out_of_regions()) { 1.582 // We are going to try to claim a new region. We should have 1.583 // given up on the previous one. 1.584 - tmp_guarantee_CM( _curr_region == NULL && 1.585 - _finger == NULL && 1.586 - _region_limit == NULL, "invariant" ); 1.587 + // Separated the asserts so that we know which one fires. 1.588 + assert(_curr_region == NULL, "invariant"); 1.589 + assert(_finger == NULL, "invariant"); 1.590 + assert(_region_limit == NULL, "invariant"); 1.591 if (_cm->verbose_low()) 1.592 gclog_or_tty->print_cr("[%d] trying to claim a new region", _task_id); 1.593 HeapRegion* claimed_region = _cm->claim_region(_task_id); 1.594 @@ -3741,7 +3743,7 @@ 1.595 _task_id, claimed_region); 1.596 1.597 setup_for_region(claimed_region); 1.598 - tmp_guarantee_CM( _curr_region == claimed_region, "invariant" ); 1.599 + assert(_curr_region == claimed_region, "invariant"); 1.600 } 1.601 // It is important to call the regular clock here. It might take 1.602 // a while to claim a region if, for example, we hit a large 1.603 @@ -3752,8 +3754,8 @@ 1.604 } 1.605 1.606 if (!has_aborted() && _curr_region == NULL) { 1.607 - tmp_guarantee_CM( _cm->out_of_regions(), 1.608 - "at this point we should be out of regions" ); 1.609 + assert(_cm->out_of_regions(), 1.610 + "at this point we should be out of regions"); 1.611 } 1.612 } while ( _curr_region != NULL && !has_aborted()); 1.613 1.614 @@ -3762,8 +3764,8 @@ 1.615 // tasks might be pushing objects to it concurrently. We also cannot 1.616 // check if the region stack is empty because if a thread is aborting 1.617 // it can push a partially done region back. 1.618 - tmp_guarantee_CM( _cm->out_of_regions(), 1.619 - "at this point we should be out of regions" ); 1.620 + assert(_cm->out_of_regions(), 1.621 + "at this point we should be out of regions"); 1.622 1.623 if (_cm->verbose_low()) 1.624 gclog_or_tty->print_cr("[%d] all regions claimed", _task_id); 1.625 @@ -3787,8 +3789,8 @@ 1.626 // tasks might be pushing objects to it concurrently. We also cannot 1.627 // check if the region stack is empty because if a thread is aborting 1.628 // it can push a partially done region back. 1.629 - guarantee( _cm->out_of_regions() && 1.630 - _task_queue->size() == 0, "only way to reach here" ); 1.631 + assert(_cm->out_of_regions() && _task_queue->size() == 0, 1.632 + "only way to reach here"); 1.633 1.634 if (_cm->verbose_low()) 1.635 gclog_or_tty->print_cr("[%d] starting to steal", _task_id); 1.636 @@ -3804,8 +3806,8 @@ 1.637 1.638 statsOnly( ++_steals ); 1.639 1.640 - tmp_guarantee_CM( _nextMarkBitMap->isMarked((HeapWord*) obj), 1.641 - "any stolen object should be marked" ); 1.642 + assert(_nextMarkBitMap->isMarked((HeapWord*) obj), 1.643 + "any stolen object should be marked"); 1.644 scan_object(obj); 1.645 1.646 // And since we're towards the end, let's totally drain the 1.647 @@ -3825,8 +3827,9 @@ 1.648 // tasks might be concurrently pushing objects on it. We also cannot 1.649 // check if the region stack is empty because if a thread is aborting 1.650 // it can push a partially done region back. 1.651 - guarantee( _cm->out_of_regions() && 1.652 - _task_queue->size() == 0, "only way to reach here" ); 1.653 + // Separated the asserts so that we know which one fires. 1.654 + assert(_cm->out_of_regions(), "only way to reach here"); 1.655 + assert(_task_queue->size() == 0, "only way to reach here"); 1.656 1.657 if (_cm->verbose_low()) 1.658 gclog_or_tty->print_cr("[%d] starting termination protocol", _task_id); 1.659 @@ -3846,7 +3849,7 @@ 1.660 if (_task_id == 0) { 1.661 // let's allow task 0 to do this 1.662 if (concurrent()) { 1.663 - guarantee( _cm->concurrent_marking_in_progress(), "invariant" ); 1.664 + assert(_cm->concurrent_marking_in_progress(), "invariant"); 1.665 // we need to set this to false before the next 1.666 // safepoint. This way we ensure that the marking phase 1.667 // doesn't observe any more heap expansions. 1.668 @@ -3855,15 +3858,16 @@ 1.669 } 1.670 1.671 // We can now guarantee that the global stack is empty, since 1.672 - // all other tasks have finished. 1.673 - guarantee( _cm->out_of_regions() && 1.674 - _cm->region_stack_empty() && 1.675 - _cm->mark_stack_empty() && 1.676 - _task_queue->size() == 0 && 1.677 - !_cm->has_overflown() && 1.678 - !_cm->mark_stack_overflow() && 1.679 - !_cm->region_stack_overflow(), 1.680 - "only way to reach here" ); 1.681 + // all other tasks have finished. We separated the guarantees so 1.682 + // that, if a condition is false, we can immediately find out 1.683 + // which one. 1.684 + guarantee(_cm->out_of_regions(), "only way to reach here"); 1.685 + guarantee(_cm->region_stack_empty(), "only way to reach here"); 1.686 + guarantee(_cm->mark_stack_empty(), "only way to reach here"); 1.687 + guarantee(_task_queue->size() == 0, "only way to reach here"); 1.688 + guarantee(!_cm->has_overflown(), "only way to reach here"); 1.689 + guarantee(!_cm->mark_stack_overflow(), "only way to reach here"); 1.690 + guarantee(!_cm->region_stack_overflow(), "only way to reach here"); 1.691 1.692 if (_cm->verbose_low()) 1.693 gclog_or_tty->print_cr("[%d] all tasks terminated", _task_id); 1.694 @@ -3958,8 +3962,8 @@ 1.695 _task_queue(task_queue), 1.696 _task_queues(task_queues), 1.697 _oop_closure(NULL) { 1.698 - guarantee( task_queue != NULL, "invariant" ); 1.699 - guarantee( task_queues != NULL, "invariant" ); 1.700 + guarantee(task_queue != NULL, "invariant"); 1.701 + guarantee(task_queues != NULL, "invariant"); 1.702 1.703 statsOnly( _clock_due_to_scanning = 0; 1.704 _clock_due_to_marking = 0 );