author | tonyp |
Wed, 09 Mar 2016 09:45:47 +0100 | |
changeset 37045 | 41e3f98fa3dc |
parent 35901 | f5028c67e7cb |
child 37242 | 91e5f98fff6f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
29702
9ed339a5e096
8075809: Add missing includes of stack.inline.hpp
stefank
parents:
29208
diff
changeset
|
2 |
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/parallel/mutableSpace.hpp" |
27 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
|
28 |
#include "gc/parallel/psOldGen.hpp" |
|
29 |
#include "gc/parallel/psPromotionManager.inline.hpp" |
|
30 |
#include "gc/parallel/psScavenge.inline.hpp" |
|
31 |
#include "gc/shared/gcTrace.hpp" |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
32 |
#include "gc/shared/preservedMarks.inline.hpp" |
30764 | 33 |
#include "gc/shared/taskqueue.inline.hpp" |
35061 | 34 |
#include "logging/log.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
35 |
#include "memory/allocation.inline.hpp" |
7397 | 36 |
#include "memory/memRegion.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
37 |
#include "memory/padded.inline.hpp" |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
38 |
#include "oops/instanceKlass.inline.hpp" |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
39 |
#include "oops/instanceMirrorKlass.inline.hpp" |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
40 |
#include "oops/objArrayKlass.inline.hpp" |
7397 | 41 |
#include "oops/oop.inline.hpp" |
1 | 42 |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
43 |
PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
44 |
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; |
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
45 |
PreservedMarksSet* PSPromotionManager::_preserved_marks_set = NULL; |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
46 |
PSOldGen* PSPromotionManager::_old_gen = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
47 |
MutableSpace* PSPromotionManager::_young_space = NULL; |
1 | 48 |
|
49 |
void PSPromotionManager::initialize() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
50 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 51 |
|
52 |
_old_gen = heap->old_gen(); |
|
53 |
_young_space = heap->young_gen()->to_space(); |
|
54 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
55 |
const uint promotion_manager_num = ParallelGCThreads + 1; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
56 |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
57 |
// To prevent false sharing, we pad the PSPromotionManagers |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
58 |
// and make sure that the first instance starts at a cache line. |
1 | 59 |
assert(_manager_array == NULL, "Attempt to initialize twice"); |
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
60 |
_manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(promotion_manager_num); |
1 | 61 |
guarantee(_manager_array != NULL, "Could not initialize promotion manager"); |
62 |
||
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
63 |
_stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); |
18025 | 64 |
guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager"); |
1 | 65 |
|
66 |
// Create and register the PSPromotionManager(s) for the worker threads. |
|
67 |
for(uint i=0; i<ParallelGCThreads; i++) { |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
68 |
stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth()); |
1 | 69 |
} |
70 |
// The VMThread gets its own PSPromotionManager, which is not available |
|
71 |
// for work stealing. |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
72 |
|
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
73 |
assert(_preserved_marks_set == NULL, "Attempt to initialize twice"); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
74 |
_preserved_marks_set = new PreservedMarksSet(true /* in_c_heap */); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
75 |
guarantee(_preserved_marks_set != NULL, "Could not initialize preserved marks set"); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
76 |
_preserved_marks_set->init(promotion_manager_num); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
77 |
for (uint i = 0; i < promotion_manager_num; i += 1) { |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
78 |
_manager_array[i].register_preserved_marks(_preserved_marks_set->get(i)); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
79 |
} |
1 | 80 |
} |
81 |
||
29208
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
82 |
// Helper functions to get around the circular dependency between |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
83 |
// psScavenge.inline.hpp and psPromotionManager.inline.hpp. |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
84 |
bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) { |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
85 |
return PSScavenge::should_scavenge(p, check_to_space); |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
86 |
} |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
87 |
bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) { |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
88 |
return PSScavenge::should_scavenge(p, check_to_space); |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
89 |
} |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
90 |
|
31330
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
91 |
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(uint index) { |
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
92 |
assert(index < ParallelGCThreads, "index out of range"); |
1 | 93 |
assert(_manager_array != NULL, "Sanity"); |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
94 |
return &_manager_array[index]; |
1 | 95 |
} |
96 |
||
97 |
PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { |
|
98 |
assert(_manager_array != NULL, "Sanity"); |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
99 |
return &_manager_array[ParallelGCThreads]; |
1 | 100 |
} |
101 |
||
102 |
void PSPromotionManager::pre_scavenge() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
103 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 104 |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
105 |
_preserved_marks_set->assert_empty(); |
1 | 106 |
_young_space = heap->young_gen()->to_space(); |
107 |
||
108 |
for(uint i=0; i<ParallelGCThreads+1; i++) { |
|
109 |
manager_array(i)->reset(); |
|
110 |
} |
|
111 |
} |
|
112 |
||
18025 | 113 |
bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { |
114 |
bool promotion_failure_occurred = false; |
|
115 |
||
35061 | 116 |
TASKQUEUE_STATS_ONLY(print_taskqueue_stats()); |
5918 | 117 |
for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
1 | 118 |
PSPromotionManager* manager = manager_array(i); |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
119 |
assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
18025 | 120 |
if (manager->_promotion_failed_info.has_failed()) { |
121 |
gc_tracer.report_promotion_failed(manager->_promotion_failed_info); |
|
122 |
promotion_failure_occurred = true; |
|
123 |
} |
|
1 | 124 |
manager->flush_labs(); |
125 |
} |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
126 |
if (!promotion_failure_occurred) { |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
127 |
// If there was no promotion failure, the preserved mark stacks |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
128 |
// should be empty. |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
129 |
_preserved_marks_set->assert_empty(); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
130 |
} |
18025 | 131 |
return promotion_failure_occurred; |
1 | 132 |
} |
133 |
||
6067 | 134 |
#if TASKQUEUE_STATS |
1 | 135 |
void |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
136 |
PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { |
6067 | 137 |
#define FMT " " SIZE_FORMAT_W(10) |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
138 |
out->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, |
6067 | 139 |
_arrays_chunked, _array_chunks_processed); |
140 |
#undef FMT |
|
141 |
} |
|
142 |
||
143 |
static const char* const pm_stats_hdr[] = { |
|
144 |
" --------masked------- arrays array", |
|
145 |
"thr push steal chunked chunks", |
|
146 |
"--- ---------- ---------- ---------- ----------" |
|
147 |
}; |
|
148 |
||
149 |
void |
|
35061 | 150 |
PSPromotionManager::print_taskqueue_stats() { |
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35061
diff
changeset
|
151 |
if (!log_develop_is_enabled(Trace, gc, task, stats)) { |
35061 | 152 |
return; |
153 |
} |
|
154 |
LogHandle(gc, task, stats) log; |
|
155 |
ResourceMark rm; |
|
156 |
outputStream* out = log.trace_stream(); |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
157 |
out->print_cr("== GC Tasks Stats, GC %3d", |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
158 |
ParallelScavengeHeap::heap()->total_collections()); |
1 | 159 |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
160 |
TaskQueueStats totals; |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
161 |
out->print("thr "); TaskQueueStats::print_header(1, out); out->cr(); |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
162 |
out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); |
6067 | 163 |
for (uint i = 0; i < ParallelGCThreads + 1; ++i) { |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
164 |
TaskQueueStats& next = manager_array(i)->_claimed_stack_depth.stats; |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
165 |
out->print("%3d ", i); next.print(out); out->cr(); |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
166 |
totals += next; |
6067 | 167 |
} |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
168 |
out->print("tot "); totals.print(out); out->cr(); |
6067 | 169 |
|
170 |
const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
171 |
for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); |
6067 | 172 |
for (uint i = 0; i < ParallelGCThreads + 1; ++i) { |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
173 |
manager_array(i)->print_local_stats(out, i); |
1 | 174 |
} |
175 |
} |
|
176 |
||
6067 | 177 |
void |
178 |
PSPromotionManager::reset_stats() { |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
179 |
claimed_stack_depth()->stats.reset(); |
6067 | 180 |
_masked_pushes = _masked_steals = 0; |
181 |
_arrays_chunked = _array_chunks_processed = 0; |
|
182 |
} |
|
183 |
#endif // TASKQUEUE_STATS |
|
1 | 184 |
|
185 |
PSPromotionManager::PSPromotionManager() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
186 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 187 |
|
188 |
// We set the old lab's start array. |
|
189 |
_old_lab.set_start_array(old_gen()->start_array()); |
|
190 |
||
191 |
uint queue_size; |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
192 |
claimed_stack_depth()->initialize(); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
193 |
queue_size = claimed_stack_depth()->max_elems(); |
1 | 194 |
|
195 |
_totally_drain = (ParallelGCThreads == 1) || (GCDrainStackTargetSize == 0); |
|
196 |
if (_totally_drain) { |
|
197 |
_target_stack_size = 0; |
|
198 |
} else { |
|
199 |
// don't let the target stack size to be more than 1/4 of the entries |
|
200 |
_target_stack_size = (uint) MIN2((uint) GCDrainStackTargetSize, |
|
201 |
(uint) (queue_size / 4)); |
|
202 |
} |
|
203 |
||
204 |
_array_chunk_size = ParGCArrayScanChunk; |
|
205 |
// let's choose 1.5x the chunk size |
|
206 |
_min_array_size_for_chunking = 3 * _array_chunk_size / 2; |
|
207 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
208 |
_preserved_marks = NULL; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
209 |
|
1 | 210 |
reset(); |
211 |
} |
|
212 |
||
213 |
void PSPromotionManager::reset() { |
|
5918 | 214 |
assert(stacks_empty(), "reset of non-empty stack"); |
1 | 215 |
|
216 |
// We need to get an assert in here to make sure the labs are always flushed. |
|
217 |
||
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
218 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 219 |
|
220 |
// Do not prefill the LAB's, save heap wastage! |
|
221 |
HeapWord* lab_base = young_space()->top(); |
|
222 |
_young_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
223 |
_young_gen_is_full = false; |
|
224 |
||
225 |
lab_base = old_gen()->object_space()->top(); |
|
226 |
_old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
227 |
_old_gen_is_full = false; |
|
228 |
||
18025 | 229 |
_promotion_failed_info.reset(); |
230 |
||
6067 | 231 |
TASKQUEUE_STATS_ONLY(reset_stats()); |
1 | 232 |
} |
233 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
234 |
void PSPromotionManager::register_preserved_marks(PreservedMarks* preserved_marks) { |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
235 |
assert(_preserved_marks == NULL, "do not set it twice"); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
236 |
_preserved_marks = preserved_marks; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
237 |
} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
238 |
|
1 | 239 |
void PSPromotionManager::drain_stacks_depth(bool totally_drain) { |
240 |
totally_drain = totally_drain || _totally_drain; |
|
241 |
||
242 |
#ifdef ASSERT |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
243 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 244 |
MutableSpace* to_space = heap->young_gen()->to_space(); |
245 |
MutableSpace* old_space = heap->old_gen()->object_space(); |
|
246 |
#endif /* ASSERT */ |
|
247 |
||
5918 | 248 |
OopStarTaskQueue* const tq = claimed_stack_depth(); |
1 | 249 |
do { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
250 |
StarTask p; |
1 | 251 |
|
252 |
// Drain overflow stack first, so other threads can steal from |
|
253 |
// claimed stack while we work. |
|
5918 | 254 |
while (tq->pop_overflow(p)) { |
255 |
process_popped_location_depth(p); |
|
1 | 256 |
} |
257 |
||
258 |
if (totally_drain) { |
|
5918 | 259 |
while (tq->pop_local(p)) { |
1 | 260 |
process_popped_location_depth(p); |
261 |
} |
|
262 |
} else { |
|
5918 | 263 |
while (tq->size() > _target_stack_size && tq->pop_local(p)) { |
1 | 264 |
process_popped_location_depth(p); |
265 |
} |
|
266 |
} |
|
5918 | 267 |
} while (totally_drain && !tq->taskqueue_empty() || !tq->overflow_empty()); |
1 | 268 |
|
5918 | 269 |
assert(!totally_drain || tq->taskqueue_empty(), "Sanity"); |
270 |
assert(totally_drain || tq->size() <= _target_stack_size, "Sanity"); |
|
271 |
assert(tq->overflow_empty(), "Sanity"); |
|
1 | 272 |
} |
273 |
||
274 |
void PSPromotionManager::flush_labs() { |
|
5918 | 275 |
assert(stacks_empty(), "Attempt to flush lab with live stack"); |
1 | 276 |
|
277 |
// If either promotion lab fills up, we can flush the |
|
278 |
// lab but not refill it, so check first. |
|
279 |
assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity"); |
|
280 |
if (!_young_lab.is_flushed()) |
|
281 |
_young_lab.flush(); |
|
282 |
||
283 |
assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity"); |
|
284 |
if (!_old_lab.is_flushed()) |
|
285 |
_old_lab.flush(); |
|
286 |
||
287 |
// Let PSScavenge know if we overflowed |
|
288 |
if (_young_gen_is_full) { |
|
289 |
PSScavenge::set_survivor_overflow(true); |
|
290 |
} |
|
291 |
} |
|
292 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
293 |
template <class T> void PSPromotionManager::process_array_chunk_work( |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
294 |
oop obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
295 |
int start, int end) { |
8685
f8edcc58cca7
6820066: Check that -XX:ParGCArrayScanChunk has a value larger than zero.
jwilhelm
parents:
7397
diff
changeset
|
296 |
assert(start <= end, "invariant"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
297 |
T* const base = (T*)objArrayOop(obj)->base(); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
298 |
T* p = base + start; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
299 |
T* const chunk_end = base + end; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
300 |
while (p < chunk_end) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
301 |
if (PSScavenge::should_scavenge(p)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
302 |
claim_or_forward_depth(p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
303 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
304 |
++p; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
305 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
306 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
307 |
|
1 | 308 |
void PSPromotionManager::process_array_chunk(oop old) { |
309 |
assert(PSChunkLargeArrays, "invariant"); |
|
310 |
assert(old->is_objArray(), "invariant"); |
|
311 |
assert(old->is_forwarded(), "invariant"); |
|
312 |
||
6067 | 313 |
TASKQUEUE_STATS_ONLY(++_array_chunks_processed); |
1 | 314 |
|
315 |
oop const obj = old->forwardee(); |
|
316 |
||
317 |
int start; |
|
318 |
int const end = arrayOop(old)->length(); |
|
319 |
if (end > (int) _min_array_size_for_chunking) { |
|
320 |
// we'll chunk more |
|
321 |
start = end - _array_chunk_size; |
|
322 |
assert(start > 0, "invariant"); |
|
323 |
arrayOop(old)->set_length(start); |
|
324 |
push_depth(mask_chunked_array_oop(old)); |
|
6067 | 325 |
TASKQUEUE_STATS_ONLY(++_masked_pushes); |
1 | 326 |
} else { |
327 |
// this is the final chunk for this array |
|
328 |
start = 0; |
|
329 |
int const actual_length = arrayOop(obj)->length(); |
|
330 |
arrayOop(old)->set_length(actual_length); |
|
331 |
} |
|
332 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
333 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
334 |
process_array_chunk_work<narrowOop>(obj, start, end); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
335 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
336 |
process_array_chunk_work<oop>(obj, start, end); |
1 | 337 |
} |
338 |
} |
|
339 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
340 |
class PushContentsClosure : public ExtendedOopClosure { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
341 |
PSPromotionManager* _pm; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
342 |
public: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
343 |
PushContentsClosure(PSPromotionManager* pm) : _pm(pm) {} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
344 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
345 |
template <typename T> void do_oop_nv(T* p) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
346 |
if (PSScavenge::should_scavenge(p)) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
347 |
_pm->claim_or_forward_depth(p); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
348 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
349 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
350 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
351 |
virtual void do_oop(oop* p) { do_oop_nv(p); } |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
352 |
virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
353 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
354 |
// Don't use the oop verification code in the oop_oop_iterate framework. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
355 |
debug_only(virtual bool should_verify_oops() { return false; }) |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
356 |
}; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
357 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
358 |
void InstanceKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
359 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
360 |
oop_oop_iterate_oop_maps_reverse<true>(obj, &cl); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
361 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
362 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
363 |
void InstanceMirrorKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
364 |
// Note that we don't have to follow the mirror -> klass pointer, since all |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
365 |
// klasses that are dirty will be scavenged when we iterate over the |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
366 |
// ClassLoaderData objects. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
367 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
368 |
InstanceKlass::oop_ps_push_contents(obj, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
369 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
370 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
371 |
oop_oop_iterate_statics<true>(obj, &cl); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
372 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
373 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
374 |
void InstanceClassLoaderKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
375 |
InstanceKlass::oop_ps_push_contents(obj, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
376 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
377 |
// This is called by the young collector. It will already have taken care of |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
378 |
// all class loader data. So, we don't have to follow the class loader -> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
379 |
// class loader data link. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
380 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
381 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
382 |
template <class T> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
383 |
static void oop_ps_push_contents_specialized(oop obj, InstanceRefKlass *klass, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
384 |
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
385 |
if (PSScavenge::should_scavenge(referent_addr)) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
386 |
ReferenceProcessor* rp = PSScavenge::reference_processor(); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
387 |
if (rp->discover_reference(obj, klass->reference_type())) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
388 |
// reference already enqueued, referent and next will be traversed later |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
389 |
klass->InstanceKlass::oop_ps_push_contents(obj, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
390 |
return; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
391 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
392 |
// treat referent as normal oop |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
393 |
pm->claim_or_forward_depth(referent_addr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
394 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
395 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
396 |
// Treat discovered as normal oop, if ref is not "active", |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
397 |
// i.e. if next is non-NULL. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
398 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
30558
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
399 |
T next_oop = oopDesc::load_heap_oop(next_addr); |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
400 |
if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active" |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
401 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
35061 | 402 |
log_develop_trace(gc, ref)(" Process discovered as normal " PTR_FORMAT, p2i(discovered_addr)); |
30558
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
403 |
if (PSScavenge::should_scavenge(discovered_addr)) { |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
404 |
pm->claim_or_forward_depth(discovered_addr); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
405 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
406 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
407 |
// Treat next as normal oop; next is a link in the reference queue. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
408 |
if (PSScavenge::should_scavenge(next_addr)) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
409 |
pm->claim_or_forward_depth(next_addr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
410 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
411 |
klass->InstanceKlass::oop_ps_push_contents(obj, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
412 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
413 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
414 |
void InstanceRefKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
415 |
if (UseCompressedOops) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
416 |
oop_ps_push_contents_specialized<narrowOop>(obj, this, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
417 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
418 |
oop_ps_push_contents_specialized<oop>(obj, this, pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
419 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
420 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
421 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
422 |
void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
423 |
assert(obj->is_objArray(), "obj must be obj array"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
424 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
425 |
oop_oop_iterate_elements<true>(objArrayOop(obj), &cl); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
426 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
427 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
428 |
void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
429 |
assert(obj->is_typeArray(),"must be a type array"); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
430 |
ShouldNotReachHere(); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
431 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
432 |
|
1 | 433 |
oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) { |
434 |
assert(_old_gen_is_full || PromotionFailureALot, "Sanity"); |
|
435 |
||
436 |
// Attempt to CAS in the header. |
|
437 |
// This tests if the header is still the same as when |
|
438 |
// this started. If it is the same (i.e., no forwarding |
|
439 |
// pointer has been installed), then this thread owns |
|
440 |
// it. |
|
441 |
if (obj->cas_forward_to(obj, obj_mark)) { |
|
442 |
// We won any races, we "own" this object. |
|
443 |
assert(obj == obj->forwardee(), "Sanity"); |
|
444 |
||
18025 | 445 |
_promotion_failed_info.register_copy_failure(obj->size()); |
446 |
||
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
29702
diff
changeset
|
447 |
push_contents(obj); |
1 | 448 |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
449 |
_preserved_marks->push_if_necessary(obj, obj_mark); |
1 | 450 |
} else { |
451 |
// We lost, someone else "owns" this object |
|
452 |
guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed."); |
|
453 |
||
454 |
// No unallocation to worry about. |
|
455 |
obj = obj->forwardee(); |
|
456 |
} |
|
457 |
||
35061 | 458 |
log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size()); |
1 | 459 |
|
460 |
return obj; |
|
461 |
} |