Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp @ 21598:05ecef0a6a24
LinearScanLifetimeAnalysisPhase: special case StackStoreOp.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 28 May 2015 13:07:25 +0200 |
parents | 89152779163c |
children |
rev | line source |
---|---|
0 | 1 /* |
17524 | 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSTASKS_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSTASKS_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "utilities/growableArray.hpp" | |
30 | |
0 | 31 // |
32 // psTasks.hpp is a collection of GCTasks used by the | |
33 // parallelScavenge collector. | |
34 // | |
35 | |
36 class GCTask; | |
37 class OopClosure; | |
38 class OopStack; | |
39 class ObjectStartArray; | |
40 class ParallelTaskTerminator; | |
41 class MutableSpace; | |
42 class PSOldGen; | |
43 class Thread; | |
44 class VMThread; | |
45 | |
46 // | |
47 // ScavengeRootsTask | |
48 // | |
49 // This task scans all the roots of a given type. | |
50 // | |
51 // | |
52 | |
53 class ScavengeRootsTask : public GCTask { | |
54 public: | |
55 enum RootType { | |
56 universe = 1, | |
57 jni_handles = 2, | |
58 threads = 3, | |
59 object_synchronizer = 4, | |
60 flat_profiler = 5, | |
61 system_dictionary = 6, | |
10361
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
6817
diff
changeset
|
62 class_loader_data = 7, |
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
6817
diff
changeset
|
63 management = 8, |
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
6817
diff
changeset
|
64 jvmti = 9, |
eda078b01c65
8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents:
6817
diff
changeset
|
65 code_cache = 10 |
0 | 66 }; |
67 private: | |
68 RootType _root_type; | |
69 public: | |
70 ScavengeRootsTask(RootType value) : _root_type(value) {} | |
71 | |
72 char* name() { return (char *)"scavenge-roots-task"; } | |
73 | |
74 virtual void do_it(GCTaskManager* manager, uint which); | |
75 }; | |
76 | |
77 // | |
78 // ThreadRootsTask | |
79 // | |
80 // This task scans the roots of a single thread. This task | |
81 // enables scanning of thread roots in parallel. | |
82 // | |
83 | |
84 class ThreadRootsTask : public GCTask { | |
85 private: | |
86 JavaThread* _java_thread; | |
87 VMThread* _vm_thread; | |
88 public: | |
89 ThreadRootsTask(JavaThread* root) : _java_thread(root), _vm_thread(NULL) {} | |
90 ThreadRootsTask(VMThread* root) : _java_thread(NULL), _vm_thread(root) {} | |
91 | |
92 char* name() { return (char *)"thread-roots-task"; } | |
93 | |
94 virtual void do_it(GCTaskManager* manager, uint which); | |
95 }; | |
96 | |
97 // | |
98 // StealTask | |
99 // | |
100 // This task is used to distribute work to idle threads. | |
101 // | |
102 | |
103 class StealTask : public GCTask { | |
104 private: | |
105 ParallelTaskTerminator* const _terminator; | |
106 public: | |
107 char* name() { return (char *)"steal-task"; } | |
108 | |
109 StealTask(ParallelTaskTerminator* t); | |
110 | |
111 ParallelTaskTerminator* terminator() { return _terminator; } | |
112 | |
113 virtual void do_it(GCTaskManager* manager, uint which); | |
114 }; | |
115 | |
116 // | |
117 // OldToYoungRootsTask | |
118 // | |
119 // This task is used to scan old to young roots in parallel | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
120 // |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
121 // A GC thread executing this tasks divides the generation (old gen) |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
122 // into slices and takes a stripe in the slice as its part of the |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
123 // work. |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
124 // |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
125 // +===============+ slice 0 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
126 // | stripe 0 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
127 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
128 // | stripe 1 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
129 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
130 // | stripe 2 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
131 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
132 // | stripe 3 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
133 // +===============+ slice 1 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
134 // | stripe 0 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
135 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
136 // | stripe 1 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
137 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
138 // | stripe 2 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
139 // +---------------+ |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
140 // | stripe 3 | |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
141 // +===============+ slice 2 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
142 // ... |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
143 // |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
144 // A task is created for each stripe. In this case there are 4 tasks |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
145 // created. A GC thread first works on its stripe within slice 0 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
146 // and then moves to its stripe in the next slice until all stripes |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
147 // exceed the top of the generation. Note that having fewer GC threads |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
148 // than stripes works because all the tasks are executed so all stripes |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
149 // will be covered. In this example if 4 tasks have been created to cover |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
150 // all the stripes and there are only 3 threads, one of the threads will |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
151 // get the tasks with the 4th stripe. However, there is a dependence in |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
152 // CardTableExtension::scavenge_contents_parallel() on the number |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
153 // of tasks created. In scavenge_contents_parallel the distance |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
154 // to the next stripe is calculated based on the number of tasks. |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
155 // If the stripe width is ssize, a task's next stripe is at |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
156 // ssize * number_of_tasks (= slice_stride). In this case after |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
157 // finishing stripe 0 in slice 0, the thread finds the stripe 0 in slice1 |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
158 // by adding slice_stride to the start of stripe 0 in slice 0 to get |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
159 // to the start of stride 0 in slice 1. |
0 | 160 |
161 class OldToYoungRootsTask : public GCTask { | |
162 private: | |
163 PSOldGen* _gen; | |
164 HeapWord* _gen_top; | |
165 uint _stripe_number; | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
166 uint _stripe_total; |
0 | 167 |
168 public: | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
169 OldToYoungRootsTask(PSOldGen *gen, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
170 HeapWord* gen_top, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
171 uint stripe_number, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
172 uint stripe_total) : |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
173 _gen(gen), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
174 _gen_top(gen_top), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
175 _stripe_number(stripe_number), |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
1972
diff
changeset
|
176 _stripe_total(stripe_total) { } |
0 | 177 |
178 char* name() { return (char *)"old-to-young-roots-task"; } | |
179 | |
180 virtual void do_it(GCTaskManager* manager, uint which); | |
181 }; | |
1972 | 182 |
183 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSTASKS_HPP |