author | stuefe |
Fri, 21 Jul 2017 09:50:12 +0200 | |
changeset 46701 | f559541c0daa |
parent 46630 | 75aa3e39d02c |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
39228
diff
changeset
|
2 |
* Copyright (c) 2002, 2017, 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" |
39228
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
26 |
#include "gc/parallel/gcTaskManager.hpp" |
30764 | 27 |
#include "gc/parallel/mutableSpace.hpp" |
28 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
|
29 |
#include "gc/parallel/psOldGen.hpp" |
|
30 |
#include "gc/parallel/psPromotionManager.inline.hpp" |
|
31 |
#include "gc/parallel/psScavenge.inline.hpp" |
|
32 |
#include "gc/shared/gcTrace.hpp" |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
33 |
#include "gc/shared/preservedMarks.inline.hpp" |
30764 | 34 |
#include "gc/shared/taskqueue.inline.hpp" |
35061 | 35 |
#include "logging/log.hpp" |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
36 |
#include "logging/logStream.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
37 |
#include "memory/allocation.inline.hpp" |
7397 | 38 |
#include "memory/memRegion.hpp" |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
39 |
#include "memory/padded.inline.hpp" |
37248 | 40 |
#include "memory/resourceArea.hpp" |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
41 |
#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
|
42 |
#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
|
43 |
#include "oops/objArrayKlass.inline.hpp" |
7397 | 44 |
#include "oops/oop.inline.hpp" |
1 | 45 |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
46 |
PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
47 |
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; |
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
48 |
PreservedMarksSet* PSPromotionManager::_preserved_marks_set = NULL; |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
49 |
PSOldGen* PSPromotionManager::_old_gen = NULL; |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
50 |
MutableSpace* PSPromotionManager::_young_space = NULL; |
1 | 51 |
|
52 |
void PSPromotionManager::initialize() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
53 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 54 |
|
55 |
_old_gen = heap->old_gen(); |
|
56 |
_young_space = heap->young_gen()->to_space(); |
|
57 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
58 |
const uint promotion_manager_num = ParallelGCThreads + 1; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
59 |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
60 |
// To prevent false sharing, we pad the PSPromotionManagers |
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
61 |
// and make sure that the first instance starts at a cache line. |
1 | 62 |
assert(_manager_array == NULL, "Attempt to initialize twice"); |
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
63 |
_manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(promotion_manager_num); |
1 | 64 |
guarantee(_manager_array != NULL, "Could not initialize promotion manager"); |
65 |
||
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
66 |
_stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); |
18025 | 67 |
guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager"); |
1 | 68 |
|
69 |
// Create and register the PSPromotionManager(s) for the worker threads. |
|
70 |
for(uint i=0; i<ParallelGCThreads; i++) { |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
71 |
stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth()); |
1 | 72 |
} |
73 |
// The VMThread gets its own PSPromotionManager, which is not available |
|
74 |
// for work stealing. |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
75 |
|
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
76 |
assert(_preserved_marks_set == NULL, "Attempt to initialize twice"); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
77 |
_preserved_marks_set = new PreservedMarksSet(true /* in_c_heap */); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
78 |
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
|
79 |
_preserved_marks_set->init(promotion_manager_num); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
80 |
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
|
81 |
_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
|
82 |
} |
1 | 83 |
} |
84 |
||
29208
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
85 |
// 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
|
86 |
// 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
|
87 |
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
|
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 |
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
|
91 |
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
|
92 |
} |
b570d043f295
8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
stefank
parents:
27154
diff
changeset
|
93 |
|
31330
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
94 |
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(uint index) { |
77061bb01b18
8081382: Make flags ParallelGCThreads and ConcGCThreads of type uint
david
parents:
30764
diff
changeset
|
95 |
assert(index < ParallelGCThreads, "index out of range"); |
1 | 96 |
assert(_manager_array != NULL, "Sanity"); |
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
97 |
return &_manager_array[index]; |
1 | 98 |
} |
99 |
||
100 |
PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { |
|
101 |
assert(_manager_array != NULL, "Sanity"); |
|
19285
0a3b3f115402
8022880: False sharing between PSPromotionManager instances
stefank
parents:
18025
diff
changeset
|
102 |
return &_manager_array[ParallelGCThreads]; |
1 | 103 |
} |
104 |
||
105 |
void PSPromotionManager::pre_scavenge() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
106 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 107 |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
108 |
_preserved_marks_set->assert_empty(); |
1 | 109 |
_young_space = heap->young_gen()->to_space(); |
110 |
||
111 |
for(uint i=0; i<ParallelGCThreads+1; i++) { |
|
112 |
manager_array(i)->reset(); |
|
113 |
} |
|
114 |
} |
|
115 |
||
18025 | 116 |
bool PSPromotionManager::post_scavenge(YoungGCTracer& gc_tracer) { |
117 |
bool promotion_failure_occurred = false; |
|
118 |
||
35061 | 119 |
TASKQUEUE_STATS_ONLY(print_taskqueue_stats()); |
5918 | 120 |
for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
1 | 121 |
PSPromotionManager* manager = manager_array(i); |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
122 |
assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
18025 | 123 |
if (manager->_promotion_failed_info.has_failed()) { |
124 |
gc_tracer.report_promotion_failed(manager->_promotion_failed_info); |
|
125 |
promotion_failure_occurred = true; |
|
126 |
} |
|
1 | 127 |
manager->flush_labs(); |
128 |
} |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
129 |
if (!promotion_failure_occurred) { |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
130 |
// 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
|
131 |
// should be empty. |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
132 |
_preserved_marks_set->assert_empty(); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
133 |
} |
18025 | 134 |
return promotion_failure_occurred; |
1 | 135 |
} |
136 |
||
6067 | 137 |
#if TASKQUEUE_STATS |
1 | 138 |
void |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
139 |
PSPromotionManager::print_local_stats(outputStream* const out, uint i) const { |
6067 | 140 |
#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
|
141 |
out->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, |
6067 | 142 |
_arrays_chunked, _array_chunks_processed); |
143 |
#undef FMT |
|
144 |
} |
|
145 |
||
146 |
static const char* const pm_stats_hdr[] = { |
|
147 |
" --------masked------- arrays array", |
|
148 |
"thr push steal chunked chunks", |
|
149 |
"--- ---------- ---------- ---------- ----------" |
|
150 |
}; |
|
151 |
||
152 |
void |
|
35061 | 153 |
PSPromotionManager::print_taskqueue_stats() { |
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35061
diff
changeset
|
154 |
if (!log_develop_is_enabled(Trace, gc, task, stats)) { |
35061 | 155 |
return; |
156 |
} |
|
37242 | 157 |
Log(gc, task, stats) log; |
35061 | 158 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
159 |
LogStream ls(log.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
160 |
outputStream* out = &ls; |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
161 |
out->print_cr("== GC Tasks Stats, GC %3d", |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
162 |
ParallelScavengeHeap::heap()->total_collections()); |
1 | 163 |
|
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
164 |
TaskQueueStats totals; |
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
165 |
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
|
166 |
out->print("--- "); TaskQueueStats::print_header(2, out); out->cr(); |
6067 | 167 |
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
|
168 |
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
|
169 |
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
|
170 |
totals += next; |
6067 | 171 |
} |
27154
ccf8883e01be
8027428: Different conditions for printing taskqueue statistics for parallel gc, parNew and G1
jwilhelm
parents:
24424
diff
changeset
|
172 |
out->print("tot "); totals.print(out); out->cr(); |
6067 | 173 |
|
174 |
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
|
175 |
for (uint i = 0; i < hlines; ++i) out->print_cr("%s", pm_stats_hdr[i]); |
6067 | 176 |
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
|
177 |
manager_array(i)->print_local_stats(out, i); |
1 | 178 |
} |
179 |
} |
|
180 |
||
6067 | 181 |
void |
182 |
PSPromotionManager::reset_stats() { |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
183 |
claimed_stack_depth()->stats.reset(); |
6067 | 184 |
_masked_pushes = _masked_steals = 0; |
185 |
_arrays_chunked = _array_chunks_processed = 0; |
|
186 |
} |
|
187 |
#endif // TASKQUEUE_STATS |
|
1 | 188 |
|
189 |
PSPromotionManager::PSPromotionManager() { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
190 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 191 |
|
192 |
// We set the old lab's start array. |
|
193 |
_old_lab.set_start_array(old_gen()->start_array()); |
|
194 |
||
195 |
uint queue_size; |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
196 |
claimed_stack_depth()->initialize(); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
197 |
queue_size = claimed_stack_depth()->max_elems(); |
1 | 198 |
|
199 |
_totally_drain = (ParallelGCThreads == 1) || (GCDrainStackTargetSize == 0); |
|
200 |
if (_totally_drain) { |
|
201 |
_target_stack_size = 0; |
|
202 |
} else { |
|
203 |
// don't let the target stack size to be more than 1/4 of the entries |
|
204 |
_target_stack_size = (uint) MIN2((uint) GCDrainStackTargetSize, |
|
205 |
(uint) (queue_size / 4)); |
|
206 |
} |
|
207 |
||
208 |
_array_chunk_size = ParGCArrayScanChunk; |
|
209 |
// let's choose 1.5x the chunk size |
|
210 |
_min_array_size_for_chunking = 3 * _array_chunk_size / 2; |
|
211 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
212 |
_preserved_marks = NULL; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
213 |
|
1 | 214 |
reset(); |
215 |
} |
|
216 |
||
217 |
void PSPromotionManager::reset() { |
|
5918 | 218 |
assert(stacks_empty(), "reset of non-empty stack"); |
1 | 219 |
|
220 |
// We need to get an assert in here to make sure the labs are always flushed. |
|
221 |
||
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
222 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 223 |
|
224 |
// Do not prefill the LAB's, save heap wastage! |
|
225 |
HeapWord* lab_base = young_space()->top(); |
|
226 |
_young_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
227 |
_young_gen_is_full = false; |
|
228 |
||
229 |
lab_base = old_gen()->object_space()->top(); |
|
230 |
_old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
|
231 |
_old_gen_is_full = false; |
|
232 |
||
18025 | 233 |
_promotion_failed_info.reset(); |
234 |
||
6067 | 235 |
TASKQUEUE_STATS_ONLY(reset_stats()); |
1 | 236 |
} |
237 |
||
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
238 |
void PSPromotionManager::register_preserved_marks(PreservedMarks* preserved_marks) { |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
239 |
assert(_preserved_marks == NULL, "do not set it twice"); |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
240 |
_preserved_marks = preserved_marks; |
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
241 |
} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
242 |
|
39228
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
243 |
class ParRestoreGCTask : public GCTask { |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
244 |
private: |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
245 |
const uint _id; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
246 |
PreservedMarksSet* const _preserved_marks_set; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
247 |
volatile size_t* const _total_size_addr; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
248 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
249 |
public: |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
250 |
virtual char* name() { |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
251 |
return (char*) "preserved mark restoration task"; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
252 |
} |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
253 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
254 |
virtual void do_it(GCTaskManager* manager, uint which){ |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
255 |
_preserved_marks_set->get(_id)->restore_and_increment(_total_size_addr); |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
256 |
} |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
257 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
258 |
ParRestoreGCTask(uint id, |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
259 |
PreservedMarksSet* preserved_marks_set, |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
260 |
volatile size_t* total_size_addr) |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
261 |
: _id(id), |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
262 |
_preserved_marks_set(preserved_marks_set), |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
263 |
_total_size_addr(total_size_addr) { } |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
264 |
}; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
265 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
266 |
class PSRestorePreservedMarksTaskExecutor : public RestorePreservedMarksTaskExecutor { |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
267 |
private: |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
268 |
GCTaskManager* _gc_task_manager; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
269 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
270 |
public: |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
271 |
PSRestorePreservedMarksTaskExecutor(GCTaskManager* gc_task_manager) |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
272 |
: _gc_task_manager(gc_task_manager) { } |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
273 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
274 |
void restore(PreservedMarksSet* preserved_marks_set, |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
275 |
volatile size_t* total_size_addr) { |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
276 |
// GCTask / GCTaskQueue are ResourceObjs |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
277 |
ResourceMark rm; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
278 |
|
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
279 |
GCTaskQueue* q = GCTaskQueue::create(); |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
280 |
for (uint i = 0; i < preserved_marks_set->num(); i += 1) { |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
281 |
q->enqueue(new ParRestoreGCTask(i, preserved_marks_set, total_size_addr)); |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
282 |
} |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
283 |
_gc_task_manager->execute_and_wait(q); |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
284 |
} |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
285 |
}; |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
286 |
|
38080 | 287 |
void PSPromotionManager::restore_preserved_marks() { |
39228
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
288 |
PSRestorePreservedMarksTaskExecutor task_executor(PSScavenge::gc_task_manager()); |
32ce84798166
8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents:
38080
diff
changeset
|
289 |
_preserved_marks_set->restore(&task_executor); |
38080 | 290 |
} |
291 |
||
1 | 292 |
void PSPromotionManager::drain_stacks_depth(bool totally_drain) { |
293 |
totally_drain = totally_drain || _totally_drain; |
|
294 |
||
295 |
#ifdef ASSERT |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
30150
diff
changeset
|
296 |
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); |
1 | 297 |
MutableSpace* to_space = heap->young_gen()->to_space(); |
298 |
MutableSpace* old_space = heap->old_gen()->object_space(); |
|
299 |
#endif /* ASSERT */ |
|
300 |
||
5918 | 301 |
OopStarTaskQueue* const tq = claimed_stack_depth(); |
1 | 302 |
do { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
303 |
StarTask p; |
1 | 304 |
|
305 |
// Drain overflow stack first, so other threads can steal from |
|
306 |
// claimed stack while we work. |
|
5918 | 307 |
while (tq->pop_overflow(p)) { |
308 |
process_popped_location_depth(p); |
|
1 | 309 |
} |
310 |
||
311 |
if (totally_drain) { |
|
5918 | 312 |
while (tq->pop_local(p)) { |
1 | 313 |
process_popped_location_depth(p); |
314 |
} |
|
315 |
} else { |
|
5918 | 316 |
while (tq->size() > _target_stack_size && tq->pop_local(p)) { |
1 | 317 |
process_popped_location_depth(p); |
318 |
} |
|
319 |
} |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
39228
diff
changeset
|
320 |
} while ((totally_drain && !tq->taskqueue_empty()) || !tq->overflow_empty()); |
1 | 321 |
|
5918 | 322 |
assert(!totally_drain || tq->taskqueue_empty(), "Sanity"); |
323 |
assert(totally_drain || tq->size() <= _target_stack_size, "Sanity"); |
|
324 |
assert(tq->overflow_empty(), "Sanity"); |
|
1 | 325 |
} |
326 |
||
327 |
void PSPromotionManager::flush_labs() { |
|
5918 | 328 |
assert(stacks_empty(), "Attempt to flush lab with live stack"); |
1 | 329 |
|
330 |
// If either promotion lab fills up, we can flush the |
|
331 |
// lab but not refill it, so check first. |
|
332 |
assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity"); |
|
333 |
if (!_young_lab.is_flushed()) |
|
334 |
_young_lab.flush(); |
|
335 |
||
336 |
assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity"); |
|
337 |
if (!_old_lab.is_flushed()) |
|
338 |
_old_lab.flush(); |
|
339 |
||
340 |
// Let PSScavenge know if we overflowed |
|
341 |
if (_young_gen_is_full) { |
|
342 |
PSScavenge::set_survivor_overflow(true); |
|
343 |
} |
|
344 |
} |
|
345 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
346 |
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
|
347 |
oop obj, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
348 |
int start, int end) { |
8685
f8edcc58cca7
6820066: Check that -XX:ParGCArrayScanChunk has a value larger than zero.
jwilhelm
parents:
7397
diff
changeset
|
349 |
assert(start <= end, "invariant"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
350 |
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
|
351 |
T* p = base + start; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
352 |
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
|
353 |
while (p < chunk_end) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
354 |
if (PSScavenge::should_scavenge(p)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
355 |
claim_or_forward_depth(p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
356 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
357 |
++p; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
358 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
359 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
360 |
|
1 | 361 |
void PSPromotionManager::process_array_chunk(oop old) { |
362 |
assert(PSChunkLargeArrays, "invariant"); |
|
363 |
assert(old->is_objArray(), "invariant"); |
|
364 |
assert(old->is_forwarded(), "invariant"); |
|
365 |
||
6067 | 366 |
TASKQUEUE_STATS_ONLY(++_array_chunks_processed); |
1 | 367 |
|
368 |
oop const obj = old->forwardee(); |
|
369 |
||
370 |
int start; |
|
371 |
int const end = arrayOop(old)->length(); |
|
372 |
if (end > (int) _min_array_size_for_chunking) { |
|
373 |
// we'll chunk more |
|
374 |
start = end - _array_chunk_size; |
|
375 |
assert(start > 0, "invariant"); |
|
376 |
arrayOop(old)->set_length(start); |
|
377 |
push_depth(mask_chunked_array_oop(old)); |
|
6067 | 378 |
TASKQUEUE_STATS_ONLY(++_masked_pushes); |
1 | 379 |
} else { |
380 |
// this is the final chunk for this array |
|
381 |
start = 0; |
|
382 |
int const actual_length = arrayOop(obj)->length(); |
|
383 |
arrayOop(old)->set_length(actual_length); |
|
384 |
} |
|
385 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
386 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
387 |
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
|
388 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
389 |
process_array_chunk_work<oop>(obj, start, end); |
1 | 390 |
} |
391 |
} |
|
392 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
393 |
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
|
394 |
PSPromotionManager* _pm; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
395 |
public: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
396 |
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
|
397 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
398 |
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
|
399 |
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
|
400 |
_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
|
401 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
402 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
403 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
404 |
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
|
405 |
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
|
406 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
407 |
// 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
|
408 |
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
|
409 |
}; |
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 |
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
|
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_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
|
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 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
|
417 |
// 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
|
418 |
// 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
|
419 |
// ClassLoaderData objects. |
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 |
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
|
422 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
423 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
424 |
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
|
425 |
} |
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 |
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
|
428 |
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
|
429 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
430 |
// 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
|
431 |
// 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
|
432 |
// 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
|
433 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
434 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
435 |
template <class T> |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
436 |
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
|
437 |
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
|
438 |
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
|
439 |
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
|
440 |
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
|
441 |
// 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
|
442 |
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
|
443 |
return; |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
444 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
445 |
// 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
|
446 |
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
|
447 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
448 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
449 |
// 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
|
450 |
// 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
|
451 |
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
|
452 |
T next_oop = oopDesc::load_heap_oop(next_addr); |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
453 |
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
|
454 |
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
35061 | 455 |
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
|
456 |
if (PSScavenge::should_scavenge(discovered_addr)) { |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
30173
diff
changeset
|
457 |
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
|
458 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
459 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
460 |
// 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
|
461 |
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
|
462 |
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
|
463 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
464 |
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
|
465 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
466 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
467 |
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
|
468 |
if (UseCompressedOops) { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
469 |
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
|
470 |
} else { |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
471 |
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
|
472 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
473 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
474 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
475 |
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
|
476 |
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
|
477 |
PushContentsClosure cl(pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
478 |
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
|
479 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
480 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
481 |
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
|
482 |
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
|
483 |
ShouldNotReachHere(); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
484 |
} |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29798
diff
changeset
|
485 |
|
1 | 486 |
oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) { |
487 |
assert(_old_gen_is_full || PromotionFailureALot, "Sanity"); |
|
488 |
||
489 |
// Attempt to CAS in the header. |
|
490 |
// This tests if the header is still the same as when |
|
491 |
// this started. If it is the same (i.e., no forwarding |
|
492 |
// pointer has been installed), then this thread owns |
|
493 |
// it. |
|
494 |
if (obj->cas_forward_to(obj, obj_mark)) { |
|
495 |
// We won any races, we "own" this object. |
|
496 |
assert(obj == obj->forwardee(), "Sanity"); |
|
497 |
||
18025 | 498 |
_promotion_failed_info.register_copy_failure(obj->size()); |
499 |
||
29792
8c6fa07f0869
8075957: Reduce calls to the GC specific object visitors in oopDesc
stefank
parents:
29702
diff
changeset
|
500 |
push_contents(obj); |
1 | 501 |
|
37045
41e3f98fa3dc
8146991: Introduce per-worker preserved mark stacks in ParallelGC
tonyp
parents:
35901
diff
changeset
|
502 |
_preserved_marks->push_if_necessary(obj, obj_mark); |
1 | 503 |
} else { |
504 |
// We lost, someone else "owns" this object |
|
505 |
guarantee(obj->is_forwarded(), "Object must be forwarded if the cas failed."); |
|
506 |
||
507 |
// No unallocation to worry about. |
|
508 |
obj = obj->forwardee(); |
|
509 |
} |
|
510 |
||
35061 | 511 |
log_develop_trace(gc, scavenge)("{promotion-failure %s " PTR_FORMAT " (%d)}", obj->klass()->internal_name(), p2i(obj), obj->size()); |
1 | 512 |
|
513 |
return obj; |
|
514 |
} |