< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.hpp

Print this page
rev 11044 : 8153507: Improve Card Table Clear Task
Summary: Move card table clear code into remembered set related files. Improve work distribution of this task, and tune thread usage.
Reviewed-by:


  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1COLLECTEDHEAP_HPP
  26 #define SHARE_VM_GC_G1_G1COLLECTEDHEAP_HPP
  27 
  28 #include "gc/g1/evacuationInfo.hpp"
  29 #include "gc/g1/g1AllocationContext.hpp"
  30 #include "gc/g1/g1BiasedArray.hpp"
  31 #include "gc/g1/g1CollectionSet.hpp"
  32 #include "gc/g1/g1CollectorState.hpp"
  33 #include "gc/g1/g1ConcurrentMark.hpp"
  34 #include "gc/g1/g1HRPrinter.hpp"
  35 #include "gc/g1/g1InCSetState.hpp"
  36 #include "gc/g1/g1MonitoringSupport.hpp"
  37 #include "gc/g1/g1EvacFailure.hpp"
  38 #include "gc/g1/g1EvacStats.hpp"

  39 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  40 #include "gc/g1/g1YCTypes.hpp"
  41 #include "gc/g1/hSpaceCounters.hpp"
  42 #include "gc/g1/heapRegionManager.hpp"
  43 #include "gc/g1/heapRegionSet.hpp"
  44 #include "gc/g1/youngList.hpp"
  45 #include "gc/shared/barrierSet.hpp"
  46 #include "gc/shared/collectedHeap.hpp"
  47 #include "gc/shared/plab.hpp"
  48 #include "gc/shared/preservedMarks.hpp"
  49 #include "memory/memRegion.hpp"
  50 #include "utilities/stack.hpp"
  51 
  52 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
  53 // It uses the "Garbage First" heap organization and algorithm, which
  54 // may combine concurrent marking with parallel, incremental compaction of
  55 // heap subsets that will yield large amounts of garbage.
  56 
  57 // Forward declarations
  58 class HeapRegion;


1148   inline InCSetState in_cset_state(const oop obj);
1149 
1150   // Return "TRUE" iff the given object address is in the reserved
1151   // region of g1.
1152   bool is_in_g1_reserved(const void* p) const {
1153     return _hrm.reserved().contains(p);
1154   }
1155 
1156   // Returns a MemRegion that corresponds to the space that has been
1157   // reserved for the heap
1158   MemRegion g1_reserved() const {
1159     return _hrm.reserved();
1160   }
1161 
1162   virtual bool is_in_closed_subset(const void* p) const;
1163 
1164   G1SATBCardTableLoggingModRefBS* g1_barrier_set() {
1165     return barrier_set_cast<G1SATBCardTableLoggingModRefBS>(barrier_set());
1166   }
1167 
1168   // This resets the card table to all zeros.  It is used after
1169   // a collection pause which used the card table to claim cards.
1170   void cleanUpCardTable();
1171 
1172   // Iteration functions.
1173 
1174   // Iterate over all objects, calling "cl.do_object" on each.
1175   virtual void object_iterate(ObjectClosure* cl);
1176 
1177   virtual void safe_object_iterate(ObjectClosure* cl) {
1178     object_iterate(cl);
1179   }
1180 
1181   // Iterate over heap regions, in address order, terminating the
1182   // iteration early if the "doHeapRegion" method returns "true".
1183   void heap_region_iterate(HeapRegionClosure* blk) const;
1184 
1185   // Return the region with the given index. It assumes the index is valid.
1186   inline HeapRegion* region_at(uint index) const;
1187 
1188   // Return the next region (by index) that is part of the same
1189   // humongous object that hr is part of.
1190   inline HeapRegion* next_region_in_humongous(HeapRegion* hr) const;
1191 


