Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @ 6629:c9814fadeb38
7041879: G1: introduce stress testing parameter to cause frequent evacuation failures
Summary: Add the flags G1EvacuationFailureALot flag (and supporting flags) to force trigger evacuation failures. The support flags control how often to trigger an evacuation failure and during which types of evacuation pause. This functionality is analogous to that of PromotionFailureALot for the other collectors.
Reviewed-by: brutisso
author | johnc |
---|---|
date | Tue, 28 Aug 2012 15:20:08 -0700 |
parents | f44782f04dd4 |
children | 992f62c457b0 2e093b564241 |
comparison
equal
deleted
inserted
replaced
6628:bb3f6194fedb | 6629:c9814fadeb38 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
136 | 136 |
137 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const { | 137 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const { |
138 return _task_queues->queue(i); | 138 return _task_queues->queue(i); |
139 } | 139 } |
140 | 140 |
141 inline bool G1CollectedHeap::isMarkedPrev(oop obj) const { | 141 inline bool G1CollectedHeap::isMarkedPrev(oop obj) const { |
142 return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj); | 142 return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj); |
143 } | 143 } |
144 | 144 |
145 inline bool G1CollectedHeap::isMarkedNext(oop obj) const { | 145 inline bool G1CollectedHeap::isMarkedNext(oop obj) const { |
146 return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj); | 146 return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj); |
147 } | 147 } |
148 | 148 |
149 #ifndef PRODUCT | |
150 // Support for G1EvacuationFailureALot | |
151 | |
152 inline bool | |
153 G1CollectedHeap::evacuation_failure_alot_for_gc_type(bool gcs_are_young, | |
154 bool during_initial_mark, | |
155 bool during_marking) { | |
156 bool res = false; | |
157 if (during_marking) { | |
158 res |= G1EvacuationFailureALotDuringConcMark; | |
159 } | |
160 if (during_initial_mark) { | |
161 res |= G1EvacuationFailureALotDuringInitialMark; | |
162 } | |
163 if (gcs_are_young) { | |
164 res |= G1EvacuationFailureALotDuringYoungGC; | |
165 } else { | |
166 // GCs are mixed | |
167 res |= G1EvacuationFailureALotDuringMixedGC; | |
168 } | |
169 return res; | |
170 } | |
171 | |
172 inline void | |
173 G1CollectedHeap::set_evacuation_failure_alot_for_current_gc() { | |
174 if (G1EvacuationFailureALot) { | |
175 // Note we can't assert that _evacuation_failure_alot_for_current_gc | |
176 // is clear here. It may have been set during a previous GC but that GC | |
177 // did not copy enough objects (i.e. G1EvacuationFailureALotCount) to | |
178 // trigger an evacuation failure and clear the flags and and counts. | |
179 | |
180 // Check if we have gone over the interval. | |
181 const size_t gc_num = total_collections(); | |
182 const size_t elapsed_gcs = gc_num - _evacuation_failure_alot_gc_number; | |
183 | |
184 _evacuation_failure_alot_for_current_gc = (elapsed_gcs >= G1EvacuationFailureALotInterval); | |
185 | |
186 // Now check if G1EvacuationFailureALot is enabled for the current GC type. | |
187 const bool gcs_are_young = g1_policy()->gcs_are_young(); | |
188 const bool during_im = g1_policy()->during_initial_mark_pause(); | |
189 const bool during_marking = mark_in_progress(); | |
190 | |
191 _evacuation_failure_alot_for_current_gc &= | |
192 evacuation_failure_alot_for_gc_type(gcs_are_young, | |
193 during_im, | |
194 during_marking); | |
195 } | |
196 } | |
197 | |
198 inline bool | |
199 G1CollectedHeap::evacuation_should_fail() { | |
200 if (!G1EvacuationFailureALot || !_evacuation_failure_alot_for_current_gc) { | |
201 return false; | |
202 } | |
203 // G1EvacuationFailureALot is in effect for current GC | |
204 // Access to _evacuation_failure_alot_count is not atomic; | |
205 // the value does not have to be exact. | |
206 if (++_evacuation_failure_alot_count < G1EvacuationFailureALotCount) { | |
207 return false; | |
208 } | |
209 _evacuation_failure_alot_count = 0; | |
210 return true; | |
211 } | |
212 | |
213 inline void G1CollectedHeap::reset_evacuation_should_fail() { | |
214 if (G1EvacuationFailureALot) { | |
215 _evacuation_failure_alot_gc_number = total_collections(); | |
216 _evacuation_failure_alot_count = 0; | |
217 _evacuation_failure_alot_for_current_gc = false; | |
218 } | |
219 } | |
220 #endif // #ifndef PRODUCT | |
221 | |
149 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP | 222 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP |