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