10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
27
28 #include "gc_implementation/shared/gcTrace.hpp"
29 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
30 #include "gc_implementation/shared/promotionFailedInfo.hpp"
31 #include "memory/defNewGeneration.hpp"
32 #include "utilities/taskqueue.hpp"
33
34 class ChunkArray;
35 class ParScanWithoutBarrierClosure;
36 class ParScanWithBarrierClosure;
37 class ParRootScanWithoutBarrierClosure;
38 class ParRootScanWithBarrierTwoGensClosure;
39 class ParEvacuateFollowersClosure;
40
41 // It would be better if these types could be kept local to the .cpp file,
42 // but they must be here to allow ParScanClosure::do_oop_work to be defined
43 // in genOopClosures.inline.hpp.
44
45 typedef Padded<OopTaskQueue> ObjToScanQueue;
46 typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
47
48 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
49 private:
50 ParScanWeakRefClosure* _par_cl;
166 // Allocate a to-space block of size "sz", or else return NULL.
167 HeapWord* alloc_in_to_space_slow(size_t word_sz);
168
169 HeapWord* alloc_in_to_space(size_t word_sz) {
170 HeapWord* obj = to_space_alloc_buffer()->allocate(word_sz);
171 if (obj != NULL) return obj;
172 else return alloc_in_to_space_slow(word_sz);
173 }
174
175 HeapWord* young_old_boundary() { return _young_old_boundary; }
176
177 void set_young_old_boundary(HeapWord *boundary) {
178 _young_old_boundary = boundary;
179 }
180
181 // Undo the most recent allocation ("obj", of "word_sz").
182 void undo_alloc_in_to_space(HeapWord* obj, size_t word_sz);
183
184 // Promotion failure stats
185 void register_promotion_failure(size_t sz) {
186 _promotion_failed_info.register_promotion_failed(sz);
187 }
188 PromotionFailedInfo& promotion_failed_info() {
189 return _promotion_failed_info;
190 }
191 bool promotion_failed() {
192 return _promotion_failed_info.promotion_failed();
193 }
194 void print_promotion_failure_size();
195
196 #if TASKQUEUE_STATS
197 TaskQueueStats & taskqueue_stats() const { return _work_queue->stats; }
198
199 size_t term_attempts() const { return _term_attempts; }
200 size_t overflow_refills() const { return _overflow_refills; }
201 size_t overflow_refill_objs() const { return _overflow_refill_objs; }
202
203 void note_term_attempt() { ++_term_attempts; }
204 void note_overflow_refill(size_t objs) {
205 ++_overflow_refills; _overflow_refill_objs += objs;
206 }
207
208 void reset_stats();
209 #endif // TASKQUEUE_STATS
210
211 void start_strong_roots() {
212 _start_strong_roots = os::elapsedTime();
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
27
28 #include "gc_implementation/shared/gcTrace.hpp"
29 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
30 #include "gc_implementation/shared/copyFailedInfo.hpp"
31 #include "memory/defNewGeneration.hpp"
32 #include "utilities/taskqueue.hpp"
33
34 class ChunkArray;
35 class ParScanWithoutBarrierClosure;
36 class ParScanWithBarrierClosure;
37 class ParRootScanWithoutBarrierClosure;
38 class ParRootScanWithBarrierTwoGensClosure;
39 class ParEvacuateFollowersClosure;
40
41 // It would be better if these types could be kept local to the .cpp file,
42 // but they must be here to allow ParScanClosure::do_oop_work to be defined
43 // in genOopClosures.inline.hpp.
44
45 typedef Padded<OopTaskQueue> ObjToScanQueue;
46 typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
47
48 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
49 private:
50 ParScanWeakRefClosure* _par_cl;
166 // Allocate a to-space block of size "sz", or else return NULL.
167 HeapWord* alloc_in_to_space_slow(size_t word_sz);
168
169 HeapWord* alloc_in_to_space(size_t word_sz) {
170 HeapWord* obj = to_space_alloc_buffer()->allocate(word_sz);
171 if (obj != NULL) return obj;
172 else return alloc_in_to_space_slow(word_sz);
173 }
174
175 HeapWord* young_old_boundary() { return _young_old_boundary; }
176
177 void set_young_old_boundary(HeapWord *boundary) {
178 _young_old_boundary = boundary;
179 }
180
181 // Undo the most recent allocation ("obj", of "word_sz").
182 void undo_alloc_in_to_space(HeapWord* obj, size_t word_sz);
183
184 // Promotion failure stats
185 void register_promotion_failure(size_t sz) {
186 _promotion_failed_info.register_copy_failure(sz);
187 }
188 PromotionFailedInfo& promotion_failed_info() {
189 return _promotion_failed_info;
190 }
191 bool promotion_failed() {
192 return _promotion_failed_info.has_failed();
193 }
194 void print_promotion_failure_size();
195
196 #if TASKQUEUE_STATS
197 TaskQueueStats & taskqueue_stats() const { return _work_queue->stats; }
198
199 size_t term_attempts() const { return _term_attempts; }
200 size_t overflow_refills() const { return _overflow_refills; }
201 size_t overflow_refill_objs() const { return _overflow_refill_objs; }
202
203 void note_term_attempt() { ++_term_attempts; }
204 void note_overflow_refill(size_t objs) {
205 ++_overflow_refills; _overflow_refill_objs += objs;
206 }
207
208 void reset_stats();
209 #endif // TASKQUEUE_STATS
210
211 void start_strong_roots() {
212 _start_strong_roots = os::elapsedTime();
|