Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @ 8733:9def4075da6d
8008079: G1: Add nextObject routine to CMBitMapRO and replace nextWord
Summary: Update the task local finger to the start of the next object when marking aborts, in order to avoid the redundant scanning of all 0's when the marking task restarts, if otherwise updating to the next word. In addition, reuse the routine nextObject() in routine iterate().
Reviewed-by: johnc, ysr
Contributed-by: tamao <tao.mao@oracle.com>
author | tamao |
---|---|
date | Tue, 05 Mar 2013 15:36:56 -0800 |
parents | d0aa87f04bd5 |
children | eda078b01c65 |
rev | line source |
---|---|
0 | 1 /* |
4909 | 2 * Copyright (c) 2002, 2012, 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); | |
4909 | 54 PSPromoteRootsClosure roots_to_old_closure(pm); |
0 | 55 |
56 switch (_root_type) { | |
57 case universe: | |
58 Universe::oops_do(&roots_closure); | |
59 break; | |
60 | |
61 case jni_handles: | |
62 JNIHandles::oops_do(&roots_closure); | |
63 break; | |
64 | |
65 case threads: | |
66 { | |
67 ResourceMark rm; | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6817
diff
changeset
|
68 CLDToOopClosure* cld_closure = NULL; // Not needed. All CLDs are already visited. |
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6817
diff
changeset
|
69 Threads::oops_do(&roots_closure, cld_closure, NULL); |
0 | 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: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
82 { |
0 | 83 SystemDictionary::oops_do(&roots_closure); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
84 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
85 // Move this to another root_type? |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
86 PSScavengeKlassClosure klass_closure(pm); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
87 ClassLoaderDataGraph::oops_do(&roots_closure, &klass_closure, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
4909
diff
changeset
|
88 } |
0 | 89 break; |
90 | |
91 case management: | |
92 Management::oops_do(&roots_closure); | |
93 break; | |
94 | |
95 case jvmti: | |
96 JvmtiExport::oops_do(&roots_closure); | |
97 break; | |
98 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
99 |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
100 case code_cache: |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
101 { |
4909 | 102 CodeBlobToOopClosure each_scavengable_code_blob(&roots_to_old_closure, /*do_marking=*/ true); |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
103 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
|
104 } |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
105 break; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
106 |
0 | 107 default: |
108 fatal("Unknown root type"); | |
109 } | |
110 | |
111 // Do the real work | |
112 pm->drain_stacks(false); | |
113 } | |
114 | |
115 // | |
116 // ThreadRootsTask | |
117 // | |
118 | |
119 void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { | |
120 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
121 | |
122 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
123 PSScavengeRootsClosure roots_closure(pm); | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6817
diff
changeset
|
124 CLDToOopClosure* roots_from_clds = NULL; // Not needed. All CLDs are already visited. |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
196
diff
changeset
|
125 CodeBlobToOopClosure roots_in_blobs(&roots_closure, /*do_marking=*/ true); |
0 | 126 |
127 if (_java_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6817
diff
changeset
|
128 _java_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); |
0 | 129 |
130 if (_vm_thread != NULL) | |
7179
d0aa87f04bd5
8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
6817
diff
changeset
|
131 _vm_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); |
0 | 132 |
133 // Do the real work | |
134 pm->drain_stacks(false); | |
135 } | |
136 | |
137 // | |
138 // StealTask | |
139 // | |
140 | |
141 StealTask::StealTask(ParallelTaskTerminator* t) : | |
142 _terminator(t) {} | |
143 | |
144 void StealTask::do_it(GCTaskManager* manager, uint which) { | |
145 assert(Universe::heap()->is_gc_active(), "called outside gc"); | |
146 | |
147 PSPromotionManager* pm = | |
148 PSPromotionManager::gc_thread_promotion_manager(which); | |
149 pm->drain_stacks(true); | |
150 guarantee(pm->stacks_empty(), | |
151 "stacks should be empty at this point"); | |
152 | |
153 int random_seed = 17; | |
1706
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
154 while(true) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
155 StarTask p; |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
156 if (PSPromotionManager::steal_depth(which, &random_seed, p)) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
157 TASKQUEUE_STATS_ONLY(pm->record_steal(p)); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
158 pm->process_popped_location_depth(p); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
159 pm->drain_stacks_depth(true); |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
160 } else { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
161 if (terminator()->offer_termination()) { |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1665
diff
changeset
|
162 break; |
0 | 163 } |
164 } | |
165 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
166 guarantee(pm->stacks_empty(), "stacks should be empty at this point"); |
0 | 167 } |
168 | |
169 // | |
170 // OldToYoungRootsTask | |
171 // | |
172 | |
173 void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) { | |
6817 | 174 // There are not old-to-young pointers if the old gen is empty. |
175 assert(!_gen->object_space()->is_empty(), | |
176 "Should not be called is there is no work"); | |
0 | 177 assert(_gen != NULL, "Sanity"); |
178 assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity"); | |
179 assert(_stripe_number < ParallelGCThreads, "Sanity"); | |
180 | |
181 { | |
182 PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); | |
183 | |
184 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | |
185 CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set(); | |
186 // FIX ME! Assert that card_table is the type we believe it to be. | |
187 | |
188 card_table->scavenge_contents_parallel(_gen->start_array(), | |
189 _gen->object_space(), | |
190 _gen_top, | |
191 pm, | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
192 _stripe_number, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3915
diff
changeset
|
193 _stripe_total); |
0 | 194 |
195 // Do the real work | |
196 pm->drain_stacks(false); | |
197 } | |
198 } |