Mercurial > hg > truffle
comparison src/share/vm/memory/collectorPolicy.cpp @ 12288:a7609ec351d6
Merge
author | dcubed |
---|---|
date | Fri, 20 Sep 2013 18:19:07 -0700 |
parents | 9e11762cee52 |
children | 9ecd6d3782b1 |
comparison
equal
deleted
inserted
replaced
12286:df03413ad1a9 | 12288:a7609ec351d6 |
---|---|
45 #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp" | 45 #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp" |
46 #endif // INCLUDE_ALL_GCS | 46 #endif // INCLUDE_ALL_GCS |
47 | 47 |
48 // CollectorPolicy methods. | 48 // CollectorPolicy methods. |
49 | 49 |
50 // Align down. If the aligning result in 0, return 'alignment'. | |
51 static size_t restricted_align_down(size_t size, size_t alignment) { | |
52 return MAX2(alignment, align_size_down_(size, alignment)); | |
53 } | |
54 | |
50 void CollectorPolicy::initialize_flags() { | 55 void CollectorPolicy::initialize_flags() { |
51 assert(max_alignment() >= min_alignment(), | 56 assert(max_alignment() >= min_alignment(), |
52 err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT, | 57 err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT, |
53 max_alignment(), min_alignment())); | 58 max_alignment(), min_alignment())); |
54 assert(max_alignment() % min_alignment() == 0, | 59 assert(max_alignment() % min_alignment() == 0, |
57 | 62 |
58 if (MaxHeapSize < InitialHeapSize) { | 63 if (MaxHeapSize < InitialHeapSize) { |
59 vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); | 64 vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); |
60 } | 65 } |
61 | 66 |
67 if (!is_size_aligned(MaxMetaspaceSize, max_alignment())) { | |
68 FLAG_SET_ERGO(uintx, MaxMetaspaceSize, | |
69 restricted_align_down(MaxMetaspaceSize, max_alignment())); | |
70 } | |
71 | |
62 if (MetaspaceSize > MaxMetaspaceSize) { | 72 if (MetaspaceSize > MaxMetaspaceSize) { |
63 MaxMetaspaceSize = MetaspaceSize; | 73 FLAG_SET_ERGO(uintx, MetaspaceSize, MaxMetaspaceSize); |
64 } | 74 } |
65 MetaspaceSize = MAX2(min_alignment(), align_size_down_(MetaspaceSize, min_alignment())); | 75 |
66 // Don't increase Metaspace size limit above specified. | 76 if (!is_size_aligned(MetaspaceSize, min_alignment())) { |
67 MaxMetaspaceSize = align_size_down(MaxMetaspaceSize, max_alignment()); | 77 FLAG_SET_ERGO(uintx, MetaspaceSize, |
68 if (MetaspaceSize > MaxMetaspaceSize) { | 78 restricted_align_down(MetaspaceSize, min_alignment())); |
69 MetaspaceSize = MaxMetaspaceSize; | 79 } |
70 } | 80 |
71 | 81 assert(MetaspaceSize <= MaxMetaspaceSize, "Must be"); |
72 MinMetaspaceExpansion = MAX2(min_alignment(), align_size_down_(MinMetaspaceExpansion, min_alignment())); | 82 |
73 MaxMetaspaceExpansion = MAX2(min_alignment(), align_size_down_(MaxMetaspaceExpansion, min_alignment())); | 83 MinMetaspaceExpansion = restricted_align_down(MinMetaspaceExpansion, min_alignment()); |
84 MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, min_alignment()); | |
74 | 85 |
75 MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); | 86 MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); |
76 | 87 |
77 assert(MetaspaceSize % min_alignment() == 0, "metapace alignment"); | 88 assert(MetaspaceSize % min_alignment() == 0, "metapace alignment"); |
78 assert(MaxMetaspaceSize % max_alignment() == 0, "maximum metaspace alignment"); | 89 assert(MaxMetaspaceSize % max_alignment() == 0, "maximum metaspace alignment"); |
143 _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near(); | 154 _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near(); |
144 } | 155 } |
145 _all_soft_refs_clear = true; | 156 _all_soft_refs_clear = true; |
146 } | 157 } |
147 | 158 |
159 size_t CollectorPolicy::compute_max_alignment() { | |
160 // The card marking array and the offset arrays for old generations are | |
161 // committed in os pages as well. Make sure they are entirely full (to | |
162 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 | |
163 // byte entry and the os page size is 4096, the maximum heap size should | |
164 // be 512*4096 = 2MB aligned. | |
165 | |
166 // There is only the GenRemSet in Hotspot and only the GenRemSet::CardTable | |
167 // is supported. | |
168 // Requirements of any new remembered set implementations must be added here. | |
169 size_t alignment = GenRemSet::max_alignment_constraint(GenRemSet::CardTable); | |
170 | |
171 // Parallel GC does its own alignment of the generations to avoid requiring a | |
172 // large page (256M on some platforms) for the permanent generation. The | |
173 // other collectors should also be updated to do their own alignment and then | |
174 // this use of lcm() should be removed. | |
175 if (UseLargePages && !UseParallelGC) { | |
176 // in presence of large pages we have to make sure that our | |
177 // alignment is large page aware | |
178 alignment = lcm(os::large_page_size(), alignment); | |
179 } | |
180 | |
181 return alignment; | |
182 } | |
148 | 183 |
149 // GenCollectorPolicy methods. | 184 // GenCollectorPolicy methods. |
150 | 185 |
151 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { | 186 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { |
152 size_t x = base_size / (NewRatio+1); | 187 size_t x = base_size / (NewRatio+1); |
171 _size_policy = new AdaptiveSizePolicy(init_eden_size, | 206 _size_policy = new AdaptiveSizePolicy(init_eden_size, |
172 init_promo_size, | 207 init_promo_size, |
173 init_survivor_size, | 208 init_survivor_size, |
174 max_gc_pause_sec, | 209 max_gc_pause_sec, |
175 GCTimeRatio); | 210 GCTimeRatio); |
176 } | |
177 | |
178 size_t GenCollectorPolicy::compute_max_alignment() { | |
179 // The card marking array and the offset arrays for old generations are | |
180 // committed in os pages as well. Make sure they are entirely full (to | |
181 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 | |
182 // byte entry and the os page size is 4096, the maximum heap size should | |
183 // be 512*4096 = 2MB aligned. | |
184 size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name()); | |
185 | |
186 // Parallel GC does its own alignment of the generations to avoid requiring a | |
187 // large page (256M on some platforms) for the permanent generation. The | |
188 // other collectors should also be updated to do their own alignment and then | |
189 // this use of lcm() should be removed. | |
190 if (UseLargePages && !UseParallelGC) { | |
191 // in presence of large pages we have to make sure that our | |
192 // alignment is large page aware | |
193 alignment = lcm(os::large_page_size(), alignment); | |
194 } | |
195 | |
196 assert(alignment >= min_alignment(), "Must be"); | |
197 | |
198 return alignment; | |
199 } | 211 } |
200 | 212 |
201 void GenCollectorPolicy::initialize_flags() { | 213 void GenCollectorPolicy::initialize_flags() { |
202 // All sizes must be multiples of the generation granularity. | 214 // All sizes must be multiples of the generation granularity. |
203 set_min_alignment((uintx) Generation::GenGrain); | 215 set_min_alignment((uintx) Generation::GenGrain); |