370 break;
371 default:
372 ShouldNotReachHere();
373 }
374 st->print("|BTE " PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT,
375 p2i(bottom()), p2i(top()), p2i(end()));
376 st->print("|U %3d%%", (int) ((double) used() * 100 / capacity()));
377 st->print("|T %3d%%", (int) ((double) get_tlab_allocs() * 100 / capacity()));
378 st->print("|G %3d%%", (int) ((double) get_gclab_allocs() * 100 / capacity()));
379 st->print("|S %3d%%", (int) ((double) get_shared_allocs() * 100 / capacity()));
380 st->print("|L %3d%%", (int) ((double) get_live_data_bytes() * 100 / capacity()));
381 st->print("|FTS " UINT64_FORMAT_W(15), first_alloc_seq_num());
382 st->print("|LTS " UINT64_FORMAT_W(15), last_alloc_seq_num());
383 if (is_root()) {
384 st->print("|R");
385 } else {
386 st->print("| ");
387 }
388 st->print("|CP " SIZE_FORMAT_W(3), _critical_pins);
389
390 st->print_cr("|TAMS " PTR_FORMAT ", " PTR_FORMAT "|",
391 p2i(ShenandoahHeap::heap()->complete_top_at_mark_start(_bottom)),
392 p2i(ShenandoahHeap::heap()->next_top_at_mark_start(_bottom)));
393 }
394
395 void ShenandoahHeapRegion::object_iterate_interruptible(ObjectClosure* blk, bool allow_cancel) {
396 HeapWord* p = bottom() + BrooksPointer::word_size();
397 while (p < top() && !(allow_cancel && _heap->cancelled_concgc())) {
398 blk->do_object(oop(p));
399 p += oop(p)->size() + BrooksPointer::word_size();
400 }
401 }
402
403 HeapWord* ShenandoahHeapRegion::object_iterate_careful(ObjectClosureCareful* blk) {
404 HeapWord * limit = concurrent_iteration_safe_limit();
405 assert(limit <= top(), "sanity check");
406 for (HeapWord* p = bottom() + BrooksPointer::word_size(); p < limit;) {
407 size_t size = blk->do_object_careful(oop(p));
408 if (size == 0) {
409 return p; // failed at p
410 }
411 p += size + BrooksPointer::word_size();
412 }
465 }
466 assert(r->is_humongous_start(), "Must be");
467 return r;
468 }
469
470 void ShenandoahHeapRegion::recycle_no_matrix() {
471 ContiguousSpace::clear(false);
472 if (ZapUnusedHeapArea) {
473 ContiguousSpace::mangle_unused_area_complete();
474 }
475 clear_live_data();
476 _root = false;
477 reset_alloc_stats();
478
479 // Reset seq numbers
480 _first_alloc_seq_num = 0;
481 _last_alloc_seq_num = 0;
482
483 // Reset C-TAMS pointer to ensure size-based iteration, everything
484 // in that regions is going to be new objects.
485 _heap->set_complete_top_at_mark_start(bottom(), bottom());
486 // We can only safely reset the C-TAMS pointer if the bitmap is clear for that region.
487 assert(_heap->is_complete_bitmap_clear_range(bottom(), end()), "must be clear");
488
489 make_empty_committed();
490 }
491
492 void ShenandoahHeapRegion::recycle() {
493 recycle_no_matrix();
494 if (UseShenandoahMatrix) {
495 _heap->connection_matrix()->clear_region(region_number());
496 }
497 }
498
499 HeapWord* ShenandoahHeapRegion::block_start_const(const void* p) const {
500 assert(MemRegion(bottom(), end()).contains(p),
501 "p ("PTR_FORMAT") not in space ["PTR_FORMAT", "PTR_FORMAT")",
502 p2i(p), p2i(bottom()), p2i(end()));
503 if (p >= top()) {
504 return top();
505 } else {
506 HeapWord* last = bottom() + BrooksPointer::word_size();
507 HeapWord* cur = last;
|
370 break;
371 default:
372 ShouldNotReachHere();
373 }
374 st->print("|BTE " PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT,
375 p2i(bottom()), p2i(top()), p2i(end()));
376 st->print("|U %3d%%", (int) ((double) used() * 100 / capacity()));
377 st->print("|T %3d%%", (int) ((double) get_tlab_allocs() * 100 / capacity()));
378 st->print("|G %3d%%", (int) ((double) get_gclab_allocs() * 100 / capacity()));
379 st->print("|S %3d%%", (int) ((double) get_shared_allocs() * 100 / capacity()));
380 st->print("|L %3d%%", (int) ((double) get_live_data_bytes() * 100 / capacity()));
381 st->print("|FTS " UINT64_FORMAT_W(15), first_alloc_seq_num());
382 st->print("|LTS " UINT64_FORMAT_W(15), last_alloc_seq_num());
383 if (is_root()) {
384 st->print("|R");
385 } else {
386 st->print("| ");
387 }
388 st->print("|CP " SIZE_FORMAT_W(3), _critical_pins);
389
390 st->print_cr("|TAMS " PTR_FORMAT "|",
391 p2i(ShenandoahHeap::heap()->top_at_mark_start(_bottom)));
392 }
393
394 void ShenandoahHeapRegion::object_iterate_interruptible(ObjectClosure* blk, bool allow_cancel) {
395 HeapWord* p = bottom() + BrooksPointer::word_size();
396 while (p < top() && !(allow_cancel && _heap->cancelled_concgc())) {
397 blk->do_object(oop(p));
398 p += oop(p)->size() + BrooksPointer::word_size();
399 }
400 }
401
402 HeapWord* ShenandoahHeapRegion::object_iterate_careful(ObjectClosureCareful* blk) {
403 HeapWord * limit = concurrent_iteration_safe_limit();
404 assert(limit <= top(), "sanity check");
405 for (HeapWord* p = bottom() + BrooksPointer::word_size(); p < limit;) {
406 size_t size = blk->do_object_careful(oop(p));
407 if (size == 0) {
408 return p; // failed at p
409 }
410 p += size + BrooksPointer::word_size();
411 }
464 }
465 assert(r->is_humongous_start(), "Must be");
466 return r;
467 }
468
469 void ShenandoahHeapRegion::recycle_no_matrix() {
470 ContiguousSpace::clear(false);
471 if (ZapUnusedHeapArea) {
472 ContiguousSpace::mangle_unused_area_complete();
473 }
474 clear_live_data();
475 _root = false;
476 reset_alloc_stats();
477
478 // Reset seq numbers
479 _first_alloc_seq_num = 0;
480 _last_alloc_seq_num = 0;
481
482 // Reset C-TAMS pointer to ensure size-based iteration, everything
483 // in that regions is going to be new objects.
484 _heap->set_top_at_mark_start(bottom(), bottom());
485 // We can only safely reset the C-TAMS pointer if the bitmap is clear for that region.
486 assert(_heap->is_bitmap_clear_range(bottom(), end()), "must be clear");
487
488 make_empty_committed();
489 }
490
491 void ShenandoahHeapRegion::recycle() {
492 recycle_no_matrix();
493 if (UseShenandoahMatrix) {
494 _heap->connection_matrix()->clear_region(region_number());
495 }
496 }
497
498 HeapWord* ShenandoahHeapRegion::block_start_const(const void* p) const {
499 assert(MemRegion(bottom(), end()).contains(p),
500 "p ("PTR_FORMAT") not in space ["PTR_FORMAT", "PTR_FORMAT")",
501 p2i(p), p2i(bottom()), p2i(end()));
502 if (p >= top()) {
503 return top();
504 } else {
505 HeapWord* last = bottom() + BrooksPointer::word_size();
506 HeapWord* cur = last;
|