1376       !hr->obj_allocated_since_next_marking(obj) &&
1377       !isMarkedNext(obj) &&
1378       !hr->is_archive();
1379   }
1380 
1381   // Determine if an object is dead, given only the object itself.
1382   // This will find the region to which the object belongs and
1383   // then call the region version of the same function.
1384 
1385   // Added if it is NULL it isn't dead.
1386 
1387   inline bool is_obj_dead(const oop obj) const;
1388 
1389   inline bool is_obj_ill(const oop obj) const;
1390 
1391   G1ConcurrentMark* concurrent_mark() const { return _cm; }
1392 
1393   // Refinement
1394 
1395   ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }
1396 
1397   // The dirty cards region list is used to record a subset of regions
1398   // whose cards need clearing. The list if populated during the
1399   // remembered set scanning and drained during the card table
1400   // cleanup. Although the methods are reentrant, population/draining
1401   // phases must not overlap. For synchronization purposes the last
1402   // element on the list points to itself.
1403   HeapRegion* _dirty_cards_region_list;
1404   void push_dirty_cards_region(HeapRegion* hr);
1405   HeapRegion* pop_dirty_cards_region();
1406 
1407   // Optimized nmethod scanning support routines
1408 
1409   // Register the given nmethod with the G1 heap.
1410   virtual void register_nmethod(nmethod* nm);
1411 
1412   // Unregister the given nmethod from the G1 heap.
1413   virtual void unregister_nmethod(nmethod* nm);
1414 
1415   // Free up superfluous code root memory.
1416   void purge_code_root_memory();
1417 
1418   // Rebuild the strong code root lists for each region
1419   // after a full GC.
1420   void rebuild_strong_code_roots();
1421 
1422   // Delete entries for dead interned string and clean up unreferenced symbols
1423   // in symbol table, possibly in parallel.
1424   void unlink_string_and_symbol_table(BoolObjectClosure* is_alive, bool unlink_strings = true, bool unlink_symbols = true);
1425 




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1COLLECTEDHEAP_HPP
  26 #define SHARE_VM_GC_G1_G1COLLECTEDHEAP_HPP
  27 
  28 #include "gc/g1/evacuationInfo.hpp"
  29 #include "gc/g1/g1AllocationContext.hpp"
  30 #include "gc/g1/g1BiasedArray.hpp"
  31 #include "gc/g1/g1CollectionSet.hpp"
  32 #include "gc/g1/g1CollectorState.hpp"
  33 #include "gc/g1/g1ConcurrentMark.hpp"
  34 #include "gc/g1/g1HRPrinter.hpp"
  35 #include "gc/g1/g1InCSetState.hpp"
  36 #include "gc/g1/g1MonitoringSupport.hpp"
  37 #include "gc/g1/g1EvacFailure.hpp"
  38 #include "gc/g1/g1EvacStats.hpp"
  39 #include "gc/g1/g1HeapVerifier.hpp"
  40 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  41 #include "gc/g1/g1YCTypes.hpp"
  42 #include "gc/g1/hSpaceCounters.hpp"
  43 #include "gc/g1/heapRegionManager.hpp"
  44 #include "gc/g1/heapRegionSet.hpp"
  45 #include "gc/g1/youngList.hpp"
  46 #include "gc/shared/barrierSet.hpp"
  47 #include "gc/shared/collectedHeap.hpp"
  48 #include "gc/shared/plab.hpp"
  49 #include "gc/shared/preservedMarks.hpp"
  50 #include "memory/memRegion.hpp"
  51 #include "utilities/stack.hpp"
  52 
  53 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
  54 // It uses the "Garbage First" heap organization and algorithm, which
  55 // may combine concurrent marking with parallel, incremental compaction of
  56 // heap subsets that will yield large amounts of garbage.
  57 
  58 // Forward declarations
  59 class HeapRegion;


1149   inline InCSetState in_cset_state(const oop obj);
1150 
1151   // Return "TRUE" iff the given object address is in the reserved
1152   // region of g1.
1153   bool is_in_g1_reserved(const void* p) const {
1154     return _hrm.reserved().contains(p);
1155   }
1156 
1157   // Returns a MemRegion that corresponds to the space that has been
1158   // reserved for the heap
1159   MemRegion g1_reserved() const {
1160     return _hrm.reserved();
1161   }
1162 
1163   virtual bool is_in_closed_subset(const void* p) const;
1164 
1165   G1SATBCardTableLoggingModRefBS* g1_barrier_set() {
1166     return barrier_set_cast<G1SATBCardTableLoggingModRefBS>(barrier_set());
1167   }
1168 




1169   // Iteration functions.
1170 
1171   // Iterate over all objects, calling "cl.do_object" on each.
1172   virtual void object_iterate(ObjectClosure* cl);
1173 
1174   virtual void safe_object_iterate(ObjectClosure* cl) {
1175     object_iterate(cl);
1176   }
1177 
1178   // Iterate over heap regions, in address order, terminating the
1179   // iteration early if the "doHeapRegion" method returns "true".
1180   void heap_region_iterate(HeapRegionClosure* blk) const;
1181 
1182   // Return the region with the given index. It assumes the index is valid.
1183   inline HeapRegion* region_at(uint index) const;
1184 
1185   // Return the next region (by index) that is part of the same
1186   // humongous object that hr is part of.
1187   inline HeapRegion* next_region_in_humongous(HeapRegion* hr) const;
1188 


1373       !hr->obj_allocated_since_next_marking(obj) &&
1374       !isMarkedNext(obj) &&
1375       !hr->is_archive();
1376   }
1377 
1378   // Determine if an object is dead, given only the object itself.
1379   // This will find the region to which the object belongs and
1380   // then call the region version of the same function.
1381 
1382   // Added if it is NULL it isn't dead.
1383 
1384   inline bool is_obj_dead(const oop obj) const;
1385 
1386   inline bool is_obj_ill(const oop obj) const;
1387 
1388   G1ConcurrentMark* concurrent_mark() const { return _cm; }
1389 
1390   // Refinement
1391 
1392   ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }










1393 
1394   // Optimized nmethod scanning support routines
1395 
1396   // Register the given nmethod with the G1 heap.
1397   virtual void register_nmethod(nmethod* nm);
1398 
1399   // Unregister the given nmethod from the G1 heap.
1400   virtual void unregister_nmethod(nmethod* nm);
1401 
1402   // Free up superfluous code root memory.
1403   void purge_code_root_memory();
1404 
1405   // Rebuild the strong code root lists for each region
1406   // after a full GC.
1407   void rebuild_strong_code_roots();
1408 
1409   // Delete entries for dead interned string and clean up unreferenced symbols
1410   // in symbol table, possibly in parallel.
1411   void unlink_string_and_symbol_table(BoolObjectClosure* is_alive, bool unlink_strings = true, bool unlink_symbols = true);
1412 


< prev index next >