annotate src/share/vm/gc_implementation/parNew/parOopClosures.hpp @ 10:28372612af5e

6362677: Change parallel GC collector default number of parallel GC threads. Summary: Use the same default number of GC threads as used by ParNewGC and ConcMarkSweepGC (i.e., the 5/8th rule). Reviewed-by: ysr, tonyp
author jmasa
date Fri, 22 Feb 2008 17:17:14 -0800
parents a61af66fc99e
children ba764ed4b6f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // Closures for ParNewGeneration
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 class ParScanThreadState;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class ParNewGeneration;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 template<class E> class GenericTaskQueueSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 typedef GenericTaskQueueSet<oop> ObjToScanQueueSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 class ParallelTaskTerminator;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class ParScanClosure: public OopsInGenClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
35 ParScanThreadState* _par_scan_state;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 ParNewGeneration* _g;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 HeapWord* _boundary;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 void do_oop_work(oop* p,
a61af66fc99e Initial load
duke
parents:
diff changeset
39 bool gc_barrier,
a61af66fc99e Initial load
duke
parents:
diff changeset
40 bool root_scan);
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 void par_do_barrier(oop* p);
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
45 ParScanClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 };
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 class ParScanWithBarrierClosure: public ParScanClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
49 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void do_oop(oop* p) { do_oop_work(p, true, false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 void do_oop_nv(oop* p) { do_oop_work(p, true, false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 ParScanWithBarrierClosure(ParNewGeneration* g,
a61af66fc99e Initial load
duke
parents:
diff changeset
53 ParScanThreadState* par_scan_state) :
a61af66fc99e Initial load
duke
parents:
diff changeset
54 ParScanClosure(g, par_scan_state) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
55 };
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class ParScanWithoutBarrierClosure: public ParScanClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ParScanWithoutBarrierClosure(ParNewGeneration* g,
a61af66fc99e Initial load
duke
parents:
diff changeset
60 ParScanThreadState* par_scan_state) :
a61af66fc99e Initial load
duke
parents:
diff changeset
61 ParScanClosure(g, par_scan_state) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
62 void do_oop(oop* p) { do_oop_work(p, false, false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 void do_oop_nv(oop* p) { do_oop_work(p, false, false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 };
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 class ParRootScanWithBarrierTwoGensClosure: public ParScanClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ParRootScanWithBarrierTwoGensClosure(ParNewGeneration* g,
a61af66fc99e Initial load
duke
parents:
diff changeset
69 ParScanThreadState* par_scan_state) :
a61af66fc99e Initial load
duke
parents:
diff changeset
70 ParScanClosure(g, par_scan_state) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
71 void do_oop(oop* p) { do_oop_work(p, true, true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
72 };
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 class ParRootScanWithoutBarrierClosure: public ParScanClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
76 ParRootScanWithoutBarrierClosure(ParNewGeneration* g,
a61af66fc99e Initial load
duke
parents:
diff changeset
77 ParScanThreadState* par_scan_state) :
a61af66fc99e Initial load
duke
parents:
diff changeset
78 ParScanClosure(g, par_scan_state) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void do_oop(oop* p) { do_oop_work(p, false, true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 };
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 class ParScanWeakRefClosure: public ScanWeakRefClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
84 ParScanThreadState* _par_scan_state;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 ParScanWeakRefClosure(ParNewGeneration* g,
a61af66fc99e Initial load
duke
parents:
diff changeset
87 ParScanThreadState* par_scan_state);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void do_oop(oop* p);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void do_oop_nv(oop* p);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 };
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 class ParEvacuateFollowersClosure: public VoidClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 ParScanThreadState* _par_scan_state;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 ParScanThreadState* par_scan_state() { return _par_scan_state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // We want to preserve the specific types here (rather than "OopClosure")
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // for later de-virtualization of do_oop calls.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 ParScanWithoutBarrierClosure* _to_space_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 ParScanWithoutBarrierClosure* to_space_closure() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 return _to_space_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 ParRootScanWithoutBarrierClosure* _to_space_root_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
103 ParRootScanWithoutBarrierClosure* to_space_root_closure() {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return _to_space_root_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 ParScanWithBarrierClosure* _old_gen_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 ParScanWithBarrierClosure* old_gen_closure () {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 return _old_gen_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 ParRootScanWithBarrierTwoGensClosure* _old_gen_root_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure () {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 return _old_gen_root_closure;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 ParNewGeneration* _par_gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
117 ParNewGeneration* par_gen() { return _par_gen; }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 ObjToScanQueueSet* _task_queues;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 ObjToScanQueueSet* task_queues() { return _task_queues; }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 ParallelTaskTerminator* _terminator;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 ParallelTaskTerminator* terminator() { return _terminator; }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 ParEvacuateFollowersClosure(
a61af66fc99e Initial load
duke
parents:
diff changeset
127 ParScanThreadState* par_scan_state_,
a61af66fc99e Initial load
duke
parents:
diff changeset
128 ParScanWithoutBarrierClosure* to_space_closure_,
a61af66fc99e Initial load
duke
parents:
diff changeset
129 ParScanWithBarrierClosure* old_gen_closure_,
a61af66fc99e Initial load
duke
parents:
diff changeset
130 ParRootScanWithoutBarrierClosure* to_space_root_closure_,
a61af66fc99e Initial load
duke
parents:
diff changeset
131 ParNewGeneration* par_gen_,
a61af66fc99e Initial load
duke
parents:
diff changeset
132 ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure_,
a61af66fc99e Initial load
duke
parents:
diff changeset
133 ObjToScanQueueSet* task_queues_,
a61af66fc99e Initial load
duke
parents:
diff changeset
134 ParallelTaskTerminator* terminator_);
a61af66fc99e Initial load
duke
parents:
diff changeset
135 void do_void();
a61af66fc99e Initial load
duke
parents:
diff changeset
136 };