comparison src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @ 13059:46d7652b223c

8026853: Prepare GC code for collector policy regression fix Summary: Cleanup related to the NewSize and MaxNewSize bugs Reviewed-by: tschatzl, jcoomes, ehelin
author jwilhelm
date Mon, 21 Oct 2013 18:56:20 +0200
parents 40136aa2cdb1
children 8f07aa079343
comparison
equal deleted inserted replaced
13058:3aee6bc29547 13059:46d7652b223c
33 #include "gc_implementation/shared/gcWhen.hpp" 33 #include "gc_implementation/shared/gcWhen.hpp"
34 #include "gc_interface/collectedHeap.inline.hpp" 34 #include "gc_interface/collectedHeap.inline.hpp"
35 #include "utilities/ostream.hpp" 35 #include "utilities/ostream.hpp"
36 36
37 class AdjoiningGenerations; 37 class AdjoiningGenerations;
38 class CollectorPolicy;
39 class GCHeapSummary; 38 class GCHeapSummary;
40 class GCTaskManager; 39 class GCTaskManager;
41 class GenerationSizer; 40 class GenerationSizer;
42 class CollectorPolicy; 41 class CollectorPolicy;
43 class PSAdaptiveSizePolicy; 42 class PSAdaptiveSizePolicy;
48 private: 47 private:
49 static PSYoungGen* _young_gen; 48 static PSYoungGen* _young_gen;
50 static PSOldGen* _old_gen; 49 static PSOldGen* _old_gen;
51 50
52 // Sizing policy for entire heap 51 // Sizing policy for entire heap
53 static PSAdaptiveSizePolicy* _size_policy; 52 static PSAdaptiveSizePolicy* _size_policy;
54 static PSGCAdaptivePolicyCounters* _gc_policy_counters; 53 static PSGCAdaptivePolicyCounters* _gc_policy_counters;
55 54
56 static ParallelScavengeHeap* _psh; 55 static ParallelScavengeHeap* _psh;
57 56
58 size_t _young_gen_alignment; 57 size_t _young_gen_alignment;
59 size_t _old_gen_alignment; 58 size_t _old_gen_alignment;
65 // Collection of generations that are adjacent in the 64 // Collection of generations that are adjacent in the
66 // space reserved for the heap. 65 // space reserved for the heap.
67 AdjoiningGenerations* _gens; 66 AdjoiningGenerations* _gens;
68 unsigned int _death_march_count; 67 unsigned int _death_march_count;
69 68
70 static GCTaskManager* _gc_task_manager; // The task manager. 69 // The task manager
70 static GCTaskManager* _gc_task_manager;
71 71
72 void trace_heap(GCWhen::Type when, GCTracer* tracer); 72 void trace_heap(GCWhen::Type when, GCTracer* tracer);
73 73
74 protected: 74 protected:
75 static inline size_t total_invocations(); 75 static inline size_t total_invocations();
78 inline bool should_alloc_in_eden(size_t size) const; 78 inline bool should_alloc_in_eden(size_t size) const;
79 inline void death_march_check(HeapWord* const result, size_t size); 79 inline void death_march_check(HeapWord* const result, size_t size);
80 HeapWord* mem_allocate_old_gen(size_t size); 80 HeapWord* mem_allocate_old_gen(size_t size);
81 81
82 public: 82 public:
83 ParallelScavengeHeap() : CollectedHeap() { 83 ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) {
84 _death_march_count = 0;
85 set_alignment(_young_gen_alignment, intra_heap_alignment()); 84 set_alignment(_young_gen_alignment, intra_heap_alignment());
86 set_alignment(_old_gen_alignment, intra_heap_alignment()); 85 set_alignment(_old_gen_alignment, intra_heap_alignment());
87 } 86 }
88 87
89 // Return the (conservative) maximum heap alignment 88 // Return the (conservative) maximum heap alignment
90 static size_t conservative_max_heap_alignment() { 89 static size_t conservative_max_heap_alignment() {
91 return intra_heap_alignment(); 90 return GenCollectorPolicy::intra_heap_alignment();
92 } 91 }
93 92
94 // For use by VM operations 93 // For use by VM operations
95 enum CollectionType { 94 enum CollectionType {
96 Scavenge, 95 Scavenge,
101 return CollectedHeap::ParallelScavengeHeap; 100 return CollectedHeap::ParallelScavengeHeap;
102 } 101 }
103 102
104 virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; } 103 virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
105 104
106 static PSYoungGen* young_gen() { return _young_gen; } 105 static PSYoungGen* young_gen() { return _young_gen; }
107 static PSOldGen* old_gen() { return _old_gen; } 106 static PSOldGen* old_gen() { return _old_gen; }
108 107
109 virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; } 108 virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; }
110 109
111 static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; } 110 static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
112 111
125 size_t young_gen_alignment() const { return _young_gen_alignment; } 124 size_t young_gen_alignment() const { return _young_gen_alignment; }
126 size_t old_gen_alignment() const { return _old_gen_alignment; } 125 size_t old_gen_alignment() const { return _old_gen_alignment; }
127 126
128 // The alignment used for eden and survivors within the young gen 127 // The alignment used for eden and survivors within the young gen
129 // and for boundary between young gen and old gen. 128 // and for boundary between young gen and old gen.
130 static size_t intra_heap_alignment() { return 64 * K * HeapWordSize; } 129 size_t intra_heap_alignment() { return GenCollectorPolicy::intra_heap_alignment(); }
131 130
132 size_t capacity() const; 131 size_t capacity() const;
133 size_t used() const; 132 size_t used() const;
134 133
135 // Return "true" if all generations have reached the 134 // Return "true" if all generations have reached the
155 154
156 #ifdef ASSERT 155 #ifdef ASSERT
157 virtual bool is_in_partial_collection(const void *p); 156 virtual bool is_in_partial_collection(const void *p);
158 #endif 157 #endif
159 158
160 bool is_in_young(oop p); // reserved part 159 bool is_in_young(oop p); // reserved part
161 bool is_in_old(oop p); // reserved part 160 bool is_in_old(oop p); // reserved part
162 161
163 // Memory allocation. "gc_time_limit_was_exceeded" will 162 // Memory allocation. "gc_time_limit_was_exceeded" will
164 // be set to true if the adaptive size policy determine that 163 // be set to true if the adaptive size policy determine that
165 // an excessive amount of time is being spent doing collections 164 // an excessive amount of time is being spent doing collections
166 // and caused a NULL to be returned. If a NULL is not returned, 165 // and caused a NULL to be returned. If a NULL is not returned,
167 // "gc_time_limit_was_exceeded" has an undefined meaning. 166 // "gc_time_limit_was_exceeded" has an undefined meaning.
168 HeapWord* mem_allocate(size_t size, 167 HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
169 bool* gc_overhead_limit_was_exceeded);
170 168
171 // Allocation attempt(s) during a safepoint. It should never be called 169 // Allocation attempt(s) during a safepoint. It should never be called
172 // to allocate a new TLAB as this allocation might be satisfied out 170 // to allocate a new TLAB as this allocation might be satisfied out
173 // of the old generation. 171 // of the old generation.
174 HeapWord* failed_mem_allocate(size_t size); 172 HeapWord* failed_mem_allocate(size_t size);
255 // Mangle the unused parts of all spaces in the heap 253 // Mangle the unused parts of all spaces in the heap
256 void gen_mangle_unused_area() PRODUCT_RETURN; 254 void gen_mangle_unused_area() PRODUCT_RETURN;
257 255
258 // Call these in sequential code around the processing of strong roots. 256 // Call these in sequential code around the processing of strong roots.
259 class ParStrongRootsScope : public MarkingCodeBlobClosure::MarkScope { 257 class ParStrongRootsScope : public MarkingCodeBlobClosure::MarkScope {
260 public: 258 public:
261 ParStrongRootsScope(); 259 ParStrongRootsScope();
262 ~ParStrongRootsScope(); 260 ~ParStrongRootsScope();
263 }; 261 };
264 }; 262 };
265 263