< prev index next >

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

Print this page
rev 9847 : 8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
Summary: Fix remaining issues after 8146401


 168   HeapWord* end_addr = MIN2(endWord(), mr.end());
 169 
 170   if (end_addr > start_addr) {
 171     // Right-open interval [start-offset, end-offset).
 172     BitMap::idx_t start_offset = heapWordToOffset(start_addr);
 173     BitMap::idx_t end_offset = heapWordToOffset(end_addr);
 174 
 175     start_offset = _bm.get_next_one_offset(start_offset, end_offset);
 176     while (start_offset < end_offset) {
 177       if (!cl->do_bit(start_offset)) {
 178         return false;
 179       }
 180       HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
 181       BitMap::idx_t next_offset = heapWordToOffset(next_addr);
 182       start_offset = _bm.get_next_one_offset(next_offset, end_offset);
 183     }
 184   }
 185   return true;
 186 }
 187 








 188 #define check_mark(addr)                                                       \
 189   assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize),      \
 190          "outside underlying space?");                                         \
 191   assert(G1CollectedHeap::heap()->is_in_exact(addr),                           \
 192          "Trying to access not available bitmap " PTR_FORMAT                   \
 193          " corresponding to " PTR_FORMAT " (%u)",                              \
 194          p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr));
 195 
 196 inline void CMBitMap::mark(HeapWord* addr) {
 197   check_mark(addr);
 198   _bm.set_bit(heapWordToOffset(addr));
 199 }
 200 
 201 inline void CMBitMap::clear(HeapWord* addr) {
 202   check_mark(addr);
 203   _bm.clear_bit(heapWordToOffset(addr));
 204 }
 205 
 206 inline bool CMBitMap::parMark(HeapWord* addr) {
 207   check_mark(addr);


 334   assert(obj->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
 335   if (_g1h->is_in_g1_reserved(objAddr)) {
 336     assert(obj != NULL, "null check is implicit");
 337     if (!_nextMarkBitMap->isMarked(objAddr)) {
 338       // Only get the containing region if the object is not marked on the
 339       // bitmap (otherwise, it's a waste of time since we won't do
 340       // anything with it).
 341       HeapRegion* hr = _g1h->heap_region_containing(obj);
 342       if (!hr->obj_allocated_since_next_marking(obj)) {
 343         make_reference_grey(obj, hr);
 344       }
 345     }
 346   }
 347 }
 348 
 349 inline void ConcurrentMark::markPrev(oop p) {
 350   assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
 351   // Note we are overriding the read-only view of the prev map here, via
 352   // the cast.
 353   ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);









 354 }
 355 
 356 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
 357                                      uint worker_id, HeapRegion* hr) {
 358   assert(obj != NULL, "pre-condition");
 359   HeapWord* addr = (HeapWord*) obj;
 360   if (hr == NULL) {
 361     hr = _g1h->heap_region_containing(addr);
 362   } else {
 363     assert(hr->is_in(addr), "pre-condition");
 364   }
 365   assert(hr != NULL, "sanity");
 366   // Given that we're looking for a region that contains an object
 367   // header it's impossible to get back a HC region.
 368   assert(!hr->is_continues_humongous(), "sanity");
 369 
 370   if (addr < hr->next_top_at_mark_start()) {
 371     if (!_nextMarkBitMap->isMarked(addr)) {
 372       par_mark_and_count(obj, word_size, hr, worker_id);
 373     }


 168   HeapWord* end_addr = MIN2(endWord(), mr.end());
 169 
 170   if (end_addr > start_addr) {
 171     // Right-open interval [start-offset, end-offset).
 172     BitMap::idx_t start_offset = heapWordToOffset(start_addr);
 173     BitMap::idx_t end_offset = heapWordToOffset(end_addr);
 174 
 175     start_offset = _bm.get_next_one_offset(start_offset, end_offset);
 176     while (start_offset < end_offset) {
 177       if (!cl->do_bit(start_offset)) {
 178         return false;
 179       }
 180       HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
 181       BitMap::idx_t next_offset = heapWordToOffset(next_addr);
 182       start_offset = _bm.get_next_one_offset(next_offset, end_offset);
 183     }
 184   }
 185   return true;
 186 }
 187 
 188 // The argument addr should be the start address of a valid object
 189 HeapWord* CMBitMapRO::nextObject(HeapWord* addr) {
 190   oop obj = (oop) addr;
 191   HeapWord* res =  addr + obj->size();
 192   assert(offsetToHeapWord(heapWordToOffset(res)) == res, "sanity");
 193   return res;
 194 }
 195 
 196 #define check_mark(addr)                                                       \
 197   assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize),      \
 198          "outside underlying space?");                                         \
 199   assert(G1CollectedHeap::heap()->is_in_exact(addr),                           \
 200          "Trying to access not available bitmap " PTR_FORMAT                   \
 201          " corresponding to " PTR_FORMAT " (%u)",                              \
 202          p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr));
 203 
 204 inline void CMBitMap::mark(HeapWord* addr) {
 205   check_mark(addr);
 206   _bm.set_bit(heapWordToOffset(addr));
 207 }
 208 
 209 inline void CMBitMap::clear(HeapWord* addr) {
 210   check_mark(addr);
 211   _bm.clear_bit(heapWordToOffset(addr));
 212 }
 213 
 214 inline bool CMBitMap::parMark(HeapWord* addr) {
 215   check_mark(addr);


 342   assert(obj->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
 343   if (_g1h->is_in_g1_reserved(objAddr)) {
 344     assert(obj != NULL, "null check is implicit");
 345     if (!_nextMarkBitMap->isMarked(objAddr)) {
 346       // Only get the containing region if the object is not marked on the
 347       // bitmap (otherwise, it's a waste of time since we won't do
 348       // anything with it).
 349       HeapRegion* hr = _g1h->heap_region_containing(obj);
 350       if (!hr->obj_allocated_since_next_marking(obj)) {
 351         make_reference_grey(obj, hr);
 352       }
 353     }
 354   }
 355 }
 356 
 357 inline void ConcurrentMark::markPrev(oop p) {
 358   assert(!_prevMarkBitMap->isMarked((HeapWord*) p), "sanity");
 359   // Note we are overriding the read-only view of the prev map here, via
 360   // the cast.
 361   ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*) p);
 362 }
 363 
 364 bool ConcurrentMark::isPrevMarked(oop p) const {
 365   assert(p != NULL && p->is_oop(), "expected an oop");
 366   HeapWord* addr = (HeapWord*)p;
 367   assert(addr >= _prevMarkBitMap->startWord() ||
 368          addr < _prevMarkBitMap->endWord(), "in a region");
 369 
 370   return _prevMarkBitMap->isMarked(addr);
 371 }
 372 
 373 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
 374                                      uint worker_id, HeapRegion* hr) {
 375   assert(obj != NULL, "pre-condition");
 376   HeapWord* addr = (HeapWord*) obj;
 377   if (hr == NULL) {
 378     hr = _g1h->heap_region_containing(addr);
 379   } else {
 380     assert(hr->is_in(addr), "pre-condition");
 381   }
 382   assert(hr != NULL, "sanity");
 383   // Given that we're looking for a region that contains an object
 384   // header it's impossible to get back a HC region.
 385   assert(!hr->is_continues_humongous(), "sanity");
 386 
 387   if (addr < hr->next_top_at_mark_start()) {
 388     if (!_nextMarkBitMap->isMarked(addr)) {
 389       par_mark_and_count(obj, word_size, hr, worker_id);
 390     }
< prev index next >