author | kbarrett |
Thu, 18 Jul 2019 14:57:32 -0400 | |
changeset 55740 | b3ff56f955c8 |
parent 54669 | ad45b3802d4e |
child 57771 | 50c959cc40e8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
54178
diff
changeset
|
2 |
* Copyright (c) 2002, 2019, 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" |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
51292
diff
changeset
|
27 |
#include "classfile/classLoaderDataGraph.hpp" |
7397 | 28 |
#include "classfile/systemDictionary.hpp" |
29 |
#include "code/codeCache.hpp" |
|
30764 | 30 |
#include "gc/parallel/gcTaskManager.hpp" |
54122
4b1426ed1c44
8220343: Move scavenge_root_nmethods from shared code
stefank
parents:
52117
diff
changeset
|
31 |
#include "gc/parallel/parallelScavengeHeap.inline.hpp" |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47580
diff
changeset
|
32 |
#include "gc/parallel/psCardTable.hpp" |
52117
a2edf32cd813
8201436: Replace oop_ps_push_contents with oop_iterate and closure
lkorinth
parents:
51959
diff
changeset
|
33 |
#include "gc/parallel/psClosure.inline.hpp" |
30764 | 34 |
#include "gc/parallel/psPromotionManager.hpp" |
35 |
#include "gc/parallel/psPromotionManager.inline.hpp" |
|
36 |
#include "gc/parallel/psScavenge.inline.hpp" |
|
37 |
#include "gc/parallel/psTasks.hpp" |
|
54122
4b1426ed1c44
8220343: Move scavenge_root_nmethods from shared code
stefank
parents:
52117
diff
changeset
|
38 |
#include "gc/shared/scavengableNMethods.hpp" |
30764 | 39 |
#include "gc/shared/taskqueue.inline.hpp" |
7397 | 40 |
#include "memory/iterator.hpp" |
37248 | 41 |
#include "memory/resourceArea.hpp" |
7397 | 42 |
#include "memory/universe.hpp" |
43 |
#include "oops/oop.inline.hpp" |
|
44 |
#include "runtime/thread.hpp" |
|
45 |
#include "runtime/vmThread.hpp" |
|
46 |
#include "services/management.hpp" |
|
1 | 47 |
|
48 |
// |
|
49 |
// ScavengeRootsTask |
|
50 |
// |
|
51 |
||
52 |
void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
53 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 54 |
|
55 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
56 |
PSScavengeRootsClosure roots_closure(pm); |
|
11753 | 57 |
PSPromoteRootsClosure roots_to_old_closure(pm); |
1 | 58 |
|
59 |
switch (_root_type) { |
|
60 |
case universe: |
|
61 |
Universe::oops_do(&roots_closure); |
|
62 |
break; |
|
63 |
||
64 |
case jni_handles: |
|
65 |
JNIHandles::oops_do(&roots_closure); |
|
66 |
break; |
|
67 |
||
68 |
case threads: |
|
69 |
{ |
|
70 |
ResourceMark rm; |
|
38074
8475fdc6dcc3
8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents:
37248
diff
changeset
|
71 |
Threads::oops_do(&roots_closure, NULL); |
1 | 72 |
} |
73 |
break; |
|
74 |
||
75 |
case object_synchronizer: |
|
76 |
ObjectSynchronizer::oops_do(&roots_closure); |
|
77 |
break; |
|
78 |
||
79 |
case system_dictionary: |
|
80 |
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
|
81 |
break; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
11753
diff
changeset
|
82 |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
83 |
case class_loader_data: |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
84 |
{ |
47580 | 85 |
PSScavengeCLDClosure cld_closure(pm); |
86 |
ClassLoaderDataGraph::cld_do(&cld_closure); |
|
17844
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
87 |
} |
28ca9179db98
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
14582
diff
changeset
|
88 |
break; |
1 | 89 |
|
90 |
case management: |
|
91 |
Management::oops_do(&roots_closure); |
|
92 |
break; |
|
93 |
||
94 |
case jvmti: |
|
95 |
JvmtiExport::oops_do(&roots_closure); |
|
96 |
break; |
|
97 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
98 |
case code_cache: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
99 |
{ |
54178 | 100 |
MarkingCodeBlobClosure code_closure(&roots_to_old_closure, CodeBlobToOopClosure::FixRelocations); |
101 |
ScavengableNMethods::nmethods_do(&code_closure); |
|
42650 | 102 |
AOTLoader::oops_do(&roots_closure); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
103 |
} |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
104 |
break; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
670
diff
changeset
|
105 |
|
1 | 106 |
default: |
107 |
fatal("Unknown root type"); |
|
108 |
} |
|
109 |
||
110 |
// Do the real work |
|
111 |
pm->drain_stacks(false); |
|
112 |
} |
|
113 |
||
114 |
// |
|
115 |
// ThreadRootsTask |
|
116 |
// |
|
117 |
||
118 |
void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
119 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 120 |
|
121 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
122 |
PSScavengeRootsClosure roots_closure(pm); |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
123 |
MarkingCodeBlobClosure roots_in_blobs(&roots_closure, CodeBlobToOopClosure::FixRelocations); |
1 | 124 |
|
50058
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
49982
diff
changeset
|
125 |
_thread->oops_do(&roots_closure, &roots_in_blobs); |
1 | 126 |
|
127 |
// Do the real work |
|
128 |
pm->drain_stacks(false); |
|
129 |
} |
|
130 |
||
131 |
// |
|
132 |
// StealTask |
|
133 |
// |
|
134 |
||
135 |
StealTask::StealTask(ParallelTaskTerminator* t) : |
|
136 |
_terminator(t) {} |
|
137 |
||
138 |
void StealTask::do_it(GCTaskManager* manager, uint which) { |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29792
diff
changeset
|
139 |
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
1 | 140 |
|
141 |
PSPromotionManager* pm = |
|
142 |
PSPromotionManager::gc_thread_promotion_manager(which); |
|
143 |
pm->drain_stacks(true); |
|
144 |
guarantee(pm->stacks_empty(), |
|
145 |
"stacks should be empty at this point"); |
|
146 |
||
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
147 |
while(true) { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
148 |
StarTask p; |
51292
0538a5cdb474
8205921: Optimizing best-of-2 work stealing queue selection
zgu
parents:
50058
diff
changeset
|
149 |
if (PSPromotionManager::steal_depth(which, p)) { |
6248
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
150 |
TASKQUEUE_STATS_ONLY(pm->record_steal(p)); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
151 |
pm->process_popped_location_depth(p); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
152 |
pm->drain_stacks_depth(true); |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
153 |
} else { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
154 |
if (terminator()->offer_termination()) { |
2e661807cef0
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
6067
diff
changeset
|
155 |
break; |
1 | 156 |
} |
157 |
} |
|
158 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
159 |
guarantee(pm->stacks_empty(), "stacks should be empty at this point"); |
1 | 160 |
} |
161 |
||
162 |
// |
|
163 |
// OldToYoungRootsTask |
|
164 |
// |
|
165 |
||
166 |
void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { |
|
13924 | 167 |
// 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
|
168 |
assert(!_old_gen->object_space()->is_empty(), |
13924 | 169 |
"Should not be called is there is no work"); |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
170 |
assert(_old_gen != NULL, "Sanity"); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
171 |
assert(_old_gen->object_space()->contains(_gen_top) || _gen_top == _old_gen->object_space()->top(), "Sanity"); |
1 | 172 |
assert(_stripe_number < ParallelGCThreads, "Sanity"); |
173 |
||
174 |
{ |
|
175 |
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47580
diff
changeset
|
176 |
PSCardTable* card_table = ParallelScavengeHeap::heap()->card_table(); |
1 | 177 |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
178 |
card_table->scavenge_contents_parallel(_old_gen->start_array(), |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
179 |
_old_gen->object_space(), |
1 | 180 |
_gen_top, |
181 |
pm, |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
182 |
_stripe_number, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
10524
diff
changeset
|
183 |
_stripe_total); |
1 | 184 |
|
185 |
// Do the real work |
|
186 |
pm->drain_stacks(false); |
|
187 |
} |
|
188 |
} |