1
|
1 |
/*
|
|
2 |
* Copyright 2002-2005 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 |
//
|
|
26 |
// psTasks.hpp is a collection of GCTasks used by the
|
|
27 |
// parallelScavenge collector.
|
|
28 |
//
|
|
29 |
|
|
30 |
class GCTask;
|
|
31 |
class OopClosure;
|
|
32 |
class OopStack;
|
|
33 |
class ObjectStartArray;
|
|
34 |
class ParallelTaskTerminator;
|
|
35 |
class MutableSpace;
|
|
36 |
class PSOldGen;
|
|
37 |
class Thread;
|
|
38 |
class VMThread;
|
|
39 |
|
|
40 |
//
|
|
41 |
// ScavengeRootsTask
|
|
42 |
//
|
|
43 |
// This task scans all the roots of a given type.
|
|
44 |
//
|
|
45 |
//
|
|
46 |
|
|
47 |
class ScavengeRootsTask : public GCTask {
|
|
48 |
public:
|
|
49 |
enum RootType {
|
|
50 |
universe = 1,
|
|
51 |
jni_handles = 2,
|
|
52 |
threads = 3,
|
|
53 |
object_synchronizer = 4,
|
|
54 |
flat_profiler = 5,
|
|
55 |
system_dictionary = 6,
|
|
56 |
management = 7,
|
|
57 |
jvmti = 8
|
|
58 |
};
|
|
59 |
private:
|
|
60 |
RootType _root_type;
|
|
61 |
public:
|
|
62 |
ScavengeRootsTask(RootType value) : _root_type(value) {}
|
|
63 |
|
|
64 |
char* name() { return (char *)"scavenge-roots-task"; }
|
|
65 |
|
|
66 |
virtual void do_it(GCTaskManager* manager, uint which);
|
|
67 |
};
|
|
68 |
|
|
69 |
//
|
|
70 |
// ThreadRootsTask
|
|
71 |
//
|
|
72 |
// This task scans the roots of a single thread. This task
|
|
73 |
// enables scanning of thread roots in parallel.
|
|
74 |
//
|
|
75 |
|
|
76 |
class ThreadRootsTask : public GCTask {
|
|
77 |
private:
|
|
78 |
JavaThread* _java_thread;
|
|
79 |
VMThread* _vm_thread;
|
|
80 |
public:
|
|
81 |
ThreadRootsTask(JavaThread* root) : _java_thread(root), _vm_thread(NULL) {}
|
|
82 |
ThreadRootsTask(VMThread* root) : _java_thread(NULL), _vm_thread(root) {}
|
|
83 |
|
|
84 |
char* name() { return (char *)"thread-roots-task"; }
|
|
85 |
|
|
86 |
virtual void do_it(GCTaskManager* manager, uint which);
|
|
87 |
};
|
|
88 |
|
|
89 |
//
|
|
90 |
// StealTask
|
|
91 |
//
|
|
92 |
// This task is used to distribute work to idle threads.
|
|
93 |
//
|
|
94 |
|
|
95 |
class StealTask : public GCTask {
|
|
96 |
private:
|
|
97 |
ParallelTaskTerminator* const _terminator;
|
|
98 |
public:
|
|
99 |
char* name() { return (char *)"steal-task"; }
|
|
100 |
|
|
101 |
StealTask(ParallelTaskTerminator* t);
|
|
102 |
|
|
103 |
ParallelTaskTerminator* terminator() { return _terminator; }
|
|
104 |
|
|
105 |
virtual void do_it(GCTaskManager* manager, uint which);
|
|
106 |
};
|
|
107 |
|
|
108 |
//
|
|
109 |
// SerialOldToYoungRootsTask
|
|
110 |
//
|
|
111 |
// This task is used to scan for roots in the perm gen
|
|
112 |
|
|
113 |
class SerialOldToYoungRootsTask : public GCTask {
|
|
114 |
private:
|
|
115 |
PSOldGen* _gen;
|
|
116 |
HeapWord* _gen_top;
|
|
117 |
|
|
118 |
public:
|
|
119 |
SerialOldToYoungRootsTask(PSOldGen *gen, HeapWord* gen_top) :
|
|
120 |
_gen(gen), _gen_top(gen_top) { }
|
|
121 |
|
|
122 |
char* name() { return (char *)"serial-old-to-young-roots-task"; }
|
|
123 |
|
|
124 |
virtual void do_it(GCTaskManager* manager, uint which);
|
|
125 |
};
|
|
126 |
|
|
127 |
//
|
|
128 |
// OldToYoungRootsTask
|
|
129 |
//
|
|
130 |
// This task is used to scan old to young roots in parallel
|
|
131 |
|
|
132 |
class OldToYoungRootsTask : public GCTask {
|
|
133 |
private:
|
|
134 |
PSOldGen* _gen;
|
|
135 |
HeapWord* _gen_top;
|
|
136 |
uint _stripe_number;
|
|
137 |
|
|
138 |
public:
|
|
139 |
OldToYoungRootsTask(PSOldGen *gen, HeapWord* gen_top, uint stripe_number) :
|
|
140 |
_gen(gen), _gen_top(gen_top), _stripe_number(stripe_number) { }
|
|
141 |
|
|
142 |
char* name() { return (char *)"old-to-young-roots-task"; }
|
|
143 |
|
|
144 |
virtual void do_it(GCTaskManager* manager, uint which);
|
|
145 |
};
|