179 if (!cl->do_bit(start_offset)) {
180 return false;
181 }
182 HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
183 BitMap::idx_t next_offset = heapWordToOffset(next_addr);
184 start_offset = _bm.get_next_one_offset(next_offset, end_offset);
185 }
186 }
187 return true;
188 }
189
190 inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
191 MemRegion mr(startWord(), sizeInWords());
192 return iterate(cl, mr);
193 }
194
195 #define check_mark(addr) \
196 assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize), \
197 "outside underlying space?"); \
198 assert(G1CollectedHeap::heap()->is_in_exact(addr), \
199 err_msg("Trying to access not available bitmap "PTR_FORMAT \
200 " corresponding to "PTR_FORMAT" (%u)", \
201 p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr)));
202
203 inline void CMBitMap::mark(HeapWord* addr) {
204 check_mark(addr);
205 _bm.set_bit(heapWordToOffset(addr));
206 }
207
208 inline void CMBitMap::clear(HeapWord* addr) {
209 check_mark(addr);
210 _bm.clear_bit(heapWordToOffset(addr));
211 }
212
213 inline bool CMBitMap::parMark(HeapWord* addr) {
214 check_mark(addr);
215 return _bm.par_set_bit(heapWordToOffset(addr));
216 }
217
218 inline bool CMBitMap::parClear(HeapWord* addr) {
219 check_mark(addr);
220 return _bm.par_clear_bit(heapWordToOffset(addr));
326 // by only doing a bookkeeping update and avoiding the
327 // actual scan of the object - a typeArray contains no
328 // references, and the metadata is built-in.
329 process_grey_object<false>(obj);
330 } else {
331 if (_cm->verbose_high()) {
332 gclog_or_tty->print_cr("[%u] below a finger (local: " PTR_FORMAT
333 ", global: " PTR_FORMAT ") pushing "
334 PTR_FORMAT " on mark stack",
335 _worker_id, p2i(_finger),
336 p2i(global_finger), p2i(obj));
337 }
338 push(obj);
339 }
340 }
341 }
342 }
343
344 inline void CMTask::deal_with_reference(oop obj) {
345 if (_cm->verbose_high()) {
346 gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT,
347 _worker_id, p2i((void*) obj));
348 }
349
350 increment_refs_reached();
351
352 HeapWord* objAddr = (HeapWord*) obj;
353 assert(obj->is_oop_or_null(true /* ignore mark word */), "Error");
354 if (_g1h->is_in_g1_reserved(objAddr)) {
355 assert(obj != NULL, "null check is implicit");
356 if (!_nextMarkBitMap->isMarked(objAddr)) {
357 // Only get the containing region if the object is not marked on the
358 // bitmap (otherwise, it's a waste of time since we won't do
359 // anything with it).
360 HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
361 if (!hr->obj_allocated_since_next_marking(obj)) {
362 make_reference_grey(obj, hr);
363 }
364 }
365 }
366 }
375 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
376 uint worker_id, HeapRegion* hr) {
377 assert(obj != NULL, "pre-condition");
378 HeapWord* addr = (HeapWord*) obj;
379 if (hr == NULL) {
380 hr = _g1h->heap_region_containing_raw(addr);
381 } else {
382 assert(hr->is_in(addr), "pre-condition");
383 }
384 assert(hr != NULL, "sanity");
385 // Given that we're looking for a region that contains an object
386 // header it's impossible to get back a HC region.
387 assert(!hr->continuesHumongous(), "sanity");
388
389 // We cannot assert that word_size == obj->size() given that obj
390 // might not be in a consistent state (another thread might be in
391 // the process of copying it). So the best thing we can do is to
392 // assert that word_size is under an upper bound which is its
393 // containing region's capacity.
394 assert(word_size * HeapWordSize <= hr->capacity(),
395 err_msg("size: "SIZE_FORMAT" capacity: "SIZE_FORMAT" "HR_FORMAT,
396 word_size * HeapWordSize, hr->capacity(),
397 HR_FORMAT_PARAMS(hr)));
398
399 if (addr < hr->next_top_at_mark_start()) {
400 if (!_nextMarkBitMap->isMarked(addr)) {
401 par_mark_and_count(obj, word_size, hr, worker_id);
402 }
403 }
404 }
405
406 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP
|
179 if (!cl->do_bit(start_offset)) {
180 return false;
181 }
182 HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr);
183 BitMap::idx_t next_offset = heapWordToOffset(next_addr);
184 start_offset = _bm.get_next_one_offset(next_offset, end_offset);
185 }
186 }
187 return true;
188 }
189
190 inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
191 MemRegion mr(startWord(), sizeInWords());
192 return iterate(cl, mr);
193 }
194
195 #define check_mark(addr) \
196 assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize), \
197 "outside underlying space?"); \
198 assert(G1CollectedHeap::heap()->is_in_exact(addr), \
199 err_msg("Trying to access not available bitmap " PTR_FORMAT \
200 " corresponding to " PTR_FORMAT " (%u)", \
201 p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr)));
202
203 inline void CMBitMap::mark(HeapWord* addr) {
204 check_mark(addr);
205 _bm.set_bit(heapWordToOffset(addr));
206 }
207
208 inline void CMBitMap::clear(HeapWord* addr) {
209 check_mark(addr);
210 _bm.clear_bit(heapWordToOffset(addr));
211 }
212
213 inline bool CMBitMap::parMark(HeapWord* addr) {
214 check_mark(addr);
215 return _bm.par_set_bit(heapWordToOffset(addr));
216 }
217
218 inline bool CMBitMap::parClear(HeapWord* addr) {
219 check_mark(addr);
220 return _bm.par_clear_bit(heapWordToOffset(addr));
326 // by only doing a bookkeeping update and avoiding the
327 // actual scan of the object - a typeArray contains no
328 // references, and the metadata is built-in.
329 process_grey_object<false>(obj);
330 } else {
331 if (_cm->verbose_high()) {
332 gclog_or_tty->print_cr("[%u] below a finger (local: " PTR_FORMAT
333 ", global: " PTR_FORMAT ") pushing "
334 PTR_FORMAT " on mark stack",
335 _worker_id, p2i(_finger),
336 p2i(global_finger), p2i(obj));
337 }
338 push(obj);
339 }
340 }
341 }
342 }
343
344 inline void CMTask::deal_with_reference(oop obj) {
345 if (_cm->verbose_high()) {
346 gclog_or_tty->print_cr("[%u] we're dealing with reference = " PTR_FORMAT,
347 _worker_id, p2i((void*) obj));
348 }
349
350 increment_refs_reached();
351
352 HeapWord* objAddr = (HeapWord*) obj;
353 assert(obj->is_oop_or_null(true /* ignore mark word */), "Error");
354 if (_g1h->is_in_g1_reserved(objAddr)) {
355 assert(obj != NULL, "null check is implicit");
356 if (!_nextMarkBitMap->isMarked(objAddr)) {
357 // Only get the containing region if the object is not marked on the
358 // bitmap (otherwise, it's a waste of time since we won't do
359 // anything with it).
360 HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
361 if (!hr->obj_allocated_since_next_marking(obj)) {
362 make_reference_grey(obj, hr);
363 }
364 }
365 }
366 }
375 inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
376 uint worker_id, HeapRegion* hr) {
377 assert(obj != NULL, "pre-condition");
378 HeapWord* addr = (HeapWord*) obj;
379 if (hr == NULL) {
380 hr = _g1h->heap_region_containing_raw(addr);
381 } else {
382 assert(hr->is_in(addr), "pre-condition");
383 }
384 assert(hr != NULL, "sanity");
385 // Given that we're looking for a region that contains an object
386 // header it's impossible to get back a HC region.
387 assert(!hr->continuesHumongous(), "sanity");
388
389 // We cannot assert that word_size == obj->size() given that obj
390 // might not be in a consistent state (another thread might be in
391 // the process of copying it). So the best thing we can do is to
392 // assert that word_size is under an upper bound which is its
393 // containing region's capacity.
394 assert(word_size * HeapWordSize <= hr->capacity(),
395 err_msg("size: " SIZE_FORMAT " capacity: " SIZE_FORMAT " " HR_FORMAT,
396 word_size * HeapWordSize, hr->capacity(),
397 HR_FORMAT_PARAMS(hr)));
398
399 if (addr < hr->next_top_at_mark_start()) {
400 if (!_nextMarkBitMap->isMarked(addr)) {
401 par_mark_and_count(obj, word_size, hr, worker_id);
402 }
403 }
404 }
405
406 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP
|