< prev index next >

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

Print this page
rev 7994 : [mq]: filter


 280   assert(obj->is_oop_or_null(true /* ignore mark word */), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj)));
 281   if (_g1h->is_in_g1_reserved(objAddr)) {
 282     assert(obj != NULL, "null check is implicit");
 283     if (!_nextMarkBitMap->isMarked(objAddr)) {
 284       // Only get the containing region if the object is not marked on the
 285       // bitmap (otherwise, it's a waste of time since we won't do
 286       // anything with it).
 287       HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
 288       if (!hr->obj_allocated_since_next_marking(obj)) {
 289         if (_cm->verbose_high()) {
 290           gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
 291                                  _worker_id, p2i((void*) obj));
 292         }
 293 
 294         // we need to mark it first
 295         if (_cm->par_mark_and_count(obj, hr, _marked_bytes_array, _card_bm)) {
 296           // No OrderAccess:store_load() is needed. It is implicit in the
 297           // CAS done in CMBitMap::parMark() call in the routine above.
 298           HeapWord* global_finger = _cm->finger();
 299 
 300 #if _CHECK_BOTH_FINGERS_
 301           // we will check both the local and global fingers
 302 
 303           if (_finger != NULL && objAddr < _finger) {










 304             if (_cm->verbose_high()) {
 305               gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), "
 306                                      "pushing it", _worker_id, p2i(_finger));

 307             }
 308             push(obj);
 309           } else if (_curr_region != NULL && objAddr < _region_limit) {



 310             // do nothing
 311           } else if (objAddr < global_finger) {
 312             // Notice that the global finger might be moving forward
 313             // concurrently. This is not a problem. In the worst case, we
 314             // mark the object while it is above the global finger and, by
 315             // the time we read the global finger, it has moved forward
 316             // passed this object. In this case, the object will probably
 317             // be visited when a task is scanning the region and will also
 318             // be pushed on the stack. So, some duplicate work, but no
 319             // correctness problems.
 320 




 321             if (_cm->verbose_high()) {
 322               gclog_or_tty->print_cr("[%u] below the global finger "
 323                                      "("PTR_FORMAT"), pushing it",
 324                                      _worker_id, p2i(global_finger));
 325             }
 326             push(obj);

 327           } else {
 328             // do nothing
 329           }
 330 #else // _CHECK_BOTH_FINGERS_
 331           // we will only check the global finger
 332 
 333           if (objAddr < global_finger) {
 334             // see long comment above
 335 
 336             if (_cm->verbose_high()) {
 337               gclog_or_tty->print_cr("[%u] below the global finger "
 338                                      "("PTR_FORMAT"), pushing it",
 339                                      _worker_id, p2i(global_finger));
 340             }
 341             push(obj);
 342           }
 343 #endif // _CHECK_BOTH_FINGERS_
 344         }
 345       }
 346     }
 347   }
 348 }
 349 
 350 inline void ConcurrentMark::markPrev(oop p) {
 351   assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
 352   // Note we are overriding the read-only view of the prev map here, via
 353   // the cast.
 354   ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);
 355 }
 356 
 357 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
 358                                      uint worker_id, HeapRegion* hr) {
 359   assert(obj != NULL, "pre-condition");
 360   HeapWord* addr = (HeapWord*) obj;
 361   if (hr == NULL) {
 362     hr = _g1h->heap_region_containing_raw(addr);
 363   } else {




 280   assert(obj->is_oop_or_null(true /* ignore mark word */), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj)));
 281   if (_g1h->is_in_g1_reserved(objAddr)) {
 282     assert(obj != NULL, "null check is implicit");
 283     if (!_nextMarkBitMap->isMarked(objAddr)) {
 284       // Only get the containing region if the object is not marked on the
 285       // bitmap (otherwise, it's a waste of time since we won't do
 286       // anything with it).
 287       HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
 288       if (!hr->obj_allocated_since_next_marking(obj)) {
 289         if (_cm->verbose_high()) {
 290           gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
 291                                  _worker_id, p2i((void*) obj));
 292         }
 293 
 294         // we need to mark it first
 295         if (_cm->par_mark_and_count(obj, hr, _marked_bytes_array, _card_bm)) {
 296           // No OrderAccess:store_load() is needed. It is implicit in the
 297           // CAS done in CMBitMap::parMark() call in the routine above.
 298           HeapWord* global_finger = _cm->finger();
 299 
 300           if (_CHECK_BOTH_FINGERS_ && _finger != NULL && objAddr < _finger) {
 301             if (obj->is_typeArray()) {
 302               // Immediately process arrays of binary data, rather
 303               // than pushing on the mark stack.  This keeps us from
 304               // adding humongous objects to the mark stack that might
 305               // be reclaimed before the entry is processed - see
 306               // G1EagerReclaimHumongousPreSnapshotTypeArrays.  The
 307               // cost of the additional type test is mitigated by
 308               // avoiding a trip through the mark stack, and by only
 309               // doing bookkeeping update and avoiding the actual scan
 310               // of the object - a typeArray contains no references,
 311               // and the metadata is built-in.
 312               process_grey_object<false>(obj);
 313             } else {
 314               if (_cm->verbose_high()) {
 315                 gclog_or_tty->print_cr(
 316                   "[%u] below the local finger (" PTR_FORMAT "), pushing " PTR_FORMAT,
 317                   _worker_id, p2i(_finger), p2i(objAddr));
 318               }
 319               push(obj);
 320             }
 321           } else if (_CHECK_BOTH_FINGERS_ &&
 322                      _curr_region != NULL &&
 323                      objAddr < _region_limit) {
 324             // do nothing
 325           } else if (objAddr < global_finger) {
 326             // Notice that the global finger might be moving forward
 327             // concurrently. This is not a problem. In the worst case, we
 328             // mark the object while it is above the global finger and, by
 329             // the time we read the global finger, it has moved forward
 330             // passed this object. In this case, the object will probably
 331             // be visited when a task is scanning the region and will also
 332             // be pushed on the stack. So, some duplicate work, but no
 333             // correctness problems.
 334 
 335             if (obj->is_typeArray()) {
 336               // As above, immediately scan arrays of binary data.
 337               process_grey_object<false>(obj);
 338             } else {
 339               if (_cm->verbose_high()) {
 340                 gclog_or_tty->print_cr(
 341                   "[%u] below the global finger (" PTR_FORMAT "), pushing " PTR_FORMAT,
 342                   _worker_id, p2i(global_finger), p2i(objAddr));
 343               }
 344               push(obj);
 345             }
 346           } else {
 347             // do nothing
 348           }














 349         }
 350       }
 351     }
 352   }
 353 }
 354 
 355 inline void ConcurrentMark::markPrev(oop p) {
 356   assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
 357   // Note we are overriding the read-only view of the prev map here, via
 358   // the cast.
 359   ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);
 360 }
 361 
 362 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
 363                                      uint worker_id, HeapRegion* hr) {
 364   assert(obj != NULL, "pre-condition");
 365   HeapWord* addr = (HeapWord*) obj;
 366   if (hr == NULL) {
 367     hr = _g1h->heap_region_containing_raw(addr);
 368   } else {


< prev index next >