0
|
1 /*
|
|
2 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
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 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 // Closures for ParNewGeneration
|
|
26
|
|
27 class ParScanThreadState;
|
|
28 class ParNewGeneration;
|
|
29 template<class E> class GenericTaskQueueSet;
|
|
30 typedef GenericTaskQueueSet<oop> ObjToScanQueueSet;
|
|
31 class ParallelTaskTerminator;
|
|
32
|
|
33 class ParScanClosure: public OopsInGenClosure {
|
|
34 protected:
|
|
35 ParScanThreadState* _par_scan_state;
|
|
36 ParNewGeneration* _g;
|
|
37 HeapWord* _boundary;
|
|
38 void do_oop_work(oop* p,
|
|
39 bool gc_barrier,
|
|
40 bool root_scan);
|
|
41
|
|
42 void par_do_barrier(oop* p);
|
|
43
|
|
44 public:
|
|
45 ParScanClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state);
|
|
46 };
|
|
47
|
|
48 class ParScanWithBarrierClosure: public ParScanClosure {
|
|
49 public:
|
|
50 void do_oop(oop* p) { do_oop_work(p, true, false); }
|
|
51 void do_oop_nv(oop* p) { do_oop_work(p, true, false); }
|
|
52 ParScanWithBarrierClosure(ParNewGeneration* g,
|
|
53 ParScanThreadState* par_scan_state) :
|
|
54 ParScanClosure(g, par_scan_state) {}
|
|
55 };
|
|
56
|
|
57 class ParScanWithoutBarrierClosure: public ParScanClosure {
|
|
58 public:
|
|
59 ParScanWithoutBarrierClosure(ParNewGeneration* g,
|
|
60 ParScanThreadState* par_scan_state) :
|
|
61 ParScanClosure(g, par_scan_state) {}
|
|
62 void do_oop(oop* p) { do_oop_work(p, false, false); }
|
|
63 void do_oop_nv(oop* p) { do_oop_work(p, false, false); }
|
|
64 };
|
|
65
|
|
66 class ParRootScanWithBarrierTwoGensClosure: public ParScanClosure {
|
|
67 public:
|
|
68 ParRootScanWithBarrierTwoGensClosure(ParNewGeneration* g,
|
|
69 ParScanThreadState* par_scan_state) :
|
|
70 ParScanClosure(g, par_scan_state) {}
|
|
71 void do_oop(oop* p) { do_oop_work(p, true, true); }
|
|
72 };
|
|
73
|
|
74 class ParRootScanWithoutBarrierClosure: public ParScanClosure {
|
|
75 public:
|
|
76 ParRootScanWithoutBarrierClosure(ParNewGeneration* g,
|
|
77 ParScanThreadState* par_scan_state) :
|
|
78 ParScanClosure(g, par_scan_state) {}
|
|
79 void do_oop(oop* p) { do_oop_work(p, false, true); }
|
|
80 };
|
|
81
|
|
82 class ParScanWeakRefClosure: public ScanWeakRefClosure {
|
|
83 protected:
|
|
84 ParScanThreadState* _par_scan_state;
|
|
85 public:
|
|
86 ParScanWeakRefClosure(ParNewGeneration* g,
|
|
87 ParScanThreadState* par_scan_state);
|
|
88 void do_oop(oop* p);
|
|
89 void do_oop_nv(oop* p);
|
|
90 };
|
|
91
|
|
92 class ParEvacuateFollowersClosure: public VoidClosure {
|
|
93 ParScanThreadState* _par_scan_state;
|
|
94 ParScanThreadState* par_scan_state() { return _par_scan_state; }
|
|
95
|
|
96 // We want to preserve the specific types here (rather than "OopClosure")
|
|
97 // for later de-virtualization of do_oop calls.
|
|
98 ParScanWithoutBarrierClosure* _to_space_closure;
|
|
99 ParScanWithoutBarrierClosure* to_space_closure() {
|
|
100 return _to_space_closure;
|
|
101 }
|
|
102 ParRootScanWithoutBarrierClosure* _to_space_root_closure;
|
|
103 ParRootScanWithoutBarrierClosure* to_space_root_closure() {
|
|
104 return _to_space_root_closure;
|
|
105 }
|
|
106
|
|
107 ParScanWithBarrierClosure* _old_gen_closure;
|
|
108 ParScanWithBarrierClosure* old_gen_closure () {
|
|
109 return _old_gen_closure;
|
|
110 }
|
|
111 ParRootScanWithBarrierTwoGensClosure* _old_gen_root_closure;
|
|
112 ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure () {
|
|
113 return _old_gen_root_closure;
|
|
114 }
|
|
115
|
|
116 ParNewGeneration* _par_gen;
|
|
117 ParNewGeneration* par_gen() { return _par_gen; }
|
|
118
|
|
119 ObjToScanQueueSet* _task_queues;
|
|
120 ObjToScanQueueSet* task_queues() { return _task_queues; }
|
|
121
|
|
122 ParallelTaskTerminator* _terminator;
|
|
123 ParallelTaskTerminator* terminator() { return _terminator; }
|
|
124
|
|
125 public:
|
|
126 ParEvacuateFollowersClosure(
|
|
127 ParScanThreadState* par_scan_state_,
|
|
128 ParScanWithoutBarrierClosure* to_space_closure_,
|
|
129 ParScanWithBarrierClosure* old_gen_closure_,
|
|
130 ParRootScanWithoutBarrierClosure* to_space_root_closure_,
|
|
131 ParNewGeneration* par_gen_,
|
|
132 ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure_,
|
|
133 ObjToScanQueueSet* task_queues_,
|
|
134 ParallelTaskTerminator* terminator_);
|
|
135 void do_void();
|
|
136 };
|