annotate src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @ 470:ad8c8ca4ab0f

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