author | stefank |
Tue, 11 Apr 2017 23:45:37 +0200 | |
changeset 46565 | 8dcbf532ea00 |
parent 42650 | 1f304d0c888b |
child 47106 | bed18a111b90 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
37248 | 2 |
* Copyright (c) 2002, 2016, 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:
3908
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3908
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:
3908
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
42650 | 26 |
#include "aot/aotLoader.hpp" |
7397 | 27 |
#include "classfile/systemDictionary.hpp" |
28 |
#include "code/codeCache.hpp" |
|
30764 | 29 |
#include "gc/parallel/cardTableExtension.hpp" |
30 |
#include "gc/parallel/gcTaskManager.hpp" |
|
31 |
#include "gc/parallel/psMarkSweep.hpp" |
|
32 |
#include "gc/parallel/psPromotionManager.hpp" |
|
33 |
#include "gc/parallel/psPromotionManager.inline.hpp" |
|
34 |
#include "gc/parallel/psScavenge.inline.hpp" |
|
35 |
#include "gc/parallel/psTasks.hpp" |
|
36 |
#include "gc/shared/taskqueue.inline.hpp" |
|
7397 | 37 |
#include "memory/iterator.hpp" |
37248 | 38 |
#include "memory/resourceArea.hpp" |
7397 | 39 |
#include "memory/universe.hpp" |
40 |
#include "oops/oop.inline.hpp" |
|
41 |
#include "runtime/fprofiler.hpp" |
|
42 |
#include "runtime/thread.hpp" |
|
43 |
#include "runtime/vmThread.hpp" |
|
44 |
#include "services/management.hpp" |
|
1 | 45 |
|
46 |
// |
|
47 |
// ScavengeRootsTask |
|
48 |
// |
|
49 |
||
50 |
void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
51 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 52 |
|
53 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
54 |
PSScavengeRootsClosure roots_closure(pm); |
|
11753 | 55 |
PSPromoteRootsClosure roots_to_old_closure(pm); |
1 | 56 |
|
57 |
switch (_root_type) { |
|
58 |
case universe: |
|
59 |
Universe::oops_do(&roots_closure); |
|
60 |
break; |
|
61 |
||
62 |
case jni_handles: |
|
63 |
JNIHandles::oops_do(&roots_closure); |
|
64 |
break; |
|
65 |
||
66 |
case threads: |
|
67 |
{ |
|
68 |
ResourceMark rm; |
|
38074
8475fdc6dcc3
8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents:
37248
diff
changeset
|
69 |
Threads::oops_do(&roots_closure, NULL); |
1 | 70 |
} |
71 |
break; |
|
72 |
||
73 |
case object_synchronizer: |
|
74 |
ObjectSynchronizer::oops_do(&roots_closure); |
|
75 |
break; |
|
76 |
||
77 |
case flat_profiler: |
|
78 |
FlatProfiler::oops_do(&roots_closure); |
|
79 |
break; |
|
80 |
||
81 |
case system_dictionary: |
|
82 |
SystemDictionary::oops_do(&roots_closure); |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
83 |
break; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11753
diff
changeset
|
84 |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
85 |
case class_loader_data: |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
86 |
{ |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
87 |
PSScavengeKlassClosure klass_closure(pm); |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
88 |
ClassLoaderDataGraph::oops_do(&roots_closure, &klass_closure, false); |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
89 |
} |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
90 |
break; |
1 | 91 |
|
92 |
case management: |
|
93 |
Management::oops_do(&roots_closure); |
|
94 |
break; |
|
95 |
||
96 |
case jvmti: |
|
97 |
JvmtiExport::oops_do(&roots_closure); |
|
98 |
break; |
|
99 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
100 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
101 |
case code_cache: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
102 |
{ |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
103 |
MarkingCodeBlobClosure each_scavengable_code_blob(&roots_to_old_closure, CodeBlobToOopClosure::FixRelocations); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
104 |
CodeCache::scavenge_root_nmethods_do(&each_scavengable_code_blob); |
42650 | 105 |
AOTLoader::oops_do(&roots_closure); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
106 |
} |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
107 |
break; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
108 |
|
1 | 109 |
default: |
110 |
fatal("Unknown root type"); |
|
111 |
} |
|
112 |
||
113 |
// Do the real work |
|
114 |
pm->drain_stacks(false); |
|
115 |
} |
|
116 |
||
117 |
// |
|
118 |
// ThreadRootsTask |
|
119 |
// |
|
120 |
||
121 |
void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
122 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 123 |
|
124 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
125 |
PSScavengeRootsClosure roots_closure(pm); |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
126 |
MarkingCodeBlobClosure roots_in_blobs(&roots_closure, CodeBlobToOopClosure::FixRelocations); |
1 | 127 |
|
128 |
if (_java_thread != NULL) |
|
38074
8475fdc6dcc3
8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents:
37248
diff
changeset
|
129 |
_java_thread->oops_do(&roots_closure, &roots_in_blobs); |
1 | 130 |
|
131 |
if (_vm_thread != NULL) |
|
38074
8475fdc6dcc3
8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents:
37248
diff
changeset
|
132 |
_vm_thread->oops_do(&roots_closure, &roots_in_blobs); |
1 | 133 |
|
134 |
// Do the real work |
|
135 |
pm->drain_stacks(false); |
|
136 |
} |
|
137 |
||
138 |
// |
|
139 |
// StealTask |
|
140 |
// |
|
141 |
||
142 |
StealTask::StealTask(ParallelTaskTerminator* t) : |
|
143 |
_terminator(t) {} |
|
144 |
||
145 |
void StealTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
146 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 147 |
|
148 |
PSPromotionManager* pm = |
|
149 |
PSPromotionManager::gc_thread_promotion_manager(which); |
|
150 |
pm->drain_stacks(true); |
|
151 |
guarantee(pm->stacks_empty(), |
|
152 |
"stacks should be empty at this point"); |
|
153 |
||
154 |
int random_seed = 17; |
|
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
155 |
while(true) { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
156 |
StarTask p; |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
157 |
if (PSPromotionManager::steal_depth(which, &random_seed, p)) { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
158 |
TASKQUEUE_STATS_ONLY(pm->record_steal(p)); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
159 |
pm->process_popped_location_depth(p); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
160 |
pm->drain_stacks_depth(true); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
161 |
} else { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
162 |
if (terminator()->offer_termination()) { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
163 |
break; |
1 | 164 |
} |
165 |
} |
|
166 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
167 |
guarantee(pm->stacks_empty(), "stacks should be empty at this point"); |
1 | 168 |
} |
169 |
||
170 |
// |
|
171 |
// OldToYoungRootsTask |
|
172 |
// |
|
173 |
||
174 |
void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
13924 | 175 |
// There are not old-to-young pointers if the old gen is empty. |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
176 |
assert(!_old_gen->object_space()->is_empty(), |
13924 | 177 |
"Should not be called is there is no work"); |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
178 |
assert(_old_gen != NULL, "Sanity"); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
179 |
assert(_old_gen->object_space()->contains(_gen_top) || _gen_top == _old_gen->object_space()->top(), "Sanity"); |
1 | 180 |
assert(_stripe_number < ParallelGCThreads, "Sanity"); |
181 |
||
182 |
{ |
|
183 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
29325 | 184 |
CardTableExtension* card_table = |
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
185 |
barrier_set_cast<CardTableExtension>(ParallelScavengeHeap::heap()->barrier_set()); |
1 | 186 |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
187 |
card_table->scavenge_contents_parallel(_old_gen->start_array(), |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
188 |
_old_gen->object_space(), |
1 | 189 |
_gen_top, |
190 |
pm, |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
191 |
_stripe_number, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
192 |
_stripe_total); |
1 | 193 |
|
194 |
// Do the real work |
|
195 |
pm->drain_stacks(false); |
|
196 |
} |
|
197 |
} |