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