25 #define SHARE_GC_PARALLEL_PSTASKS_HPP
26
27 #include "utilities/growableArray.hpp"
28
29 //
30 // psTasks.hpp is a collection of GCTasks used by the
31 // parallelScavenge collector.
32 //
33
34 class GCTask;
35 class OopClosure;
36 class OopStack;
37 class ObjectStartArray;
38 class ParallelTaskTerminator;
39 class MutableSpace;
40 class PSOldGen;
41 class Thread;
42 class VMThread;
43
44 //
45 // ScavengeRootsTask
46 //
47 // This task scans all the roots of a given type.
48 //
49 //
50
51 class ScavengeRootsTask : public GCTask {
52 public:
53 enum RootType {
54 universe = 1,
55 jni_handles = 2,
56 threads = 3,
57 object_synchronizer = 4,
58 system_dictionary = 5,
59 class_loader_data = 6,
60 management = 7,
61 jvmti = 8,
62 code_cache = 9
63 JVMCI_ONLY(COMMA jvmci = 10)
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:
84 Thread* _thread;
85
86 public:
87 ThreadRootsTask(Thread* root) : _thread(root) {}
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
117 //
118 // A GC thread executing this tasks divides the generation (old gen)
119 // into slices and takes a stripe in the slice as its part of the
120 // work.
121 //
122 // +===============+ slice 0
123 // | stripe 0 |
124 // +---------------+
125 // | stripe 1 |
126 // +---------------+
127 // | stripe 2 |
128 // +---------------+
129 // | stripe 3 |
130 // +===============+ slice 1
131 // | stripe 0 |
132 // +---------------+
133 // | stripe 1 |
134 // +---------------+
135 // | stripe 2 |
136 // +---------------+
137 // | stripe 3 |
138 // +===============+ slice 2
139 // ...
140 //
141 // A task is created for each stripe. In this case there are 4 tasks
142 // created. A GC thread first works on its stripe within slice 0
143 // and then moves to its stripe in the next slice until all stripes
144 // exceed the top of the generation. Note that having fewer GC threads
145 // than stripes works because all the tasks are executed so all stripes
146 // will be covered. In this example if 4 tasks have been created to cover
147 // all the stripes and there are only 3 threads, one of the threads will
148 // get the tasks with the 4th stripe. However, there is a dependence in
149 // PSCardTable::scavenge_contents_parallel() on the number
150 // of tasks created. In scavenge_contents_parallel the distance
151 // to the next stripe is calculated based on the number of tasks.
152 // If the stripe width is ssize, a task's next stripe is at
153 // ssize * number_of_tasks (= slice_stride). In this case after
154 // finishing stripe 0 in slice 0, the thread finds the stripe 0 in slice1
155 // by adding slice_stride to the start of stripe 0 in slice 0 to get
156 // to the start of stride 0 in slice 1.
157
158 class OldToYoungRootsTask : public GCTask {
159 private:
160 PSOldGen* _old_gen;
161 HeapWord* _gen_top;
162 uint _stripe_number;
163 uint _stripe_total;
164
165 public:
166 OldToYoungRootsTask(PSOldGen *old_gen,
167 HeapWord* gen_top,
168 uint stripe_number,
169 uint stripe_total) :
170 _old_gen(old_gen),
171 _gen_top(gen_top),
172 _stripe_number(stripe_number),
173 _stripe_total(stripe_total) { }
174
175 char* name() { return (char *)"old-to-young-roots-task"; }
176
177 virtual void do_it(GCTaskManager* manager, uint which);
178 };
179
180 #endif // SHARE_GC_PARALLEL_PSTASKS_HPP
|
25 #define SHARE_GC_PARALLEL_PSTASKS_HPP
26
27 #include "utilities/growableArray.hpp"
28
29 //
30 // psTasks.hpp is a collection of GCTasks used by the
31 // parallelScavenge collector.
32 //
33
34 class GCTask;
35 class OopClosure;
36 class OopStack;
37 class ObjectStartArray;
38 class ParallelTaskTerminator;
39 class MutableSpace;
40 class PSOldGen;
41 class Thread;
42 class VMThread;
43
44 //
45 // StealTask
46 //
47 // This task is used to distribute work to idle threads.
48 //
49
50 class StealTask : public GCTask {
51 private:
52 ParallelTaskTerminator* const _terminator;
53 public:
54 char* name() { return (char *)"steal-task"; }
55
56 StealTask(ParallelTaskTerminator* t);
57
58 ParallelTaskTerminator* terminator() { return _terminator; }
59
60 virtual void do_it(GCTaskManager* manager, uint which);
61 };
62
63 #endif // SHARE_GC_PARALLEL_PSTASKS_HPP
|