src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp

Thu, 21 Oct 2010 11:55:10 -0700

author
never
date
Thu, 21 Oct 2010 11:55:10 -0700
changeset 2262
1e9a9d2e6509
parent 2188
8b10f48633dc
child 2314
f95d63e2154a
permissions
-rw-r--r--

6970683: improvements to hs_err output
Reviewed-by: kvn, jrose, dholmes, coleenp

duke@435 1 /*
jmasa@2188 2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25
duke@435 26 // Tasks for parallel compaction of the old generation
duke@435 27 //
duke@435 28 // Tasks are created and enqueued on a task queue. The
duke@435 29 // tasks for parallel old collector for marking objects
duke@435 30 // are MarkFromRootsTask and ThreadRootsMarkingTask.
duke@435 31 //
duke@435 32 // MarkFromRootsTask's are created
duke@435 33 // with a root group (e.g., jni_handles) and when the do_it()
duke@435 34 // method of a MarkFromRootsTask is executed, it starts marking
duke@435 35 // form it's root group.
duke@435 36 //
duke@435 37 // ThreadRootsMarkingTask's are created for each Java thread. When
duke@435 38 // the do_it() method of a ThreadRootsMarkingTask is executed, it
duke@435 39 // starts marking from the thread's roots.
duke@435 40 //
duke@435 41 // The enqueuing of the MarkFromRootsTask and ThreadRootsMarkingTask
duke@435 42 // do little more than create the task and put it on a queue. The
duke@435 43 // queue is a GCTaskQueue and threads steal tasks from this GCTaskQueue.
duke@435 44 //
duke@435 45 // In addition to the MarkFromRootsTask and ThreadRootsMarkingTask
duke@435 46 // tasks there are StealMarkingTask tasks. The StealMarkingTask's
duke@435 47 // steal a reference from the marking stack of another
duke@435 48 // thread and transitively marks the object of the reference
duke@435 49 // and internal references. After successfully stealing a reference
duke@435 50 // and marking it, the StealMarkingTask drains its marking stack
duke@435 51 // stack before attempting another steal.
duke@435 52 //
duke@435 53 // ThreadRootsMarkingTask
duke@435 54 //
duke@435 55 // This task marks from the roots of a single thread. This task
duke@435 56 // enables marking of thread roots in parallel.
duke@435 57 //
duke@435 58
duke@435 59 class ParallelTaskTerminator;
duke@435 60
duke@435 61 class ThreadRootsMarkingTask : public GCTask {
duke@435 62 private:
duke@435 63 JavaThread* _java_thread;
duke@435 64 VMThread* _vm_thread;
duke@435 65 public:
duke@435 66 ThreadRootsMarkingTask(JavaThread* root) : _java_thread(root), _vm_thread(NULL) {}
duke@435 67 ThreadRootsMarkingTask(VMThread* root) : _java_thread(NULL), _vm_thread(root) {}
duke@435 68
duke@435 69 char* name() { return (char *)"thread-roots-marking-task"; }
duke@435 70
duke@435 71 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 72 };
duke@435 73
duke@435 74
duke@435 75 //
duke@435 76 // MarkFromRootsTask
duke@435 77 //
duke@435 78 // This task marks from all the roots to all live
duke@435 79 // objects.
duke@435 80 //
duke@435 81 //
duke@435 82
duke@435 83 class MarkFromRootsTask : public GCTask {
duke@435 84 public:
duke@435 85 enum RootType {
duke@435 86 universe = 1,
duke@435 87 jni_handles = 2,
duke@435 88 threads = 3,
duke@435 89 object_synchronizer = 4,
duke@435 90 flat_profiler = 5,
duke@435 91 management = 6,
duke@435 92 jvmti = 7,
duke@435 93 system_dictionary = 8,
duke@435 94 vm_symbols = 9,
jrose@1424 95 reference_processing = 10,
jrose@1424 96 code_cache = 11
duke@435 97 };
duke@435 98 private:
duke@435 99 RootType _root_type;
duke@435 100 public:
duke@435 101 MarkFromRootsTask(RootType value) : _root_type(value) {}
duke@435 102
duke@435 103 char* name() { return (char *)"mark-from-roots-task"; }
duke@435 104
duke@435 105 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 106 };
duke@435 107
duke@435 108 //
duke@435 109 // RefProcTaskProxy
duke@435 110 //
duke@435 111 // This task is used as a proxy to parallel reference processing tasks .
duke@435 112 //
duke@435 113
duke@435 114 class RefProcTaskProxy : public GCTask {
duke@435 115 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
duke@435 116 ProcessTask & _rp_task;
duke@435 117 uint _work_id;
duke@435 118 public:
duke@435 119 RefProcTaskProxy(ProcessTask & rp_task, uint work_id)
duke@435 120 : _rp_task(rp_task),
duke@435 121 _work_id(work_id)
duke@435 122 { }
duke@435 123
duke@435 124 private:
duke@435 125 virtual char* name() { return (char *)"Process referents by policy in parallel"; }
duke@435 126
duke@435 127 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 128 };
duke@435 129
duke@435 130
duke@435 131
duke@435 132 //
duke@435 133 // RefEnqueueTaskProxy
duke@435 134 //
duke@435 135 // This task is used as a proxy to parallel reference processing tasks .
duke@435 136 //
duke@435 137
duke@435 138 class RefEnqueueTaskProxy: public GCTask {
duke@435 139 typedef AbstractRefProcTaskExecutor::EnqueueTask EnqueueTask;
duke@435 140 EnqueueTask& _enq_task;
duke@435 141 uint _work_id;
duke@435 142
duke@435 143 public:
duke@435 144 RefEnqueueTaskProxy(EnqueueTask& enq_task, uint work_id)
duke@435 145 : _enq_task(enq_task),
duke@435 146 _work_id(work_id)
duke@435 147 { }
duke@435 148
duke@435 149 virtual char* name() { return (char *)"Enqueue reference objects in parallel"; }
duke@435 150 virtual void do_it(GCTaskManager* manager, uint which)
duke@435 151 {
duke@435 152 _enq_task.work(_work_id);
duke@435 153 }
duke@435 154 };
duke@435 155
duke@435 156
duke@435 157 //
duke@435 158 // RefProcTaskExecutor
duke@435 159 //
duke@435 160 // Task executor is an interface for the reference processor to run
duke@435 161 // tasks using GCTaskManager.
duke@435 162 //
duke@435 163
duke@435 164 class RefProcTaskExecutor: public AbstractRefProcTaskExecutor {
duke@435 165 virtual void execute(ProcessTask& task);
duke@435 166 virtual void execute(EnqueueTask& task);
duke@435 167 };
duke@435 168
duke@435 169
duke@435 170 //
duke@435 171 // StealMarkingTask
duke@435 172 //
duke@435 173 // This task is used to distribute work to idle threads.
duke@435 174 //
duke@435 175
duke@435 176 class StealMarkingTask : public GCTask {
duke@435 177 private:
duke@435 178 ParallelTaskTerminator* const _terminator;
duke@435 179 private:
duke@435 180
duke@435 181 public:
duke@435 182 char* name() { return (char *)"steal-marking-task"; }
duke@435 183
duke@435 184 StealMarkingTask(ParallelTaskTerminator* t);
duke@435 185
duke@435 186 ParallelTaskTerminator* terminator() { return _terminator; }
duke@435 187
duke@435 188 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 189 };
duke@435 190
duke@435 191 //
jcoomes@810 192 // StealRegionCompactionTask
duke@435 193 //
duke@435 194 // This task is used to distribute work to idle threads.
duke@435 195 //
duke@435 196
jcoomes@810 197 class StealRegionCompactionTask : public GCTask {
duke@435 198 private:
duke@435 199 ParallelTaskTerminator* const _terminator;
duke@435 200 public:
jcoomes@810 201 StealRegionCompactionTask(ParallelTaskTerminator* t);
duke@435 202
jcoomes@810 203 char* name() { return (char *)"steal-region-task"; }
duke@435 204 ParallelTaskTerminator* terminator() { return _terminator; }
duke@435 205
duke@435 206 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 207 };
duke@435 208
duke@435 209 //
duke@435 210 // UpdateDensePrefixTask
duke@435 211 //
duke@435 212 // This task is used to update the dense prefix
duke@435 213 // of a space.
duke@435 214 //
duke@435 215
duke@435 216 class UpdateDensePrefixTask : public GCTask {
duke@435 217 private:
duke@435 218 PSParallelCompact::SpaceId _space_id;
jcoomes@810 219 size_t _region_index_start;
jcoomes@810 220 size_t _region_index_end;
duke@435 221
duke@435 222 public:
duke@435 223 char* name() { return (char *)"update-dense_prefix-task"; }
duke@435 224
duke@435 225 UpdateDensePrefixTask(PSParallelCompact::SpaceId space_id,
jcoomes@810 226 size_t region_index_start,
jcoomes@810 227 size_t region_index_end);
duke@435 228
duke@435 229 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 230 };
duke@435 231
duke@435 232 //
duke@435 233 // DrainStacksCompactionTask
duke@435 234 //
jcoomes@810 235 // This task processes regions that have been added to the stacks of each
duke@435 236 // compaction manager.
duke@435 237 //
duke@435 238 // Trying to use one draining thread does not work because there are no
duke@435 239 // guarantees about which task will be picked up by which thread. For example,
jcoomes@810 240 // if thread A gets all the preloaded regions, thread A may not get a draining
duke@435 241 // task (they may all be done by other threads).
duke@435 242 //
duke@435 243
duke@435 244 class DrainStacksCompactionTask : public GCTask {
jmasa@2188 245 uint _stack_index;
jmasa@2188 246 uint stack_index() { return _stack_index; }
duke@435 247 public:
jmasa@2188 248 DrainStacksCompactionTask(uint stack_index) : GCTask(),
jmasa@2188 249 _stack_index(stack_index) {};
jcoomes@810 250 char* name() { return (char *)"drain-region-task"; }
duke@435 251 virtual void do_it(GCTaskManager* manager, uint which);
duke@435 252 };

mercurial