Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @ 4114:6729bbc1fcd6
7003454: order constants in constant table by number of references in code
Reviewed-by: kvn, never, bdelsart
author | twisti |
---|---|
date | Wed, 16 Nov 2011 01:39:50 -0800 |
parents | c2bf0120ee5d |
children | bca17e38de00 |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2379
diff
changeset
|
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/systemDictionary.hpp" | |
27 #include "code/codeCache.hpp" | |
28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" | |
29 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" | |
30 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp" | |
31 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" | |
32 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
33 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" |
1972 | 34 #include "gc_implementation/parallelScavenge/psTasks.hpp" |
35 #include "memory/iterator.hpp" | |
36 #include "memory/universe.hpp" | |
37 #include "oops/oop.inline.hpp" | |
38 #include "oops/oop.psgc.inline.hpp" | |
39 #include "runtime/fprofiler.hpp" | |
40 #include "runtime/thread.hpp" | |
41 #include "runtime/vmThread.hpp" | |
42 #include "services/management.hpp" | |
43 #include "utilities/taskqueue.hpp" | |
0 | 44 |
45 // | |
46 // ScavengeRootsTask | |
47 // | |
48 | |
49 void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) { | |
50 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
51 | |
52 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
53 PSScavengeRootsClosure roots_closure(pm); | |
54 | |
55 switch (_root_type) { | |
56 case universe: | |
57 Universe::oops_do(&roots_closure); | |
58 break; | |
59 | |
60 case jni_handles: | |
61 JNIHandles::oops_do(&roots_closure); | |
62 break; | |
63 | |
64 case threads: | |
65 { | |
66 ResourceMark rm; | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
67 Threads::oops_do(&roots_closure, NULL); |
0 | 68 } |
69 break; | |
70 | |
71 case object_synchronizer: | |
72 ObjectSynchronizer::oops_do(&roots_closure); | |
73 break; | |
74 | |
75 case flat_profiler: | |
76 FlatProfiler::oops_do(&roots_closure); | |
77 break; | |
78 | |
79 case system_dictionary: | |
80 SystemDictionary::oops_do(&roots_closure); | |
81 break; | |
82 | |
83 case management: | |
84 Management::oops_do(&roots_closure); | |
85 break; | |
86 | |
87 case jvmti: | |
88 JvmtiExport::oops_do(&roots_closure); | |
89 break; | |
90 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
91 |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
92 case code_cache: |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
93 { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
94 CodeBlobToOopClosure each_scavengable_code_blob(&roots_closure, /*do_marking=*/ true); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
95 CodeCache::scavenge_root_nmethods_do(&each_scavengable_code_blob); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
96 } |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
97 break; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
98 |
0 | 99 default: |
100 fatal("Unknown root type"); | |
101 } | |
102 | |
103 // Do the real work | |
104 pm->drain_stacks(false); | |
105 } | |
106 | |
107 // | |
108 // ThreadRootsTask | |
109 // | |
110 | |
111 void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { | |
112 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
113 | |
114 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
115 PSScavengeRootsClosure roots_closure(pm); | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
116 CodeBlobToOopClosure roots_in_blobs(&roots_closure, /*do_marking=*/ true); |
0 | 117 |
118 if (_java_thread != NULL) | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
119 _java_thread->oops_do(&roots_closure, &roots_in_blobs); |
0 | 120 |
121 if (_vm_thread != NULL) | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
122 _vm_thread->oops_do(&roots_closure, &roots_in_blobs); |
0 | 123 |
124 // Do the real work | |
125 pm->drain_stacks(false); | |
126 } | |
127 | |
128 // | |
129 // StealTask | |
130 // | |
131 | |
132 StealTask::StealTask(ParallelTaskTerminator* t) : | |
133 _terminator(t) {} | |
134 | |
135 void StealTask::do_it(GCTaskManager* manager, uint which) { | |
136 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
137 | |
138 PSPromotionManager* pm = | |
139 PSPromotionManager::gc_thread_promotion_manager(which); | |
140 pm->drain_stacks(true); | |
141 guarantee(pm->stacks_empty(), | |
142 "stacks should be empty at this point"); | |
143 | |
144 int random_seed = 17; | |
1706
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
145 while(true) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
146 StarTask p; |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
147 if (PSPromotionManager::steal_depth(which, &random_seed, p)) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
148 TASKQUEUE_STATS_ONLY(pm->record_steal(p)); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
149 pm->process_popped_location_depth(p); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
150 pm->drain_stacks_depth(true); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
151 } else { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
152 if (terminator()->offer_termination()) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
153 break; |
0 | 154 } |
155 } | |
156 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
157 guarantee(pm->stacks_empty(), "stacks should be empty at this point"); |
0 | 158 } |
159 | |
160 // | |
161 // SerialOldToYoungRootsTask | |
162 // | |
163 | |
164 void SerialOldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { | |
165 assert(_gen != NULL, "Sanity"); | |
166 assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity"); | |
167 | |
168 { | |
169 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
170 | |
171 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | |
172 CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set(); | |
173 // FIX ME! Assert that card_table is the type we believe it to be. | |
174 | |
175 card_table->scavenge_contents(_gen->start_array(), | |
176 _gen->object_space(), | |
177 _gen_top, | |
178 pm); | |
179 | |
180 // Do the real work | |
181 pm->drain_stacks(false); | |
182 } | |
183 } | |
184 | |
185 // | |
186 // OldToYoungRootsTask | |
187 // | |
188 | |
189 void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { | |
190 assert(_gen != NULL, "Sanity"); | |
191 assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity"); | |
192 assert(_stripe_number < ParallelGCThreads, "Sanity"); | |
193 | |
194 { | |
195 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
196 | |
197 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | |
198 CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set(); | |
199 // FIX ME! Assert that card_table is the type we believe it to be. | |
200 | |
201 card_table->scavenge_contents_parallel(_gen->start_array(), | |
202 _gen->object_space(), | |
203 _gen_top, | |
204 pm, | |
205 _stripe_number); | |
206 | |
207 // Do the real work | |
208 pm->drain_stacks(false); | |
209 } | |
210 } |