src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp
changeset 50565 69e82329ad01
parent 49634 df9dcfff6628
child 51007 fc9dd181d70e
equal deleted inserted replaced
50564:ef7c4c77d9fa 50565:69e82329ad01
    28 #include "gc/g1/heapRegion.inline.hpp"
    28 #include "gc/g1/heapRegion.inline.hpp"
    29 #include "gc/g1/heapRegionRemSet.hpp"
    29 #include "gc/g1/heapRegionRemSet.hpp"
    30 #include "runtime/safepoint.hpp"
    30 #include "runtime/safepoint.hpp"
    31 
    31 
    32 bool G1RemSetTrackingPolicy::is_interesting_humongous_region(HeapRegion* r) const {
    32 bool G1RemSetTrackingPolicy::is_interesting_humongous_region(HeapRegion* r) const {
    33   return r->is_starts_humongous() && oop(r->bottom())->is_typeArray();
    33   return r->is_humongous() && oop(r->humongous_start_region()->bottom())->is_typeArray();
    34 }
    34 }
    35 
    35 
    36 bool G1RemSetTrackingPolicy::needs_scan_for_rebuild(HeapRegion* r) const {
    36 bool G1RemSetTrackingPolicy::needs_scan_for_rebuild(HeapRegion* r) const {
    37   // All non-free, non-young, non-closed archive regions need to be scanned for references;
    37   // All non-free, non-young, non-closed archive regions need to be scanned for references;
    38   // At every gc we gather references to other regions in young, and closed archive
    38   // At every gc we gather references to other regions in young, and closed archive
   117 
   117 
   118   if (r->is_old_or_humongous()) {
   118   if (r->is_old_or_humongous()) {
   119     if (r->rem_set()->is_updating()) {
   119     if (r->rem_set()->is_updating()) {
   120       r->rem_set()->set_state_complete();
   120       r->rem_set()->set_state_complete();
   121     }
   121     }
       
   122     G1CollectedHeap* g1h = G1CollectedHeap::heap();
   122     // We can drop remembered sets of humongous regions that have a too large remembered set:
   123     // We can drop remembered sets of humongous regions that have a too large remembered set:
   123     // We will never try to eagerly reclaim or move them anyway until the next concurrent
   124     // We will never try to eagerly reclaim or move them anyway until the next concurrent
   124     // cycle as e.g. remembered set entries will always be added.
   125     // cycle as e.g. remembered set entries will always be added.
   125     if (r->is_humongous() && !G1CollectedHeap::heap()->is_potential_eager_reclaim_candidate(r)) {
   126     if (r->is_starts_humongous() && !g1h->is_potential_eager_reclaim_candidate(r)) {
   126       r->rem_set()->clear_locked(true /* only_cardset */);
   127       // Handle HC regions with the HS region.
       
   128       uint const size_in_regions = (uint)g1h->humongous_obj_size_in_regions(oop(r->bottom())->size());
       
   129       uint const region_idx = r->hrm_index();
       
   130       for (uint j = region_idx; j < (region_idx + size_in_regions); j++) {
       
   131         HeapRegion* const cur = g1h->region_at(j);
       
   132         assert(!cur->is_continues_humongous() || cur->rem_set()->is_empty(),
       
   133                "Continues humongous region %u remset should be empty", j);
       
   134         cur->rem_set()->clear_locked(true /* only_cardset */);
       
   135       }
   127     }
   136     }
   128     assert(!r->is_continues_humongous() || r->rem_set()->is_empty(), "Continues humongous object remsets should be empty");
       
   129     G1ConcurrentMark* cm = G1CollectedHeap::heap()->concurrent_mark();
   137     G1ConcurrentMark* cm = G1CollectedHeap::heap()->concurrent_mark();
   130     log_trace(gc, remset, tracking)("After rebuild region %u "
   138     log_trace(gc, remset, tracking)("After rebuild region %u "
   131                                     "(ntams " PTR_FORMAT " "
   139                                     "(ntams " PTR_FORMAT " "
   132                                     "liveness " SIZE_FORMAT " "
   140                                     "liveness " SIZE_FORMAT " "
   133                                     "next_marked_bytes " SIZE_FORMAT " "
   141                                     "next_marked_bytes " SIZE_FORMAT " "