hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
changeset 35851 5451ff646f8e
parent 35461 1068dcb8d315
child 35907 57bdb6243428
equal deleted inserted replaced
35850:34c2f89c8ebb 35851:5451ff646f8e
    80 class nmethod;
    80 class nmethod;
    81 class Ticks;
    81 class Ticks;
    82 class WorkGang;
    82 class WorkGang;
    83 class G1Allocator;
    83 class G1Allocator;
    84 class G1ArchiveAllocator;
    84 class G1ArchiveAllocator;
       
    85 class G1HeapVerifier;
    85 
    86 
    86 typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
    87 typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
    87 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
    88 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
    88 
    89 
    89 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
    90 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
   116   friend class VM_G1CollectFull;
   117   friend class VM_G1CollectFull;
   117   friend class VM_G1IncCollectionPause;
   118   friend class VM_G1IncCollectionPause;
   118   friend class VMStructs;
   119   friend class VMStructs;
   119   friend class MutatorAllocRegion;
   120   friend class MutatorAllocRegion;
   120   friend class G1GCAllocRegion;
   121   friend class G1GCAllocRegion;
       
   122   friend class G1HeapVerifier;
   121 
   123 
   122   // Closures used in implementation.
   124   // Closures used in implementation.
   123   friend class G1ParScanThreadState;
   125   friend class G1ParScanThreadState;
   124   friend class G1ParScanThreadStateSet;
   126   friend class G1ParScanThreadStateSet;
   125   friend class G1ParTask;
   127   friend class G1ParTask;
   178   // The sequence of all heap regions in the heap.
   180   // The sequence of all heap regions in the heap.
   179   HeapRegionManager _hrm;
   181   HeapRegionManager _hrm;
   180 
   182 
   181   // Manages all allocations with regions except humongous object allocations.
   183   // Manages all allocations with regions except humongous object allocations.
   182   G1Allocator* _allocator;
   184   G1Allocator* _allocator;
       
   185 
       
   186   // Manages all heap verification.
       
   187   G1HeapVerifier* _verifier;
   183 
   188 
   184   // Outside of GC pauses, the number of bytes used in all regions other
   189   // Outside of GC pauses, the number of bytes used in all regions other
   185   // than the current allocation region(s).
   190   // than the current allocation region(s).
   186   size_t _summary_bytes_used;
   191   size_t _summary_bytes_used;
   187 
   192 
   284   // translation factor.
   289   // translation factor.
   285   static G1RegionToSpaceMapper* create_aux_memory_mapper(const char* description,
   290   static G1RegionToSpaceMapper* create_aux_memory_mapper(const char* description,
   286                                                          size_t size,
   291                                                          size_t size,
   287                                                          size_t translation_factor);
   292                                                          size_t translation_factor);
   288 
   293 
   289   double verify(bool guard, const char* msg);
       
   290   void verify_before_gc();
       
   291   void verify_after_gc();
       
   292 
       
   293   void log_gc_footer(jlong pause_time_counter);
   294   void log_gc_footer(jlong pause_time_counter);
   294 
   295 
   295   void trace_heap(GCWhen::Type when, const GCTracer* tracer);
   296   void trace_heap(GCWhen::Type when, const GCTracer* tracer);
   296 
   297 
   297   void process_weak_jni_handles();
   298   void process_weak_jni_handles();
   523 public:
   524 public:
   524   WorkGang* workers() const { return _workers; }
   525   WorkGang* workers() const { return _workers; }
   525 
   526 
   526   G1Allocator* allocator() {
   527   G1Allocator* allocator() {
   527     return _allocator;
   528     return _allocator;
       
   529   }
       
   530 
       
   531   G1HeapVerifier* verifier() {
       
   532     return _verifier;
   528   }
   533   }
   529 
   534 
   530   G1MonitoringSupport* g1mm() {
   535   G1MonitoringSupport* g1mm() {
   531     assert(_g1mm != NULL, "should have been initialized");
   536     assert(_g1mm != NULL, "should have been initialized");
   532     return _g1mm;
   537     return _g1mm;
  1054   }
  1059   }
  1055 
  1060 
  1056   // The number of regions that are not completely free.
  1061   // The number of regions that are not completely free.
  1057   uint num_used_regions() const { return num_regions() - num_free_regions(); }
  1062   uint num_used_regions() const { return num_regions() - num_free_regions(); }
  1058 
  1063 
  1059   void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
       
  1060   void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
       
  1061   void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
       
  1062   void verify_dirty_young_regions() PRODUCT_RETURN;
       
  1063 
       
  1064 #ifndef PRODUCT
       
  1065   // Make sure that the given bitmap has no marked objects in the
       
  1066   // range [from,limit). If it does, print an error message and return
       
  1067   // false. Otherwise, just return true. bitmap_name should be "prev"
       
  1068   // or "next".
       
  1069   bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
       
  1070                                 HeapWord* from, HeapWord* limit);
       
  1071 
       
  1072   // Verify that the prev / next bitmap range [tams,end) for the given
       
  1073   // region has no marks. Return true if all is well, false if errors
       
  1074   // are detected.
       
  1075   bool verify_bitmaps(const char* caller, HeapRegion* hr);
       
  1076 #endif // PRODUCT
       
  1077 
       
  1078   // If G1VerifyBitmaps is set, verify that the marking bitmaps for
       
  1079   // the given region do not have any spurious marks. If errors are
       
  1080   // detected, print appropriate error messages and crash.
       
  1081   void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
       
  1082 
       
  1083   // If G1VerifyBitmaps is set, verify that the marking bitmaps do not
       
  1084   // have any spurious marks. If errors are detected, print
       
  1085   // appropriate error messages and crash.
       
  1086   void check_bitmaps(const char* caller) PRODUCT_RETURN;
       
  1087 
       
  1088   // Do sanity check on the contents of the in-cset fast test table.
       
  1089   bool check_cset_fast_test() PRODUCT_RETURN_( return true; );
       
  1090 
       
  1091   // verify_region_sets() performs verification over the region
       
  1092   // lists. It will be compiled in the product code to be used when
       
  1093   // necessary (i.e., during heap verification).
       
  1094   void verify_region_sets();
       
  1095 
       
  1096   // verify_region_sets_optional() is planted in the code for
       
  1097   // list verification in non-product builds (and it can be enabled in
       
  1098   // product builds by defining HEAP_REGION_SET_FORCE_VERIFY to be 1).
       
  1099 #if HEAP_REGION_SET_FORCE_VERIFY
       
  1100   void verify_region_sets_optional() {
       
  1101     verify_region_sets();
       
  1102   }
       
  1103 #else // HEAP_REGION_SET_FORCE_VERIFY
       
  1104   void verify_region_sets_optional() { }
       
  1105 #endif // HEAP_REGION_SET_FORCE_VERIFY
       
  1106 
       
  1107 #ifdef ASSERT
  1064 #ifdef ASSERT
  1108   bool is_on_master_free_list(HeapRegion* hr) {
  1065   bool is_on_master_free_list(HeapRegion* hr) {
  1109     return _hrm.is_free(hr);
  1066     return _hrm.is_free(hr);
  1110   }
  1067   }
  1111 #endif // ASSERT
  1068 #endif // ASSERT
  1423 
  1380 
  1424   inline bool is_obj_dead(const oop obj) const;
  1381   inline bool is_obj_dead(const oop obj) const;
  1425 
  1382 
  1426   inline bool is_obj_ill(const oop obj) const;
  1383   inline bool is_obj_ill(const oop obj) const;
  1427 
  1384 
  1428   bool allocated_since_marking(oop obj, HeapRegion* hr, VerifyOption vo);
       
  1429   HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo);
       
  1430   bool is_marked(oop obj, VerifyOption vo);
       
  1431   const char* top_at_mark_start_str(VerifyOption vo);
       
  1432 
       
  1433   ConcurrentMark* concurrent_mark() const { return _cm; }
  1385   ConcurrentMark* concurrent_mark() const { return _cm; }
  1434 
  1386 
  1435   // Refinement
  1387   // Refinement
  1436 
  1388 
  1437   ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }
  1389   ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }