equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
150 OopClosure* weak_oops() { return NULL; } |
150 OopClosure* weak_oops() { return NULL; } |
151 OopClosure* strong_oops() { return _roots; } |
151 OopClosure* strong_oops() { return _roots; } |
152 |
152 |
153 CLDClosure* weak_clds() { return NULL; } |
153 CLDClosure* weak_clds() { return NULL; } |
154 CLDClosure* strong_clds() { return _clds; } |
154 CLDClosure* strong_clds() { return _clds; } |
155 CLDClosure* thread_root_clds() { return _clds; } |
|
156 |
155 |
157 CodeBlobClosure* strong_codeblobs() { return _blobs; } |
156 CodeBlobClosure* strong_codeblobs() { return _blobs; } |
158 }; |
157 }; |
159 |
158 |
160 void G1RootProcessor::process_strong_roots(OopClosure* oops, |
159 void G1RootProcessor::process_strong_roots(OopClosure* oops, |
182 // By returning the same CLDClosure for both weak and strong CLDs we ensure |
181 // By returning the same CLDClosure for both weak and strong CLDs we ensure |
183 // that a single walk of the CLDG will invoke the closure on all CLDs i the |
182 // that a single walk of the CLDG will invoke the closure on all CLDs i the |
184 // system. |
183 // system. |
185 CLDClosure* weak_clds() { return _clds; } |
184 CLDClosure* weak_clds() { return _clds; } |
186 CLDClosure* strong_clds() { return _clds; } |
185 CLDClosure* strong_clds() { return _clds; } |
187 // We don't want to visit CLDs more than once, so we return NULL for the |
|
188 // thread root CLDs. |
|
189 CLDClosure* thread_root_clds() { return NULL; } |
|
190 |
186 |
191 // We don't want to visit code blobs more than once, so we return NULL for the |
187 // We don't want to visit code blobs more than once, so we return NULL for the |
192 // strong case and walk the entire code cache as a separate step. |
188 // strong case and walk the entire code cache as a separate step. |
193 CodeBlobClosure* strong_codeblobs() { return NULL; } |
189 CodeBlobClosure* strong_codeblobs() { return NULL; } |
194 }; |
190 }; |
209 } |
205 } |
210 |
206 |
211 void G1RootProcessor::process_java_roots(G1RootClosures* closures, |
207 void G1RootProcessor::process_java_roots(G1RootClosures* closures, |
212 G1GCPhaseTimes* phase_times, |
208 G1GCPhaseTimes* phase_times, |
213 uint worker_i) { |
209 uint worker_i) { |
214 assert(closures->thread_root_clds() == NULL || closures->weak_clds() == NULL, "There is overlap between those, only one may be set"); |
|
215 // Iterating over the CLDG and the Threads are done early to allow us to |
210 // Iterating over the CLDG and the Threads are done early to allow us to |
216 // first process the strong CLDs and nmethods and then, after a barrier, |
211 // first process the strong CLDs and nmethods and then, after a barrier, |
217 // let the thread process the weak CLDs and nmethods. |
212 // let the thread process the weak CLDs and nmethods. |
218 { |
213 { |
219 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); |
214 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); |
225 { |
220 { |
226 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); |
221 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); |
227 bool is_par = n_workers() > 1; |
222 bool is_par = n_workers() > 1; |
228 Threads::possibly_parallel_oops_do(is_par, |
223 Threads::possibly_parallel_oops_do(is_par, |
229 closures->strong_oops(), |
224 closures->strong_oops(), |
230 closures->thread_root_clds(), |
|
231 closures->strong_codeblobs()); |
225 closures->strong_codeblobs()); |
232 } |
226 } |
233 } |
227 } |
234 |
228 |
235 void G1RootProcessor::process_vm_roots(G1RootClosures* closures, |
229 void G1RootProcessor::process_vm_roots(G1RootClosures* closures, |