src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp

Print this page
rev 6807 : imported patch bengt-suggestions


 251     BitMap::idx_t end_offset = heapWordToOffset(end_addr);
 252 
 253     start_offset = _bm.get_next_one_offset(start_offset, end_offset);
 254     while (start_offset < end_offset) {
 255       if (!cl->do_bit(start_offset)) {
 256         return false;
 257       }
 258       HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
 259       BitMap::idx_t next_offset = heapWordToOffset(next_addr);
 260       start_offset = _bm.get_next_one_offset(next_offset, end_offset);
 261     }
 262   }
 263   return true;
 264 }
 265 
 266 inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
 267   MemRegion mr(startWord(), sizeInWords());
 268   return iterate(cl, mr);
 269 }
 270 






























 271 inline void CMTask::push(oop obj) {
 272   HeapWord* objAddr = (HeapWord*) obj;
 273   assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
 274   assert(!_g1h->is_on_master_free_list(
 275               _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
 276   assert(!_g1h->is_obj_ill(obj), "invariant");
 277   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
 278 
 279   if (_cm->verbose_high()) {
 280     gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
 281   }
 282 
 283   if (!_task_queue->push(obj)) {
 284     // The local task queue looks full. We need to push some entries
 285     // to the global stack.
 286 
 287     if (_cm->verbose_medium()) {
 288       gclog_or_tty->print_cr("[%u] task queue overflow, "
 289                              "moving entries to the global stack",
 290                              _worker_id);




 251     BitMap::idx_t end_offset = heapWordToOffset(end_addr);
 252 
 253     start_offset = _bm.get_next_one_offset(start_offset, end_offset);
 254     while (start_offset < end_offset) {
 255       if (!cl->do_bit(start_offset)) {
 256         return false;
 257       }
 258       HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
 259       BitMap::idx_t next_offset = heapWordToOffset(next_addr);
 260       start_offset = _bm.get_next_one_offset(next_offset, end_offset);
 261     }
 262   }
 263   return true;
 264 }
 265 
 266 inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
 267   MemRegion mr(startWord(), sizeInWords());
 268   return iterate(cl, mr);
 269 }
 270 
 271 #define check_mark(addr)                                                       \
 272   assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize),      \
 273          "outside underlying space?");                                         \
 274   assert(G1CollectedHeap::heap()->is_in_exact(addr),                           \
 275          err_msg("Trying to access not available bitmap "PTR_FORMAT            \
 276                  " corresponding to "PTR_FORMAT" (%u)",                        \
 277                  p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr)));
 278 
 279 inline void CMBitMap::mark(HeapWord* addr) {
 280   check_mark(addr);
 281   _bm.set_bit(heapWordToOffset(addr));
 282 }
 283 
 284 inline void CMBitMap::clear(HeapWord* addr) {
 285   check_mark(addr);
 286   _bm.clear_bit(heapWordToOffset(addr));
 287 }
 288 
 289 inline bool CMBitMap::parMark(HeapWord* addr) {
 290   check_mark(addr);
 291   return _bm.par_set_bit(heapWordToOffset(addr));
 292 }
 293 
 294 inline bool CMBitMap::parClear(HeapWord* addr) {
 295   check_mark(addr);
 296   return _bm.par_clear_bit(heapWordToOffset(addr));
 297 }
 298 
 299 #undef check_mark
 300 
 301 inline void CMTask::push(oop obj) {
 302   HeapWord* objAddr = (HeapWord*) obj;
 303   assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
 304   assert(!_g1h->is_on_master_free_list(
 305               _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
 306   assert(!_g1h->is_obj_ill(obj), "invariant");
 307   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
 308 
 309   if (_cm->verbose_high()) {
 310     gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
 311   }
 312 
 313   if (!_task_queue->push(obj)) {
 314     // The local task queue looks full. We need to push some entries
 315     // to the global stack.
 316 
 317     if (_cm->verbose_medium()) {
 318       gclog_or_tty->print_cr("[%u] task queue overflow, "
 319                              "moving entries to the global stack",
 320                              _worker_id);