author | kbarrett |
Thu, 18 Jul 2019 14:57:32 -0400 | |
changeset 55740 | b3ff56f955c8 |
parent 54669 | ad45b3802d4e |
child 57771 | 50c959cc40e8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50058
diff
changeset
|
2 |
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3908
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3908
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3908
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50058
diff
changeset
|
25 |
#ifndef SHARE_GC_PARALLEL_PSTASKS_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50058
diff
changeset
|
26 |
#define SHARE_GC_PARALLEL_PSTASKS_HPP |
7397 | 27 |
|
28 |
#include "utilities/growableArray.hpp" |
|
29 |
||
1 | 30 |
// |
31 |
// psTasks.hpp is a collection of GCTasks used by the |
|
32 |
// parallelScavenge collector. |
|
33 |
// |
|
34 |
||
35 |
class GCTask; |
|
36 |
class OopClosure; |
|
37 |
class OopStack; |
|
38 |
class ObjectStartArray; |
|
39 |
class ParallelTaskTerminator; |
|
40 |
class MutableSpace; |
|
41 |
class PSOldGen; |
|
42 |
class Thread; |
|
43 |
class VMThread; |
|
44 |
||
45 |
// |
|
46 |
// ScavengeRootsTask |
|
47 |
// |
|
48 |
// This task scans all the roots of a given type. |
|
49 |
// |
|
50 |
// |
|
51 |
||
52 |
class ScavengeRootsTask : public GCTask { |
|
53 |
public: |
|
54 |
enum RootType { |
|
55 |
universe = 1, |
|
56 |
jni_handles = 2, |
|
57 |
threads = 3, |
|
58 |
object_synchronizer = 4, |
|
47106 | 59 |
system_dictionary = 5, |
60 |
class_loader_data = 6, |
|
61 |
management = 7, |
|
62 |
jvmti = 8, |
|
63 |
code_cache = 9 |
|
1 | 64 |
}; |
65 |
private: |
|
66 |
RootType _root_type; |
|
67 |
public: |
|
68 |
ScavengeRootsTask(RootType value) : _root_type(value) {} |
|
69 |
||
70 |
char* name() { return (char *)"scavenge-roots-task"; } |
|
71 |
||
72 |
virtual void do_it(GCTaskManager* manager, uint which); |
|
73 |
}; |
|
74 |
||
75 |
// |
|
76 |
// ThreadRootsTask |
|
77 |
// |
|
78 |
// This task scans the roots of a single thread. This task |
|
79 |
// enables scanning of thread roots in parallel. |
|
80 |
// |
|
81 |
||
82 |
class ThreadRootsTask : public GCTask { |
|
83 |
private: |
|
50058
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
49621
diff
changeset
|
84 |
Thread* _thread; |
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
49621
diff
changeset
|
85 |
|
1 | 86 |
public: |
50058
f7e564cacfbc
8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents:
49621
diff
changeset
|
87 |
ThreadRootsTask(Thread* root) : _thread(root) {} |
1 | 88 |
|
89 |
char* name() { return (char *)"thread-roots-task"; } |
|
90 |
||
91 |
virtual void do_it(GCTaskManager* manager, uint which); |
|
92 |
}; |
|
93 |
||
94 |
// |
|
95 |
// StealTask |
|
96 |
// |
|
97 |
// This task is used to distribute work to idle threads. |
|
98 |
// |
|
99 |
||
100 |
class StealTask : public GCTask { |
|
101 |
private: |
|
102 |
ParallelTaskTerminator* const _terminator; |
|
103 |
public: |
|
104 |
char* name() { return (char *)"steal-task"; } |
|
105 |
||
106 |
StealTask(ParallelTaskTerminator* t); |
|
107 |
||
108 |
ParallelTaskTerminator* terminator() { return _terminator; } |
|
109 |
||
110 |
virtual void do_it(GCTaskManager* manager, uint which); |
|
111 |
}; |
|
112 |
||
113 |
// |
|
114 |
// OldToYoungRootsTask |
|
115 |
// |
|
116 |
// This task is used to scan old to young roots in parallel |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
117 |
// |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
118 |
// A GC thread executing this tasks divides the generation (old gen) |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
119 |
// into slices and takes a stripe in the slice as its part of the |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
120 |
// work. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
121 |
// |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
122 |
// +===============+ slice 0 |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
123 |
// | stripe 0 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
124 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
125 |
// | stripe 1 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
126 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
127 |
// | stripe 2 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
128 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
129 |
// | stripe 3 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
130 |
// +===============+ slice 1 |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
131 |
// | stripe 0 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
132 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
133 |
// | stripe 1 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
134 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
135 |
// | stripe 2 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
136 |
// +---------------+ |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
137 |
// | stripe 3 | |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
138 |
// +===============+ slice 2 |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
139 |
// ... |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
140 |
// |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
141 |
// A task is created for each stripe. In this case there are 4 tasks |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
142 |
// created. A GC thread first works on its stripe within slice 0 |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
143 |
// and then moves to its stripe in the next slice until all stripes |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
144 |
// exceed the top of the generation. Note that having fewer GC threads |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
145 |
// than stripes works because all the tasks are executed so all stripes |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
146 |
// will be covered. In this example if 4 tasks have been created to cover |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
147 |
// all the stripes and there are only 3 threads, one of the threads will |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
148 |
// get the tasks with the 4th stripe. However, there is a dependence in |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47216
diff
changeset
|
149 |
// PSCardTable::scavenge_contents_parallel() on the number |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
150 |
// of tasks created. In scavenge_contents_parallel the distance |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
151 |
// to the next stripe is calculated based on the number of tasks. |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
152 |
// If the stripe width is ssize, a task's next stripe is at |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
153 |
// ssize * number_of_tasks (= slice_stride). In this case after |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
154 |
// finishing stripe 0 in slice 0, the thread finds the stripe 0 in slice1 |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
155 |
// by adding slice_stride to the start of stripe 0 in slice 0 to get |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
156 |
// to the start of stride 0 in slice 1. |
1 | 157 |
|
158 |
class OldToYoungRootsTask : public GCTask { |
|
159 |
private: |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
160 |
PSOldGen* _old_gen; |
1 | 161 |
HeapWord* _gen_top; |
162 |
uint _stripe_number; |
|
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
163 |
uint _stripe_total; |
1 | 164 |
|
165 |
public: |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
166 |
OldToYoungRootsTask(PSOldGen *old_gen, |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
167 |
HeapWord* gen_top, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
168 |
uint stripe_number, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
169 |
uint stripe_total) : |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
30764
diff
changeset
|
170 |
_old_gen(old_gen), |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
171 |
_gen_top(gen_top), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
172 |
_stripe_number(stripe_number), |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
7397
diff
changeset
|
173 |
_stripe_total(stripe_total) { } |
1 | 174 |
|
175 |
char* name() { return (char *)"old-to-young-roots-task"; } |
|
176 |
||
177 |
virtual void do_it(GCTaskManager* manager, uint which); |
|
178 |
}; |
|
7397 | 179 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50058
diff
changeset
|
180 |
#endif // SHARE_GC_PARALLEL_PSTASKS_HPP |