author | pliden |
Mon, 13 Apr 2015 15:47:48 +0200 | |
changeset 30173 | 13cf7580b000 |
parent 30150 | d9c940aa42ef |
child 30558 | baec90a2699f |
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" |
26 |
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
|
27 |
#include "gc_implementation/parallelScavenge/psOldGen.hpp" |
|
28 |
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
|
29 |
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
|
18025 | 30 |
#include "gc_implementation/shared/gcTrace.hpp" |
7397 | 31 |
#include "gc_implementation/shared/mutableSpace.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
32 |
#include "memory/allocation.inline.hpp" |
7397 | 33 |
#include "memory/memRegion.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
34 |
#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
|
35 |
#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
|
36 |
#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
|
37 |
#include "oops/objArrayKlass.inline.hpp" |
7397 | 38 |
#include "oops/oop.inline.hpp" |
29702
9ed339a5e096
8075809: Add missing includes of stack.inline.hpp
stefank
parents:
29208
diff
changeset
|
39 |
#include "utilities/stack.inline.hpp" |
1 | 40 |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
41 |
PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
42 |
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
43 |
PSOldGen* PSPromotionManager::_old_gen = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
44 |
MutableSpace* PSPromotionManager::_young_space = NULL; |
1 | 45 |
|
46 |
void PSPromotionManager::initialize() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
47 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 48 |
|
49 |
_old_gen = heap->old_gen(); |
|
50 |
_young_space = heap->young_gen()->to_space(); |
|
51 |
||
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
52 |
// To prevent false sharing, we pad the PSPromotionManagers |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
53 |
// and make sure that the first instance starts at a cache line. |
1 | 54 |
assert(_manager_array == NULL, "Attempt to initialize twice"); |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
55 |
_manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(ParallelGCThreads + 1); |
1 | 56 |
guarantee(_manager_array != NULL, "Could not initialize promotion manager"); |
57 |
||
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
58 |
_stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); |
18025 | 59 |
guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager"); |
1 | 60 |
|
61 |
// Create and register the PSPromotionManager(s) for the worker threads. |
|
62 |
for(uint i=0; i<ParallelGCThreads; i++) { |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
63 |
stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth()); |
1 | 64 |
} |
65 |
// The VMThread gets its own PSPromotionManager, which is not available |
|
66 |
// for work stealing. |
|
67 |
} |
|
68 |
||
29208
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
69 |
// 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
|
70 |
// 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
|
71 |
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
|
72 |
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
|
73 |
} |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
74 |
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
|
75 |
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
|
76 |
} |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
77 |
|
1 | 78 |
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) { |
79 |
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); |
|
80 |
assert(_manager_array != NULL, "Sanity"); |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
81 |
return &_manager_array[index]; |
1 | 82 |
} |
83 |
||
84 |
PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { |
|
85 |
assert(_manager_array != NULL, "Sanity"); |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
86 |
return &_manager_array[ParallelGCThreads]; |
1 | 87 |
} |
88 |
||
89 |
void PSPromotionManager::pre_scavenge() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
90 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 91 |
|
92 |
_young_space = heap->young_gen()->to_space(); |
|
93 |
||
94 |
for(uint i=0; i<ParallelGCThreads+1; i++) { |
|
95 |
manager_array(i)->reset(); |
|
96 |
} |
|
97 |
} |
|
98 |
||
18025 | 99 |
bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { |
100 |
bool promotion_failure_occurred = false; |
|
101 |
||
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
102 |
TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) print_taskqueue_stats()); |
5918 | 103 |
for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
1 | 104 |
PSPromotionManager* manager = manager_array(i); |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
105 |
assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
18025 | 106 |
if (manager->_promotion_failed_info.has_failed()) { |
107 |
gc_tracer.report_promotion_failed(manager->_promotion_failed_info); |
|
108 |
promotion_failure_occurred = true; |
|
109 |
} |
|
1 | 110 |
manager->flush_labs(); |
111 |
} |
|
18025 | 112 |
return promotion_failure_occurred; |
1 | 113 |
} |
114 |
||
6067 | 115 |
#if TASKQUEUE_STATS |
1 | 116 |
void |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
117 |
PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { |
6067 | 118 |
#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
|
119 |
out->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, |
6067 | 120 |
_arrays_chunked, _array_chunks_processed); |
121 |
#undef FMT |
|
122 |
} |
|
123 |
||
124 |
static const char* const pm_stats_hdr[] = { |
|
125 |
" --------masked------- arrays array", |
|
126 |
"thr push steal chunked chunks", |
|
127 |
"--- ---------- ---------- ---------- ----------" |
|
128 |
}; |
|
129 |
||
130 |
void |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
131 |
PSPromotionManager::print_taskqueue_stats(outputStream* const out) { |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
132 |
out->print_cr("== GC Tasks Stats, GC %3d", |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
133 |
ParallelScavengeHeap::heap()->total_collections()); |
1 | 134 |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
135 |
TaskQueueStats totals; |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
136 |
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
|
137 |
out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); |
6067 | 138 |
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
|
139 |
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
|
140 |
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
|
141 |
totals += next; |
6067 | 142 |
} |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
143 |
out->print("tot "); totals.print(out); out->cr(); |
6067 | 144 |
|
145 |
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
|
146 |
for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); |
6067 | 147 |
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
|
148 |
manager_array(i)->print_local_stats(out, i); |
1 | 149 |
} |
150 |
} |
|
151 |
||
6067 | 152 |
void |
153 |
PSPromotionManager::reset_stats() { |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
154 |
claimed_stack_depth()->stats.reset(); |
6067 | 155 |
_masked_pushes = _masked_steals = 0; |
156 |
_arrays_chunked = _array_chunks_processed = 0; |
|
157 |
} |
|
158 |
#endif // TASKQUEUE_STATS |
|
1 | 159 |
|
160 |
PSPromotionManager::PSPromotionManager() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
161 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 162 |
|
163 |
// We set the old lab's start array. |
|
164 |
_old_lab.set_start_array(old_gen()->start_array()); |
|
165 |
||
166 |
uint queue_size; |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
167 |
claimed_stack_depth()->initialize(); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
168 |
queue_size = claimed_stack_depth()->max_elems(); |
1 | 169 |
|
170 |
_totally_drain = (ParallelGCThreads == 1) || (GCDrainStackTargetSize == 0); |
|
171 |
if (_totally_drain) { |
|
172 |
_target_stack_size = 0; |
|
173 |
} else { |
|
174 |
// don't let the target stack size to be more than 1/4 of the entries |
|
175 |
_target_stack_size = (uint) MIN2((uint) GCDrainStackTargetSize, |
|
176 |
(uint) (queue_size / 4)); |
|
177 |
} |
|
178 |
||
179 |
_array_chunk_size = ParGCArrayScanChunk; |
|
180 |
// let's choose 1.5x the chunk size |
|
181 |
_min_array_size_for_chunking = 3 * _array_chunk_size / 2; |
|
182 |
||
183 |
reset(); |
|
184 |
} |
|
185 |
||
186 |
void PSPromotionManager::reset() { |
|
5918 | 187 |
assert(stacks_empty(), "reset of non-empty stack"); |
1 | 188 |
|
189 |
// We need to get an assert in here to make sure the labs are always flushed. |
|
190 |
||
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
191 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 192 |
|
193 |
// Do not prefill the LAB's, save heap wastage! |
|
194 |
HeapWord* lab_base = young_space()->top(); |
|
195 |
_young_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
196 |
_young_gen_is_full = false; |
|
197 |
||
198 |
lab_base = old_gen()->object_space()->top(); |
|
199 |
_old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
200 |
_old_gen_is_full = false; |
|
201 |
||
18025 | 202 |
_promotion_failed_info.reset(); |
203 |
||
6067 | 204 |
TASKQUEUE_STATS_ONLY(reset_stats()); |
1 | 205 |
} |
206 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
207 |
|
1 | 208 |
void PSPromotionManager::drain_stacks_depth(bool totally_drain) { |
209 |
totally_drain = totally_drain || _totally_drain; |
|
210 |
||
211 |
#ifdef ASSERT |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
212 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 213 |
MutableSpace* to_space = heap->young_gen()->to_space(); |
214 |
MutableSpace* old_space = heap->old_gen()->object_space(); |
|
215 |
#endif /* ASSERT */ |
|
216 |
||
5918 | 217 |
OopStarTaskQueue* const tq = claimed_stack_depth(); |
1 | 218 |
do { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
219 |
StarTask p; |
1 | 220 |
|
221 |
// Drain overflow stack first, so other threads can steal from |
|
222 |
// claimed stack while we work. |
|
5918 | 223 |
while (tq->pop_overflow(p)) { |
224 |
process_popped_location_depth(p); |
|
1 | 225 |
} |
226 |
||
227 |
if (totally_drain) { |
|
5918 | 228 |
while (tq->pop_local(p)) { |
1 | 229 |
process_popped_location_depth(p); |
230 |
} |
|
231 |
} else { |
|
5918 | 232 |
while (tq->size() > _target_stack_size && tq->pop_local(p)) { |
1 | 233 |
process_popped_location_depth(p); |
234 |
} |
|
235 |
} |
|
5918 | 236 |
} while (totally_drain && !tq->taskqueue_empty() || !tq->overflow_empty()); |
1 | 237 |
|
5918 | 238 |
assert(!totally_drain || tq->taskqueue_empty(), "Sanity"); |
239 |
assert(totally_drain || tq->size() <= _target_stack_size, "Sanity"); |
|
240 |
assert(tq->overflow_empty(), "Sanity"); |
|
1 | 241 |
} |
242 |
||
243 |
void PSPromotionManager::flush_labs() { |
|
5918 | 244 |
assert(stacks_empty(), "Attempt to flush lab with live stack"); |
1 | 245 |
|
246 |
// If either promotion lab fills up, we can flush the |
|
247 |
// lab but not refill it, so check first. |
|
248 |
assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity"); |
|
249 |
if (!_young_lab.is_flushed()) |
|
250 |
_young_lab.flush(); |
|
251 |
||
252 |
assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity"); |
|
253 |
if (!_old_lab.is_flushed()) |
|
254 |
_old_lab.flush(); |
|
255 |
||
256 |
// Let PSScavenge know if we overflowed |
|
257 |
if (_young_gen_is_full) { |
|
258 |
PSScavenge::set_survivor_overflow(true); |
|
259 |
} |
|
260 |
} |
|
261 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
262 |
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
|
263 |
oop obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
264 |
int start, int end) { |
8685
f8edcc58cca7
6820066: Check that -XX:ParGCArrayScanChunk has a value larger than zero.
jwilhelm
parents:
7397
diff
changeset
|
265 |
assert(start <= end, "invariant"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
266 |
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
|
267 |
T* p = base + start; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
268 |
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
|
269 |
while (p < chunk_end) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
270 |
if (PSScavenge::should_scavenge(p)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
271 |
claim_or_forward_depth(p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
272 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
273 |
++p; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
274 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
275 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
276 |
|
1 | 277 |
void PSPromotionManager::process_array_chunk(oop old) { |
278 |
assert(PSChunkLargeArrays, "invariant"); |
|
279 |
assert(old->is_objArray(), "invariant"); |
|
280 |
assert(old->is_forwarded(), "invariant"); |
|
281 |
||
6067 | 282 |
TASKQUEUE_STATS_ONLY(++_array_chunks_processed); |
1 | 283 |
|
284 |
oop const obj = old->forwardee(); |
|
285 |
||
286 |
int start; |
|
287 |
int const end = arrayOop(old)->length(); |
|
288 |
if (end > (int) _min_array_size_for_chunking) { |
|
289 |
// we'll chunk more |
|
290 |
start = end - _array_chunk_size; |
|
291 |
assert(start > 0, "invariant"); |
|
292 |
arrayOop(old)->set_length(start); |
|
293 |
push_depth(mask_chunked_array_oop(old)); |
|
6067 | 294 |
TASKQUEUE_STATS_ONLY(++_masked_pushes); |
1 | 295 |
} else { |
296 |
// this is the final chunk for this array |
|
297 |
start = 0; |
|
298 |
int const actual_length = arrayOop(obj)->length(); |
|
299 |
arrayOop(old)->set_length(actual_length); |
|
300 |
} |
|
301 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
302 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
303 |
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
|
304 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
305 |
process_array_chunk_work<oop>(obj, start, end); |
1 | 306 |
} |
307 |
} |
|
308 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
309 |
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
|
310 |
PSPromotionManager* _pm; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
311 |
public: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
312 |
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
|
313 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
314 |
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
|
315 |
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
|
316 |
_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
|
317 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
318 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
319 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
320 |
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
|
321 |
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
|
322 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
323 |
// 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
|
324 |
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
|
325 |
}; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
326 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
327 |
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
|
328 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
329 |
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
|
330 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
331 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
332 |
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
|
333 |
// 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
|
334 |
// 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
|
335 |
// ClassLoaderData objects. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
336 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
337 |
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
|
338 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
339 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
340 |
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
|
341 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
342 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
346 |
// 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
|
347 |
// 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
|
348 |
// 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
|
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 |
template <class T> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
// 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
|
358 |
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
|
359 |
return; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
360 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
361 |
// 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
|
362 |
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
|
363 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
364 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
365 |
// 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
|
366 |
// 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
|
367 |
T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
368 |
if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
369 |
T next_oop = oopDesc::load_heap_oop(next_addr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
370 |
if (!oopDesc::is_null(next_oop)) { // i.e. 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
|
371 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
372 |
debug_only( |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
373 |
if(TraceReferenceGC && PrintGCDetails) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
374 |
gclog_or_tty->print_cr(" Process discovered as normal " |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
375 |
PTR_FORMAT, p2i(discovered_addr)); |
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 |
) |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
378 |
if (PSScavenge::should_scavenge(discovered_addr)) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
379 |
pm->claim_or_forward_depth(discovered_addr); |
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 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
383 |
#ifdef ASSERT |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
384 |
// In the case of older JDKs which do not use the discovered |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
385 |
// field for the pending list, an inactive ref (next != NULL) |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
386 |
// must always have a NULL discovered field. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
387 |
oop next = oopDesc::load_decode_heap_oop(next_addr); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
388 |
oop discovered = java_lang_ref_Reference::discovered(obj); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
389 |
assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
390 |
err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
391 |
p2i(obj))); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
392 |
#endif |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
393 |
} |
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 |
// 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
|
396 |
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
|
397 |
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
|
398 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
399 |
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
|
400 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
401 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
402 |
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
|
403 |
if (UseCompressedOops) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
404 |
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
|
405 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
406 |
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
|
407 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
408 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
409 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
410 |
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
|
411 |
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
|
412 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
413 |
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
|
414 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
415 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
416 |
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
|
417 |
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
|
418 |
ShouldNotReachHere(); |
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 |
|
1 | 421 |
oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) { |
422 |
assert(_old_gen_is_full || PromotionFailureALot, "Sanity"); |
|
423 |
||
424 |
// Attempt to CAS in the header. |
|
425 |
// This tests if the header is still the same as when |
|
426 |
// this started. If it is the same (i.e., no forwarding |
|
427 |
// pointer has been installed), then this thread owns |
|
428 |
// it. |
|
429 |
if (obj->cas_forward_to(obj, obj_mark)) { |
|
430 |
// We won any races, we "own" this object. |
|
431 |
assert(obj == obj->forwardee(), "Sanity"); |
|
432 |
||
18025 | 433 |
_promotion_failed_info.register_copy_failure(obj->size()); |
434 |
||
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
29702
diff
changeset
|
435 |
push_contents(obj); |
1 | 436 |
|
437 |
// Save the mark if needed |
|
438 |
PSScavenge::oop_promotion_failed(obj, obj_mark); |
|
439 |
} else { |
|
440 |
// We lost, someone else "owns" this object |
|
441 |
guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed."); |
|
442 |
||
443 |
// No unallocation to worry about. |
|
444 |
obj = obj->forwardee(); |
|
445 |
} |
|
446 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
447 |
#ifndef PRODUCT |
1 | 448 |
if (TraceScavenge) { |
24092
e274d864545a
8039743: Use correct format specifier to print size_t values and pointers in the GC code
stefank
parents:
20282
diff
changeset
|
449 |
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " (%d)}", |
1 | 450 |
"promotion-failure", |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
451 |
obj->klass()->internal_name(), |
29798
451c73fdf690
8076071: parallelScavenge: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
29792
diff
changeset
|
452 |
p2i(obj), obj->size()); |
1 | 453 |
|
454 |
} |
|
455 |
#endif |
|
456 |
||
457 |
return obj; |
|
458 |
} |