39 #include "gc_implementation/shared/gcTraceTime.hpp"
40 #include "gc_implementation/shared/isGCActiveMark.hpp"
41 #include "gc_implementation/shared/spaceDecorator.hpp"
42 #include "gc_interface/gcCause.hpp"
43 #include "memory/collectorPolicy.hpp"
44 #include "memory/gcLocker.inline.hpp"
45 #include "memory/referencePolicy.hpp"
46 #include "memory/referenceProcessor.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "oops/oop.psgc.inline.hpp"
50 #include "runtime/biasedLocking.hpp"
51 #include "runtime/fprofiler.hpp"
52 #include "runtime/handles.inline.hpp"
53 #include "runtime/threadCritical.hpp"
54 #include "runtime/vmThread.hpp"
55 #include "runtime/vm_operations.hpp"
56 #include "services/memoryService.hpp"
57 #include "utilities/stack.inline.hpp"
58
59
60 HeapWord* PSScavenge::_to_space_top_before_gc = NULL;
61 int PSScavenge::_consecutive_skipped_scavenges = 0;
62 ReferenceProcessor* PSScavenge::_ref_processor = NULL;
63 CardTableExtension* PSScavenge::_card_table = NULL;
64 bool PSScavenge::_survivor_overflow = false;
65 uint PSScavenge::_tenuring_threshold = 0;
66 HeapWord* PSScavenge::_young_generation_boundary = NULL;
67 uintptr_t PSScavenge::_young_generation_boundary_compressed = 0;
68 elapsedTimer PSScavenge::_accumulated_time;
69 STWGCTimer PSScavenge::_gc_timer;
70 ParallelScavengeTracer PSScavenge::_gc_tracer;
71 Stack<markOop, mtGC> PSScavenge::_preserved_mark_stack;
72 Stack<oop, mtGC> PSScavenge::_preserved_oop_stack;
73 CollectorCounters* PSScavenge::_counters = NULL;
74
75 // Define before use
76 class PSIsAliveClosure: public BoolObjectClosure {
77 public:
78 bool do_object_b(oop p) {
816 _consecutive_skipped_scavenges++;
817 if (UsePerfData) {
818 counters->update_scavenge_skipped(promoted_too_large);
819 }
820 }
821 return result;
822 }
823
824 // Used to add tasks
825 GCTaskManager* const PSScavenge::gc_task_manager() {
826 assert(ParallelScavengeHeap::gc_task_manager() != NULL,
827 "shouldn't return NULL");
828 return ParallelScavengeHeap::gc_task_manager();
829 }
830
831 void PSScavenge::initialize() {
832 // Arguments must have been parsed
833
834 if (AlwaysTenure || NeverTenure) {
835 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
836 err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
837 _tenuring_threshold = MaxTenuringThreshold;
838 } else {
839 // We want to smooth out our startup times for the AdaptiveSizePolicy
840 _tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
841 MaxTenuringThreshold;
842 }
843
844 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
845 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
846
847 PSYoungGen* young_gen = heap->young_gen();
848 PSOldGen* old_gen = heap->old_gen();
849
850 // Set boundary between young_gen and old_gen
851 assert(old_gen->reserved().end() <= young_gen->eden_space()->bottom(),
852 "old above young");
853 set_young_generation_boundary(young_gen->eden_space()->bottom());
854
855 // Initialize ref handling object for scavenging.
856 MemRegion mr = young_gen->reserved();
|
39 #include "gc_implementation/shared/gcTraceTime.hpp"
40 #include "gc_implementation/shared/isGCActiveMark.hpp"
41 #include "gc_implementation/shared/spaceDecorator.hpp"
42 #include "gc_interface/gcCause.hpp"
43 #include "memory/collectorPolicy.hpp"
44 #include "memory/gcLocker.inline.hpp"
45 #include "memory/referencePolicy.hpp"
46 #include "memory/referenceProcessor.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "oops/oop.psgc.inline.hpp"
50 #include "runtime/biasedLocking.hpp"
51 #include "runtime/fprofiler.hpp"
52 #include "runtime/handles.inline.hpp"
53 #include "runtime/threadCritical.hpp"
54 #include "runtime/vmThread.hpp"
55 #include "runtime/vm_operations.hpp"
56 #include "services/memoryService.hpp"
57 #include "utilities/stack.inline.hpp"
58
59 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
60
61 HeapWord* PSScavenge::_to_space_top_before_gc = NULL;
62 int PSScavenge::_consecutive_skipped_scavenges = 0;
63 ReferenceProcessor* PSScavenge::_ref_processor = NULL;
64 CardTableExtension* PSScavenge::_card_table = NULL;
65 bool PSScavenge::_survivor_overflow = false;
66 uint PSScavenge::_tenuring_threshold = 0;
67 HeapWord* PSScavenge::_young_generation_boundary = NULL;
68 uintptr_t PSScavenge::_young_generation_boundary_compressed = 0;
69 elapsedTimer PSScavenge::_accumulated_time;
70 STWGCTimer PSScavenge::_gc_timer;
71 ParallelScavengeTracer PSScavenge::_gc_tracer;
72 Stack<markOop, mtGC> PSScavenge::_preserved_mark_stack;
73 Stack<oop, mtGC> PSScavenge::_preserved_oop_stack;
74 CollectorCounters* PSScavenge::_counters = NULL;
75
76 // Define before use
77 class PSIsAliveClosure: public BoolObjectClosure {
78 public:
79 bool do_object_b(oop p) {
817 _consecutive_skipped_scavenges++;
818 if (UsePerfData) {
819 counters->update_scavenge_skipped(promoted_too_large);
820 }
821 }
822 return result;
823 }
824
825 // Used to add tasks
826 GCTaskManager* const PSScavenge::gc_task_manager() {
827 assert(ParallelScavengeHeap::gc_task_manager() != NULL,
828 "shouldn't return NULL");
829 return ParallelScavengeHeap::gc_task_manager();
830 }
831
832 void PSScavenge::initialize() {
833 // Arguments must have been parsed
834
835 if (AlwaysTenure || NeverTenure) {
836 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
837 err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold));
838 _tenuring_threshold = MaxTenuringThreshold;
839 } else {
840 // We want to smooth out our startup times for the AdaptiveSizePolicy
841 _tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
842 MaxTenuringThreshold;
843 }
844
845 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
846 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
847
848 PSYoungGen* young_gen = heap->young_gen();
849 PSOldGen* old_gen = heap->old_gen();
850
851 // Set boundary between young_gen and old_gen
852 assert(old_gen->reserved().end() <= young_gen->eden_space()->bottom(),
853 "old above young");
854 set_young_generation_boundary(young_gen->eden_space()->bottom());
855
856 // Initialize ref handling object for scavenging.
857 MemRegion mr = young_gen->reserved();
|