< prev index next >

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

Print this page

384     _g1h(G1CollectedHeap::heap())
385   {}
386 
387   bool do_heap_region_index(uint region_index) override {
388     if (!is_reclaimable(region_index)) {
389       return false;
390     }
391 
392     G1HeapRegion* r = _g1h->region_at(region_index);
393 
394     oop obj = cast_to_oop(r->bottom());
395     {
396       ResourceMark rm;
397       bool mark_in_progress = _g1h->collector_state()->is_in_marking();
398       bool allocated_after_mark_start = false;
399       if (mark_in_progress) {
400         // top_at_mark_start() will assert if we are not in marking, so check first.
401         allocated_after_mark_start = r->bottom() == _g1h->concurrent_mark()->top_at_mark_start(r);
402       }
403 
404       guarantee(obj->is_typeArray() || (allocated_after_mark_start || !mark_in_progress),
405                 "Only eagerly reclaiming primitive arrays is supported, other humongous objects only if allocated after mark start, but the object "
406                 PTR_FORMAT " (%s) is not (mark %d allocated after mark: %d).",
407                 p2i(r->bottom()), obj->klass()->name()->as_C_string(), mark_in_progress, allocated_after_mark_start);
408     }
409     log_debug(gc, humongous)("Reclaimed humongous region %u (object size %zu @ " PTR_FORMAT ")",
410                              region_index,
411                              obj->size() * HeapWordSize,
412                              p2i(r->bottom())
413                             );
414 
415     G1ConcurrentMark* const cm = _g1h->concurrent_mark();
416     cm->humongous_object_eagerly_reclaimed(r);
417     assert(!cm->is_marked_in_bitmap(obj),
418            "Eagerly reclaimed humongous region %u should not be marked at all but is in bitmap %s",
419            region_index,
420            BOOL_TO_STR(cm->is_marked_in_bitmap(obj)));
421     _humongous_objects_reclaimed++;
422 
423     auto free_humongous_region = [&] (G1HeapRegion* r) {
424       _freed_bytes += r->used();
425       r->set_containing_set(nullptr);
426       _humongous_regions_reclaimed++;
427       G1HeapRegionPrinter::eager_reclaim(r);

384     _g1h(G1CollectedHeap::heap())
385   {}
386 
387   bool do_heap_region_index(uint region_index) override {
388     if (!is_reclaimable(region_index)) {
389       return false;
390     }
391 
392     G1HeapRegion* r = _g1h->region_at(region_index);
393 
394     oop obj = cast_to_oop(r->bottom());
395     {
396       ResourceMark rm;
397       bool mark_in_progress = _g1h->collector_state()->is_in_marking();
398       bool allocated_after_mark_start = false;
399       if (mark_in_progress) {
400         // top_at_mark_start() will assert if we are not in marking, so check first.
401         allocated_after_mark_start = r->bottom() == _g1h->concurrent_mark()->top_at_mark_start(r);
402       }
403 
404       guarantee(_g1h->can_be_marked_through_immediately(obj) || (allocated_after_mark_start || !mark_in_progress),
405                 "Only eagerly reclaiming arrays without oops is always supported, other humongous objects only if allocated after mark start, but the object "
406                 PTR_FORMAT " (%s) is not (allocated after mark: %d mark in progress %d marked immediately %d is_array %d array_with_oops %d).",
407                 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());
408     }
409     log_debug(gc, humongous)("Reclaimed humongous region %u (object size %zu @ " PTR_FORMAT ")",
410                              region_index,
411                              obj->size() * HeapWordSize,
412                              p2i(r->bottom())
413                             );
414 
415     G1ConcurrentMark* const cm = _g1h->concurrent_mark();
416     cm->humongous_object_eagerly_reclaimed(r);
417     assert(!cm->is_marked_in_bitmap(obj),
418            "Eagerly reclaimed humongous region %u should not be marked at all but is in bitmap %s",
419            region_index,
420            BOOL_TO_STR(cm->is_marked_in_bitmap(obj)));
421     _humongous_objects_reclaimed++;
422 
423     auto free_humongous_region = [&] (G1HeapRegion* r) {
424       _freed_bytes += r->used();
425       r->set_containing_set(nullptr);
426       _humongous_regions_reclaimed++;
427       G1HeapRegionPrinter::eager_reclaim(r);
< prev index next >