22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/metadataOnStackMark.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/icBuffer.hpp"
31 #include "gc/g1/bufferingOopClosure.hpp"
32 #include "gc/g1/concurrentG1Refine.hpp"
33 #include "gc/g1/concurrentG1RefineThread.hpp"
34 #include "gc/g1/concurrentMarkThread.inline.hpp"
35 #include "gc/g1/g1Allocator.inline.hpp"
36 #include "gc/g1/g1CollectedHeap.inline.hpp"
37 #include "gc/g1/g1CollectionSet.hpp"
38 #include "gc/g1/g1CollectorPolicy.hpp"
39 #include "gc/g1/g1CollectorState.hpp"
40 #include "gc/g1/g1EvacStats.inline.hpp"
41 #include "gc/g1/g1GCPhaseTimes.hpp"
42 #include "gc/g1/g1HeapTransition.hpp"
43 #include "gc/g1/g1HeapVerifier.hpp"
44 #include "gc/g1/g1MarkSweep.hpp"
45 #include "gc/g1/g1OopClosures.inline.hpp"
46 #include "gc/g1/g1ParScanThreadState.inline.hpp"
47 #include "gc/g1/g1RegionToSpaceMapper.hpp"
48 #include "gc/g1/g1RemSet.inline.hpp"
49 #include "gc/g1/g1RootClosures.hpp"
50 #include "gc/g1/g1RootProcessor.hpp"
51 #include "gc/g1/g1StringDedup.hpp"
52 #include "gc/g1/g1YCTypes.hpp"
53 #include "gc/g1/heapRegion.inline.hpp"
54 #include "gc/g1/heapRegionRemSet.hpp"
55 #include "gc/g1/heapRegionSet.inline.hpp"
56 #include "gc/g1/suspendibleThreadSet.hpp"
57 #include "gc/g1/vm_operations_g1.hpp"
58 #include "gc/shared/gcHeapSummary.hpp"
59 #include "gc/shared/gcId.hpp"
60 #include "gc/shared/gcLocker.inline.hpp"
61 #include "gc/shared/gcTimer.hpp"
1767 _expand_heap_after_alloc_failure(true),
1768 _old_marking_cycles_started(0),
1769 _old_marking_cycles_completed(0),
1770 _heap_summary_sent(false),
1771 _in_cset_fast_test(),
1772 _dirty_cards_region_list(NULL),
1773 _worker_cset_start_region(NULL),
1774 _worker_cset_start_region_time_stamp(NULL),
1775 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1776 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1777 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1778 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1779
1780 _workers = new WorkGang("GC Thread", ParallelGCThreads,
1781 /* are_GC_task_threads */true,
1782 /* are_ConcurrentGC_threads */false);
1783 _workers->initialize_workers();
1784 _verifier = new G1HeapVerifier(this);
1785
1786 _allocator = G1Allocator::create_allocator(this);
1787 _humongous_object_threshold_in_words = humongous_threshold_for(HeapRegion::GrainWords);
1788
1789 // Override the default _filler_array_max_size so that no humongous filler
1790 // objects are created.
1791 _filler_array_max_size = _humongous_object_threshold_in_words;
1792
1793 uint n_queues = ParallelGCThreads;
1794 _task_queues = new RefToScanQueueSet(n_queues);
1795
1796 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1797 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(uint, n_queues, mtGC);
1798 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1799
1800 for (uint i = 0; i < n_queues; i++) {
1801 RefToScanQueue* q = new RefToScanQueue();
1802 q->initialize();
1803 _task_queues->register_queue(i, q);
1804 ::new (&_evacuation_failed_info_array[i]) EvacuationFailedInfo();
1805 }
1806 clear_cset_start_regions();
3422 // when they were freed. Add in the bytes evacuated.
3423 increase_used(g1_policy()->bytes_copied_during_gc());
3424 }
3425
3426 if (collector_state()->during_initial_mark_pause()) {
3427 // We have to do this before we notify the CM threads that
3428 // they can start working to make sure that all the
3429 // appropriate initialization is done on the CM object.
3430 concurrent_mark()->checkpointRootsInitialPost();
3431 collector_state()->set_mark_in_progress(true);
3432 // Note that we don't actually trigger the CM thread at
3433 // this point. We do that later when we're sure that
3434 // the current thread has completed its logging output.
3435 }
3436
3437 allocate_dummy_regions();
3438
3439 _allocator->init_mutator_alloc_region();
3440
3441 {
3442 size_t expand_bytes = g1_policy()->expansion_amount();
3443 if (expand_bytes > 0) {
3444 size_t bytes_before = capacity();
3445 // No need for an ergo logging here,
3446 // expansion_amount() does this when it returns a value > 0.
3447 double expand_ms;
3448 if (!expand(expand_bytes, &expand_ms)) {
3449 // We failed to expand the heap. Cannot do anything about it.
3450 }
3451 g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
3452 }
3453 }
3454
3455 // We redo the verification but now wrt to the new CSet which
3456 // has just got initialized after the previous CSet was freed.
3457 _cm->verify_no_cset_oops();
3458 _cm->note_end_of_gc();
3459
3460 // This timing is only used by the ergonomics to handle our pause target.
3461 // It is unclear why this should not include the full pause. We will
3462 // investigate this in CR 7178365.
|
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/metadataOnStackMark.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/icBuffer.hpp"
31 #include "gc/g1/bufferingOopClosure.hpp"
32 #include "gc/g1/concurrentG1Refine.hpp"
33 #include "gc/g1/concurrentG1RefineThread.hpp"
34 #include "gc/g1/concurrentMarkThread.inline.hpp"
35 #include "gc/g1/g1Allocator.inline.hpp"
36 #include "gc/g1/g1CollectedHeap.inline.hpp"
37 #include "gc/g1/g1CollectionSet.hpp"
38 #include "gc/g1/g1CollectorPolicy.hpp"
39 #include "gc/g1/g1CollectorState.hpp"
40 #include "gc/g1/g1EvacStats.inline.hpp"
41 #include "gc/g1/g1GCPhaseTimes.hpp"
42 #include "gc/g1/g1HeapSizingPolicy.hpp"
43 #include "gc/g1/g1HeapTransition.hpp"
44 #include "gc/g1/g1HeapVerifier.hpp"
45 #include "gc/g1/g1MarkSweep.hpp"
46 #include "gc/g1/g1OopClosures.inline.hpp"
47 #include "gc/g1/g1ParScanThreadState.inline.hpp"
48 #include "gc/g1/g1RegionToSpaceMapper.hpp"
49 #include "gc/g1/g1RemSet.inline.hpp"
50 #include "gc/g1/g1RootClosures.hpp"
51 #include "gc/g1/g1RootProcessor.hpp"
52 #include "gc/g1/g1StringDedup.hpp"
53 #include "gc/g1/g1YCTypes.hpp"
54 #include "gc/g1/heapRegion.inline.hpp"
55 #include "gc/g1/heapRegionRemSet.hpp"
56 #include "gc/g1/heapRegionSet.inline.hpp"
57 #include "gc/g1/suspendibleThreadSet.hpp"
58 #include "gc/g1/vm_operations_g1.hpp"
59 #include "gc/shared/gcHeapSummary.hpp"
60 #include "gc/shared/gcId.hpp"
61 #include "gc/shared/gcLocker.inline.hpp"
62 #include "gc/shared/gcTimer.hpp"
1768 _expand_heap_after_alloc_failure(true),
1769 _old_marking_cycles_started(0),
1770 _old_marking_cycles_completed(0),
1771 _heap_summary_sent(false),
1772 _in_cset_fast_test(),
1773 _dirty_cards_region_list(NULL),
1774 _worker_cset_start_region(NULL),
1775 _worker_cset_start_region_time_stamp(NULL),
1776 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1777 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1778 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1779 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1780
1781 _workers = new WorkGang("GC Thread", ParallelGCThreads,
1782 /* are_GC_task_threads */true,
1783 /* are_ConcurrentGC_threads */false);
1784 _workers->initialize_workers();
1785 _verifier = new G1HeapVerifier(this);
1786
1787 _allocator = G1Allocator::create_allocator(this);
1788
1789 _heap_sizing_policy = G1HeapSizingPolicy::create(this, _g1_policy->measurements());
1790
1791 _humongous_object_threshold_in_words = humongous_threshold_for(HeapRegion::GrainWords);
1792
1793 // Override the default _filler_array_max_size so that no humongous filler
1794 // objects are created.
1795 _filler_array_max_size = _humongous_object_threshold_in_words;
1796
1797 uint n_queues = ParallelGCThreads;
1798 _task_queues = new RefToScanQueueSet(n_queues);
1799
1800 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1801 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(uint, n_queues, mtGC);
1802 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1803
1804 for (uint i = 0; i < n_queues; i++) {
1805 RefToScanQueue* q = new RefToScanQueue();
1806 q->initialize();
1807 _task_queues->register_queue(i, q);
1808 ::new (&_evacuation_failed_info_array[i]) EvacuationFailedInfo();
1809 }
1810 clear_cset_start_regions();
3426 // when they were freed. Add in the bytes evacuated.
3427 increase_used(g1_policy()->bytes_copied_during_gc());
3428 }
3429
3430 if (collector_state()->during_initial_mark_pause()) {
3431 // We have to do this before we notify the CM threads that
3432 // they can start working to make sure that all the
3433 // appropriate initialization is done on the CM object.
3434 concurrent_mark()->checkpointRootsInitialPost();
3435 collector_state()->set_mark_in_progress(true);
3436 // Note that we don't actually trigger the CM thread at
3437 // this point. We do that later when we're sure that
3438 // the current thread has completed its logging output.
3439 }
3440
3441 allocate_dummy_regions();
3442
3443 _allocator->init_mutator_alloc_region();
3444
3445 {
3446 size_t expand_bytes = _heap_sizing_policy->expansion_amount();
3447 if (expand_bytes > 0) {
3448 size_t bytes_before = capacity();
3449 // No need for an ergo logging here,
3450 // expansion_amount() does this when it returns a value > 0.
3451 double expand_ms;
3452 if (!expand(expand_bytes, &expand_ms)) {
3453 // We failed to expand the heap. Cannot do anything about it.
3454 }
3455 g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
3456 }
3457 }
3458
3459 // We redo the verification but now wrt to the new CSet which
3460 // has just got initialized after the previous CSet was freed.
3461 _cm->verify_no_cset_oops();
3462 _cm->note_end_of_gc();
3463
3464 // This timing is only used by the ergonomics to handle our pause target.
3465 // It is unclear why this should not include the full pause. We will
3466 // investigate this in CR 7178365.
|