< prev index next >

src/share/vm/gc/shenandoah/shenandoahHeapRegion.cpp

Print this page
rev 14453 : Remove secondary marking bitmap.


 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   }
 413   return NULL; // all done
 414 }
 415 
 416 void ShenandoahHeapRegion::oop_iterate(ExtendedOopClosure* blk) {
 417   if (!is_active()) return;
 418   if (is_humongous()) {
 419     oop_iterate_humongous(blk);
 420   } else {
 421     oop_iterate_objects(blk);
 422   }
 423 }
 424 
 425 void ShenandoahHeapRegion::oop_iterate_objects(ExtendedOopClosure* blk) {
 426   assert(! is_humongous(), "no humongous region here");
 427   HeapWord* obj_addr = bottom() + BrooksPointer::word_size();
 428   HeapWord* t = top();
 429   // Could call objects iterate, but this is easier.
 430   while (obj_addr < t) {
 431     oop obj = oop(obj_addr);
 432     obj_addr += obj->oop_iterate_size(blk) + BrooksPointer::word_size();
 433   }


 463     r = _heap->regions()->get(reg_num);
 464     assert(r->is_humongous(), "Must be a part of the humongous region");
 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::oop_iterate(ExtendedOopClosure* blk) {
 395   if (!is_active()) return;
 396   if (is_humongous()) {
 397     oop_iterate_humongous(blk);
 398   } else {
 399     oop_iterate_objects(blk);
 400   }
 401 }
 402 
 403 void ShenandoahHeapRegion::oop_iterate_objects(ExtendedOopClosure* blk) {
 404   assert(! is_humongous(), "no humongous region here");
 405   HeapWord* obj_addr = bottom() + BrooksPointer::word_size();
 406   HeapWord* t = top();
 407   // Could call objects iterate, but this is easier.
 408   while (obj_addr < t) {
 409     oop obj = oop(obj_addr);
 410     obj_addr += obj->oop_iterate_size(blk) + BrooksPointer::word_size();
 411   }


 441     r = _heap->regions()->get(reg_num);
 442     assert(r->is_humongous(), "Must be a part of the humongous region");
 443   }
 444   assert(r->is_humongous_start(), "Must be");
 445   return r;
 446 }
 447 
 448 void ShenandoahHeapRegion::recycle_no_matrix() {
 449   ContiguousSpace::clear(false);
 450   if (ZapUnusedHeapArea) {
 451     ContiguousSpace::mangle_unused_area_complete();
 452   }
 453   clear_live_data();
 454   _root = false;
 455   reset_alloc_stats();
 456 
 457   // Reset seq numbers
 458   _first_alloc_seq_num = 0;
 459   _last_alloc_seq_num = 0;
 460 
 461   // Reset TAMS pointer to ensure size-based iteration, everything
 462   // in that regions is going to be new objects.
 463   _heap->set_top_at_mark_start(bottom(), bottom());
 464   // We can only safely reset the TAMS pointer if the bitmap is clear for that region.
 465   assert(_heap->is_bitmap_clear_range(bottom(), end()), "must be clear");
 466 
 467   make_empty_committed();
 468 }
 469 
 470 void ShenandoahHeapRegion::recycle() {
 471   recycle_no_matrix();
 472   if (UseShenandoahMatrix) {
 473     _heap->connection_matrix()->clear_region(region_number());
 474   }
 475 }
 476 
 477 HeapWord* ShenandoahHeapRegion::block_start_const(const void* p) const {
 478   assert(MemRegion(bottom(), end()).contains(p),
 479          "p ("PTR_FORMAT") not in space ["PTR_FORMAT", "PTR_FORMAT")",
 480          p2i(p), p2i(bottom()), p2i(end()));
 481   if (p >= top()) {
 482     return top();
 483   } else {
 484     HeapWord* last = bottom() + BrooksPointer::word_size();
 485     HeapWord* cur = last;


< prev index next >