< prev index next >

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

Print this page
rev 13070 : imported patch 8177544-full-gc-scope
rev 13071 : [mq]: 8177544-full-gc-scope-tschatzl-rev1


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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/g1EdenRegions.hpp"
  35 #include "gc/g1/g1EvacFailure.hpp"
  36 #include "gc/g1/g1EvacStats.hpp"

  37 #include "gc/g1/g1HeapVerifier.hpp"
  38 #include "gc/g1/g1HRPrinter.hpp"
  39 #include "gc/g1/g1InCSetState.hpp"
  40 #include "gc/g1/g1MonitoringSupport.hpp"
  41 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  42 #include "gc/g1/g1SurvivorRegions.hpp"
  43 #include "gc/g1/g1YCTypes.hpp"
  44 #include "gc/g1/hSpaceCounters.hpp"
  45 #include "gc/g1/heapRegionManager.hpp"
  46 #include "gc/g1/heapRegionSet.hpp"
  47 #include "gc/shared/barrierSet.hpp"
  48 #include "gc/shared/collectedHeap.hpp"
  49 #include "gc/shared/plab.hpp"
  50 #include "gc/shared/preservedMarks.hpp"
  51 #include "memory/memRegion.hpp"
  52 #include "utilities/stack.hpp"
  53 
  54 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
  55 // It uses the "Garbage First" heap organization and algorithm, which
  56 // may combine concurrent marking with parallel, incremental compaction of


  70 class CompactibleSpaceClosure;
  71 class Space;
  72 class G1CollectionSet;
  73 class G1CollectorPolicy;
  74 class G1Policy;
  75 class G1HotCardCache;
  76 class G1RemSet;
  77 class HeapRegionRemSetIterator;
  78 class G1ConcurrentMark;
  79 class ConcurrentMarkThread;
  80 class ConcurrentG1Refine;
  81 class GenerationCounters;
  82 class STWGCTimer;
  83 class G1NewTracer;
  84 class EvacuationFailedInfo;
  85 class nmethod;
  86 class Ticks;
  87 class WorkGang;
  88 class G1Allocator;
  89 class G1ArchiveAllocator;

  90 class G1HeapVerifier;
  91 class G1HeapSizingPolicy;
  92 
  93 typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
  94 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
  95 
  96 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
  97 typedef int CardIdx_t;     // needs to hold [ 0..CardsPerRegion )
  98 
  99 // The G1 STW is alive closure.
 100 // An instance is embedded into the G1CH and used as the
 101 // (optional) _is_alive_non_header closure in the STW
 102 // reference processor. It is also extensively used during
 103 // reference processing during STW evacuation pauses.
 104 class G1STWIsAliveClosure: public BoolObjectClosure {
 105   G1CollectedHeap* _g1;
 106 public:
 107   G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {}
 108   bool do_object_b(oop p);
 109 };


 493   // - if clear_all_soft_refs is true, all soft references should be
 494   //   cleared during the GC.
 495   // - it returns false if it is unable to do the collection due to the
 496   //   GC locker being active, true otherwise.
 497   bool do_full_collection(bool explicit_gc,
 498                           bool clear_all_soft_refs);
 499 
 500   // Callback from VM_G1CollectFull operation, or collect_as_vm_thread.
 501   virtual void do_full_collection(bool clear_all_soft_refs);
 502 
 503   // Resize the heap if necessary after a full collection.
 504   void resize_if_necessary_after_full_collection();
 505 
 506   // Callback from VM_G1CollectForAllocation operation.
 507   // This function does everything necessary/possible to satisfy a
 508   // failed allocation request (including collection, expansion, etc.)
 509   HeapWord* satisfy_failed_allocation(size_t word_size,
 510                                       AllocationContext_t context,
 511                                       bool* succeeded);
 512 private:











 513   // Helper method for satisfy_failed_allocation()
 514   HeapWord* satisfy_failed_allocation_helper(size_t word_size,
 515                                              AllocationContext_t context,
 516                                              bool do_gc,
 517                                              bool clear_all_soft_refs,
 518                                              bool expect_null_mutator_alloc_region,
 519                                              bool* gc_succeeded);
 520 
 521 protected:
 522   // Attempting to expand the heap sufficiently
 523   // to support an allocation of the given "word_size".  If
 524   // successful, perform the allocation and return the address of the
 525   // allocated block, or else "NULL".
 526   HeapWord* expand_and_allocate(size_t word_size, AllocationContext_t context);
 527 
 528   // Preserve any referents discovered by concurrent marking that have not yet been
 529   // copied by the STW pause.
 530   void preserve_cm_referents(G1ParScanThreadStateSet* per_thread_states);
 531   // Process any reference objects discovered during
 532   // an incremental evacuation pause.




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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/g1EdenRegions.hpp"
  35 #include "gc/g1/g1EvacFailure.hpp"
  36 #include "gc/g1/g1EvacStats.hpp"
  37 #include "gc/g1/g1HeapTransition.hpp"
  38 #include "gc/g1/g1HeapVerifier.hpp"
  39 #include "gc/g1/g1HRPrinter.hpp"
  40 #include "gc/g1/g1InCSetState.hpp"
  41 #include "gc/g1/g1MonitoringSupport.hpp"
  42 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  43 #include "gc/g1/g1SurvivorRegions.hpp"
  44 #include "gc/g1/g1YCTypes.hpp"
  45 #include "gc/g1/hSpaceCounters.hpp"
  46 #include "gc/g1/heapRegionManager.hpp"
  47 #include "gc/g1/heapRegionSet.hpp"
  48 #include "gc/shared/barrierSet.hpp"
  49 #include "gc/shared/collectedHeap.hpp"
  50 #include "gc/shared/plab.hpp"
  51 #include "gc/shared/preservedMarks.hpp"
  52 #include "memory/memRegion.hpp"
  53 #include "utilities/stack.hpp"
  54 
  55 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
  56 // It uses the "Garbage First" heap organization and algorithm, which
  57 // may combine concurrent marking with parallel, incremental compaction of


  71 class CompactibleSpaceClosure;
  72 class Space;
  73 class G1CollectionSet;
  74 class G1CollectorPolicy;
  75 class G1Policy;
  76 class G1HotCardCache;
  77 class G1RemSet;
  78 class HeapRegionRemSetIterator;
  79 class G1ConcurrentMark;
  80 class ConcurrentMarkThread;
  81 class ConcurrentG1Refine;
  82 class GenerationCounters;
  83 class STWGCTimer;
  84 class G1NewTracer;
  85 class EvacuationFailedInfo;
  86 class nmethod;
  87 class Ticks;
  88 class WorkGang;
  89 class G1Allocator;
  90 class G1ArchiveAllocator;
  91 class G1FullGCScope;
  92 class G1HeapVerifier;
  93 class G1HeapSizingPolicy;
  94 
  95 typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
  96 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
  97 
  98 typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
  99 typedef int CardIdx_t;     // needs to hold [ 0..CardsPerRegion )
 100 
 101 // The G1 STW is alive closure.
 102 // An instance is embedded into the G1CH and used as the
 103 // (optional) _is_alive_non_header closure in the STW
 104 // reference processor. It is also extensively used during
 105 // reference processing during STW evacuation pauses.
 106 class G1STWIsAliveClosure: public BoolObjectClosure {
 107   G1CollectedHeap* _g1;
 108 public:
 109   G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {}
 110   bool do_object_b(oop p);
 111 };


 495   // - if clear_all_soft_refs is true, all soft references should be
 496   //   cleared during the GC.
 497   // - it returns false if it is unable to do the collection due to the
 498   //   GC locker being active, true otherwise.
 499   bool do_full_collection(bool explicit_gc,
 500                           bool clear_all_soft_refs);
 501 
 502   // Callback from VM_G1CollectFull operation, or collect_as_vm_thread.
 503   virtual void do_full_collection(bool clear_all_soft_refs);
 504 
 505   // Resize the heap if necessary after a full collection.
 506   void resize_if_necessary_after_full_collection();
 507 
 508   // Callback from VM_G1CollectForAllocation operation.
 509   // This function does everything necessary/possible to satisfy a
 510   // failed allocation request (including collection, expansion, etc.)
 511   HeapWord* satisfy_failed_allocation(size_t word_size,
 512                                       AllocationContext_t context,
 513                                       bool* succeeded);
 514 private:
 515   // Internal helpers used during full GC to split it up to
 516   // increase readability.
 517   void do_full_collection_inner(G1FullGCScope* scope);
 518   void abort_concurrent_cycle();
 519   void verify_before_full_collection(bool explicit_gc);
 520   void prepare_heap_for_full_collection();
 521   void prepare_heap_for_mutators();
 522   void abort_refinement();
 523   void verify_after_full_collection();
 524   void print_heap_after_full_collection(G1HeapTransition* heap_transition);
 525 
 526   // Helper method for satisfy_failed_allocation()
 527   HeapWord* satisfy_failed_allocation_helper(size_t word_size,
 528                                              AllocationContext_t context,
 529                                              bool do_gc,
 530                                              bool clear_all_soft_refs,
 531                                              bool expect_null_mutator_alloc_region,
 532                                              bool* gc_succeeded);
 533 
 534 protected:
 535   // Attempting to expand the heap sufficiently
 536   // to support an allocation of the given "word_size".  If
 537   // successful, perform the allocation and return the address of the
 538   // allocated block, or else "NULL".
 539   HeapWord* expand_and_allocate(size_t word_size, AllocationContext_t context);
 540 
 541   // Preserve any referents discovered by concurrent marking that have not yet been
 542   // copied by the STW pause.
 543   void preserve_cm_referents(G1ParScanThreadStateSet* per_thread_states);
 544   // Process any reference objects discovered during
 545   // an incremental evacuation pause.


< prev index next >