< prev index next >

src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp

Print this page

438     _g1h(G1CollectedHeap::heap())
439   {}
440 
441   bool do_heap_region_index(uint region_index) override {
442     if (!is_reclaimable(region_index)) {
443       return false;
444     }
445 
446     G1HeapRegion* r = _g1h->region_at(region_index);
447 
448     oop obj = cast_to_oop(r->bottom());
449     {
450       ResourceMark rm;
451       bool mark_in_progress = _g1h->collector_state()->is_in_marking();
452       bool allocated_after_mark_start = false;
453       if (mark_in_progress) {
454         // top_at_mark_start() will assert if we are not in marking, so check first.
455         allocated_after_mark_start = r->bottom() == _g1h->concurrent_mark()->top_at_mark_start(r);
456       }
457 
458       guarantee(obj->is_typeArray() || (allocated_after_mark_start || !mark_in_progress),
459                 "Only eagerly reclaiming primitive arrays is supported, other humongous objects only if allocated after mark start, but the object "
460                 PTR_FORMAT " (%s) is not (mark %d allocated after mark: %d).",
461                 p2i(r->bottom()), obj->klass()->name()->as_C_string(), mark_in_progress, allocated_after_mark_start);
462     }
463     log_debug(gc, humongous)("Reclaimed humongous region %u (object size %zu @ " PTR_FORMAT ")",
464                              region_index,
465                              obj->size() * HeapWordSize,
466                              p2i(r->bottom())
467                             );
468 
469     G1ConcurrentMark* const cm = _g1h->concurrent_mark();
470     cm->humongous_object_eagerly_reclaimed(r);
471     assert(!cm->is_marked_in_bitmap(obj),
472            "Eagerly reclaimed humongous region %u should not be marked at all but is in bitmap %s",
473            region_index,
474            BOOL_TO_STR(cm->is_marked_in_bitmap(obj)));
475     _humongous_objects_reclaimed++;
476 
477     auto free_humongous_region = [&] (G1HeapRegion* r) {
478       _freed_bytes += r->used();
479       r->set_containing_set(nullptr);
480       _humongous_regions_reclaimed++;
481       G1HeapRegionPrinter::eager_reclaim(r);

438     _g1h(G1CollectedHeap::heap())
439   {}
440 
441   bool do_heap_region_index(uint region_index) override {
442     if (!is_reclaimable(region_index)) {
443       return false;
444     }
445 
446     G1HeapRegion* r = _g1h->region_at(region_index);
447 
448     oop obj = cast_to_oop(r->bottom());
449     {
450       ResourceMark rm;
451       bool mark_in_progress = _g1h->collector_state()->is_in_marking();
452       bool allocated_after_mark_start = false;
453       if (mark_in_progress) {
454         // top_at_mark_start() will assert if we are not in marking, so check first.
455         allocated_after_mark_start = r->bottom() == _g1h->concurrent_mark()->top_at_mark_start(r);
456       }
457 
458       guarantee(_g1h->can_be_marked_through_immediately(obj) || (allocated_after_mark_start || !mark_in_progress),
459                 "Only eagerly reclaiming arrays without oops is always supported, other humongous objects only if allocated after mark start, but the object "
460                 PTR_FORMAT " (%s) is not (allocated after mark: %d mark in progress %d marked immediately %d is_array %d array_with_oops %d).",
461                 p2i(r->bottom()), obj->klass()->name()->as_C_string(), allocated_after_mark_start, mark_in_progress, _g1h->can_be_marked_through_immediately(obj), obj->is_array(), obj->is_array_with_oops());
462     }
463     log_debug(gc, humongous)("Reclaimed humongous region %u (object size %zu @ " PTR_FORMAT ")",
464                              region_index,
465                              obj->size() * HeapWordSize,
466                              p2i(r->bottom())
467                             );
468 
469     G1ConcurrentMark* const cm = _g1h->concurrent_mark();
470     cm->humongous_object_eagerly_reclaimed(r);
471     assert(!cm->is_marked_in_bitmap(obj),
472            "Eagerly reclaimed humongous region %u should not be marked at all but is in bitmap %s",
473            region_index,
474            BOOL_TO_STR(cm->is_marked_in_bitmap(obj)));
475     _humongous_objects_reclaimed++;
476 
477     auto free_humongous_region = [&] (G1HeapRegion* r) {
478       _freed_bytes += r->used();
479       r->set_containing_set(nullptr);
480       _humongous_regions_reclaimed++;
481       G1HeapRegionPrinter::eager_reclaim(r);
< prev index next >