21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "gc_interface/collectedHeap.hpp" |
26 #include "memory/allocation.inline.hpp" |
27 #include "memory/allocation.inline.hpp" |
27 #include "memory/cardTableModRefBS.inline.hpp" |
28 #include "memory/cardTableModRefBS.inline.hpp" |
28 #include "memory/cardTableRS.hpp" |
29 #include "memory/cardTableRS.hpp" |
29 #include "memory/genCollectedHeap.hpp" |
30 #include "memory/genCollectedHeap.hpp" |
30 #include "memory/sharedHeap.hpp" |
|
31 #include "memory/space.hpp" |
31 #include "memory/space.hpp" |
32 #include "memory/space.inline.hpp" |
32 #include "memory/space.inline.hpp" |
33 #include "memory/universe.hpp" |
33 #include "memory/universe.hpp" |
34 #include "runtime/java.hpp" |
34 #include "runtime/java.hpp" |
35 #include "runtime/mutexLocker.hpp" |
35 #include "runtime/mutexLocker.hpp" |
449 // to get proper partitioning and termination. |
449 // to get proper partitioning and termination. |
450 // |
450 // |
451 // This is an example of where n_par_threads() is used instead |
451 // This is an example of where n_par_threads() is used instead |
452 // of workers()->active_workers(). n_par_threads can be set to 0 to |
452 // of workers()->active_workers(). n_par_threads can be set to 0 to |
453 // turn off parallelism. For example when this code is called as |
453 // turn off parallelism. For example when this code is called as |
454 // part of verification and SharedHeap::process_roots() is being |
454 // part of verification during root processing then n_par_threads() |
455 // used, then n_par_threads() may have been set to 0. active_workers |
455 // may have been set to 0. active_workers is not overloaded with |
456 // is not overloaded with the meaning that it is a switch to disable |
456 // the meaning that it is a switch to disable parallelism and so keeps |
457 // parallelism and so keeps the meaning of the number of |
457 // the meaning of the number of active gc workers. If parallelism has |
458 // active gc workers. If parallelism has not been shut off by |
458 // not been shut off by setting n_par_threads to 0, then n_par_threads |
459 // setting n_par_threads to 0, then n_par_threads should be |
459 // should be equal to active_workers. When a different mechanism for |
460 // equal to active_workers. When a different mechanism for shutting |
460 // shutting off parallelism is used, then active_workers can be used in |
461 // off parallelism is used, then active_workers can be used in |
|
462 // place of n_par_threads. |
461 // place of n_par_threads. |
463 int n_threads = GenCollectedHeap::heap()->n_par_threads(); |
462 int n_threads = GenCollectedHeap::heap()->n_par_threads(); |
464 bool is_par = n_threads > 0; |
463 bool is_par = n_threads > 0; |
465 if (is_par) { |
464 if (is_par) { |
466 #if INCLUDE_ALL_GCS |
465 #if INCLUDE_ALL_GCS |