< prev index next >

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

Print this page
rev 8126 : [mq]: filter
rev 8127 : [mq]: inc4


 315         // we need to mark it first
 316         if (_cm->par_mark_and_count(obj, hr, _marked_bytes_array, _card_bm)) {
 317           // No OrderAccess:store_load() is needed. It is implicit in the
 318           // CAS done in CMBitMap::parMark() call in the routine above.
 319           HeapWord* global_finger = _cm->finger();
 320 
 321           // We only need to push a newly grey object on the mark
 322           // stack if it is in a section of memory the mark bitmap
 323           // scan has already examined.  Mark bitmap scanning
 324           // maintains progress "fingers" for determining that.
 325           //
 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           // past 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           if (is_below_finger(objAddr, global_finger)) {













 335             if (_cm->verbose_high()) {
 336               gclog_or_tty->print_cr("[%u] below a finger (local: " PTR_FORMAT
 337                                      ", global: " PTR_FORMAT ") pushing "
 338                                      PTR_FORMAT " on mark stack",
 339                                      _worker_id, p2i(_finger),
 340                                      p2i(global_finger), p2i(objAddr));
 341             }
 342             push(obj);

 343           }
 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);




 315         // we need to mark it first
 316         if (_cm->par_mark_and_count(obj, hr, _marked_bytes_array, _card_bm)) {
 317           // No OrderAccess:store_load() is needed. It is implicit in the
 318           // CAS done in CMBitMap::parMark() call in the routine above.
 319           HeapWord* global_finger = _cm->finger();
 320 
 321           // We only need to push a newly grey object on the mark
 322           // stack if it is in a section of memory the mark bitmap
 323           // scan has already examined.  Mark bitmap scanning
 324           // maintains progress "fingers" for determining that.
 325           //
 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           // past 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           if (is_below_finger(objAddr, global_finger)) {
 335             if (obj->is_typeArray()) {
 336               // Immediately process arrays of binary data, rather
 337               // than pushing on the mark stack.  This keeps us from
 338               // adding humongous objects to the mark stack that might
 339               // be reclaimed before the entry is processed - see
 340               // selection of candidates for eager reclaim of humongous
 341               // objects.  The cost of the additional type test is
 342               // mitigated by avoiding a trip through the mark stack,
 343               // by only doing a bookkeeping update and avoiding the
 344               // actual scan of the object - a typeArray contains no
 345               // references, and the metadata is built-in.
 346               process_grey_object<false>(obj);
 347             } else {
 348               if (_cm->verbose_high()) {
 349                 gclog_or_tty->print_cr("[%u] below a finger (local: " PTR_FORMAT
 350                                        ", global: " PTR_FORMAT ") pushing "
 351                                        PTR_FORMAT " on mark stack",
 352                                        _worker_id, p2i(_finger),
 353                                        p2i(global_finger), p2i(objAddr));
 354               }
 355               push(obj);
 356             }
 357           }
 358         }
 359       }
 360     }
 361   }
 362 }
 363 
 364 inline void ConcurrentMark::markPrev(oop p) {
 365   assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
 366   // Note we are overriding the read-only view of the prev map here, via
 367   // the cast.
 368   ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);
 369 }
 370 
 371 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
 372                                      uint worker_id, HeapRegion* hr) {
 373   assert(obj != NULL, "pre-condition");
 374   HeapWord* addr = (HeapWord*) obj;
 375   if (hr == NULL) {
 376     hr = _g1h->heap_region_containing_raw(addr);


< prev index next >