equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2013, 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. |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
26 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
27 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
27 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
28 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
28 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
29 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
29 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
|
30 #include "gc_implementation/shared/gcTrace.hpp" |
30 #include "gc_implementation/shared/mutableSpace.hpp" |
31 #include "gc_implementation/shared/mutableSpace.hpp" |
31 #include "memory/memRegion.hpp" |
32 #include "memory/memRegion.hpp" |
32 #include "oops/oop.inline.hpp" |
33 #include "oops/oop.inline.hpp" |
33 #include "oops/oop.psgc.inline.hpp" |
34 #include "oops/oop.psgc.inline.hpp" |
34 |
35 |
47 assert(_manager_array == NULL, "Attempt to initialize twice"); |
48 assert(_manager_array == NULL, "Attempt to initialize twice"); |
48 _manager_array = NEW_C_HEAP_ARRAY(PSPromotionManager*, ParallelGCThreads+1, mtGC); |
49 _manager_array = NEW_C_HEAP_ARRAY(PSPromotionManager*, ParallelGCThreads+1, mtGC); |
49 guarantee(_manager_array != NULL, "Could not initialize promotion manager"); |
50 guarantee(_manager_array != NULL, "Could not initialize promotion manager"); |
50 |
51 |
51 _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); |
52 _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); |
52 guarantee(_stack_array_depth != NULL, "Cound not initialize promotion manager"); |
53 guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager"); |
53 |
54 |
54 // Create and register the PSPromotionManager(s) for the worker threads. |
55 // Create and register the PSPromotionManager(s) for the worker threads. |
55 for(uint i=0; i<ParallelGCThreads; i++) { |
56 for(uint i=0; i<ParallelGCThreads; i++) { |
56 _manager_array[i] = new PSPromotionManager(); |
57 _manager_array[i] = new PSPromotionManager(); |
57 guarantee(_manager_array[i] != NULL, "Could not create PSPromotionManager"); |
58 guarantee(_manager_array[i] != NULL, "Could not create PSPromotionManager"); |
84 for(uint i=0; i<ParallelGCThreads+1; i++) { |
85 for(uint i=0; i<ParallelGCThreads+1; i++) { |
85 manager_array(i)->reset(); |
86 manager_array(i)->reset(); |
86 } |
87 } |
87 } |
88 } |
88 |
89 |
89 void PSPromotionManager::post_scavenge() { |
90 bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { |
|
91 bool promotion_failure_occurred = false; |
|
92 |
90 TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats()); |
93 TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats()); |
91 for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
94 for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
92 PSPromotionManager* manager = manager_array(i); |
95 PSPromotionManager* manager = manager_array(i); |
93 assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
96 assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
|
97 if (manager->_promotion_failed_info.has_failed()) { |
|
98 gc_tracer.report_promotion_failed(manager->_promotion_failed_info); |
|
99 promotion_failure_occurred = true; |
|
100 } |
94 manager->flush_labs(); |
101 manager->flush_labs(); |
95 } |
102 } |
|
103 return promotion_failure_occurred; |
96 } |
104 } |
97 |
105 |
98 #if TASKQUEUE_STATS |
106 #if TASKQUEUE_STATS |
99 void |
107 void |
100 PSPromotionManager::print_taskqueue_stats(uint i) const { |
108 PSPromotionManager::print_taskqueue_stats(uint i) const { |
184 _young_gen_is_full = false; |
192 _young_gen_is_full = false; |
185 |
193 |
186 lab_base = old_gen()->object_space()->top(); |
194 lab_base = old_gen()->object_space()->top(); |
187 _old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
195 _old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
188 _old_gen_is_full = false; |
196 _old_gen_is_full = false; |
|
197 |
|
198 _promotion_failed_info.reset(); |
189 |
199 |
190 TASKQUEUE_STATS_ONLY(reset_stats()); |
200 TASKQUEUE_STATS_ONLY(reset_stats()); |
191 } |
201 } |
192 |
202 |
193 |
203 |
303 // it. |
313 // it. |
304 if (obj->cas_forward_to(obj, obj_mark)) { |
314 if (obj->cas_forward_to(obj, obj_mark)) { |
305 // We won any races, we "own" this object. |
315 // We won any races, we "own" this object. |
306 assert(obj == obj->forwardee(), "Sanity"); |
316 assert(obj == obj->forwardee(), "Sanity"); |
307 |
317 |
|
318 _promotion_failed_info.register_copy_failure(obj->size()); |
|
319 |
308 obj->push_contents(this); |
320 obj->push_contents(this); |
309 |
321 |
310 // Save the mark if needed |
322 // Save the mark if needed |
311 PSScavenge::oop_promotion_failed(obj, obj_mark); |
323 PSScavenge::oop_promotion_failed(obj, obj_mark); |
312 } else { |
324 } else { |