Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @ 13060:8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
7057939: jmap shows MaxNewSize=4GB when Java is using parallel collector
Summary: Major cleanup of the collectorpolicy classes
Reviewed-by: tschatzl, jcoomes
author | jwilhelm |
---|---|
date | Fri, 01 Nov 2013 17:09:38 +0100 |
parents | 46d7652b223c |
children | ff355e26c78d cfd4aac53239 |
comparison
equal
deleted
inserted
replaced
13059:46d7652b223c | 13060:8f07aa079343 |
---|---|
23 */ | 23 */ |
24 | 24 |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP | 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP |
27 | 27 |
28 #include "gc_implementation/parallelScavenge/generationSizer.hpp" | |
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp" | 29 #include "gc_implementation/parallelScavenge/objectStartArray.hpp" |
29 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp" | 30 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp" |
30 #include "gc_implementation/parallelScavenge/psOldGen.hpp" | 31 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
31 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" | 32 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" |
32 #include "gc_implementation/shared/gcPolicyCounters.hpp" | 33 #include "gc_implementation/shared/gcPolicyCounters.hpp" |
33 #include "gc_implementation/shared/gcWhen.hpp" | 34 #include "gc_implementation/shared/gcWhen.hpp" |
34 #include "gc_interface/collectedHeap.inline.hpp" | 35 #include "gc_interface/collectedHeap.inline.hpp" |
36 #include "memory/collectorPolicy.hpp" | |
35 #include "utilities/ostream.hpp" | 37 #include "utilities/ostream.hpp" |
36 | 38 |
37 class AdjoiningGenerations; | 39 class AdjoiningGenerations; |
38 class GCHeapSummary; | 40 class GCHeapSummary; |
39 class GCTaskManager; | 41 class GCTaskManager; |
40 class GenerationSizer; | |
41 class CollectorPolicy; | |
42 class PSAdaptiveSizePolicy; | 42 class PSAdaptiveSizePolicy; |
43 class PSHeapSummary; | 43 class PSHeapSummary; |
44 | 44 |
45 class ParallelScavengeHeap : public CollectedHeap { | 45 class ParallelScavengeHeap : public CollectedHeap { |
46 friend class VMStructs; | 46 friend class VMStructs; |
52 static PSAdaptiveSizePolicy* _size_policy; | 52 static PSAdaptiveSizePolicy* _size_policy; |
53 static PSGCAdaptivePolicyCounters* _gc_policy_counters; | 53 static PSGCAdaptivePolicyCounters* _gc_policy_counters; |
54 | 54 |
55 static ParallelScavengeHeap* _psh; | 55 static ParallelScavengeHeap* _psh; |
56 | 56 |
57 size_t _young_gen_alignment; | |
58 size_t _old_gen_alignment; | |
59 | |
60 GenerationSizer* _collector_policy; | 57 GenerationSizer* _collector_policy; |
61 | |
62 inline size_t set_alignment(size_t& var, size_t val); | |
63 | 58 |
64 // Collection of generations that are adjacent in the | 59 // Collection of generations that are adjacent in the |
65 // space reserved for the heap. | 60 // space reserved for the heap. |
66 AdjoiningGenerations* _gens; | 61 AdjoiningGenerations* _gens; |
67 unsigned int _death_march_count; | 62 unsigned int _death_march_count; |
78 inline bool should_alloc_in_eden(size_t size) const; | 73 inline bool should_alloc_in_eden(size_t size) const; |
79 inline void death_march_check(HeapWord* const result, size_t size); | 74 inline void death_march_check(HeapWord* const result, size_t size); |
80 HeapWord* mem_allocate_old_gen(size_t size); | 75 HeapWord* mem_allocate_old_gen(size_t size); |
81 | 76 |
82 public: | 77 public: |
83 ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) { | 78 ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) { } |
84 set_alignment(_young_gen_alignment, intra_heap_alignment()); | |
85 set_alignment(_old_gen_alignment, intra_heap_alignment()); | |
86 } | |
87 | |
88 // Return the (conservative) maximum heap alignment | |
89 static size_t conservative_max_heap_alignment() { | |
90 return GenCollectorPolicy::intra_heap_alignment(); | |
91 } | |
92 | 79 |
93 // For use by VM operations | 80 // For use by VM operations |
94 enum CollectionType { | 81 enum CollectionType { |
95 Scavenge, | 82 Scavenge, |
96 MarkSweep | 83 MarkSweep |
118 // Returns JNI_OK on success | 105 // Returns JNI_OK on success |
119 virtual jint initialize(); | 106 virtual jint initialize(); |
120 | 107 |
121 void post_initialize(); | 108 void post_initialize(); |
122 void update_counters(); | 109 void update_counters(); |
123 // The alignment used for the various generations. | 110 |
124 size_t young_gen_alignment() const { return _young_gen_alignment; } | 111 // The alignment used for the various areas |
125 size_t old_gen_alignment() const { return _old_gen_alignment; } | 112 size_t space_alignment() { return _collector_policy->space_alignment(); } |
126 | 113 size_t generation_alignment() { return _collector_policy->gen_alignment(); } |
127 // The alignment used for eden and survivors within the young gen | 114 |
128 // and for boundary between young gen and old gen. | 115 // Return the (conservative) maximum heap alignment |
129 size_t intra_heap_alignment() { return GenCollectorPolicy::intra_heap_alignment(); } | 116 static size_t conservative_max_heap_alignment() { |
117 return CollectorPolicy::compute_heap_alignment(); | |
118 } | |
130 | 119 |
131 size_t capacity() const; | 120 size_t capacity() const; |
132 size_t used() const; | 121 size_t used() const; |
133 | 122 |
134 // Return "true" if all generations have reached the | 123 // Return "true" if all generations have reached the |
259 ParStrongRootsScope(); | 248 ParStrongRootsScope(); |
260 ~ParStrongRootsScope(); | 249 ~ParStrongRootsScope(); |
261 }; | 250 }; |
262 }; | 251 }; |
263 | 252 |
264 inline size_t ParallelScavengeHeap::set_alignment(size_t& var, size_t val) | |
265 { | |
266 assert(is_power_of_2((intptr_t)val), "must be a power of 2"); | |
267 var = round_to(val, intra_heap_alignment()); | |
268 return var; | |
269 } | |
270 | |
271 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP | 253 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP |