src/hotspot/share/gc/parallel/pcTasks.hpp
author lkorinth
Mon, 25 Mar 2019 14:46:55 +0100
changeset 54264 41af8d0546bc
parent 53244 9807daeb47c4
child 54669 ad45b3802d4e
permissions -rw-r--r--
8221260: Initialize more class members on construction, remove some unused ones Reviewed-by: kbarrett, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50606
diff changeset
     2
 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50606
diff changeset
    25
#ifndef SHARE_GC_PARALLEL_PCTASKS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50606
diff changeset
    26
#define SHARE_GC_PARALLEL_PCTASKS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6759
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 22551
diff changeset
    28
#include "gc/parallel/gcTaskManager.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 22551
diff changeset
    29
#include "gc/parallel/psParallelCompact.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 22551
diff changeset
    30
#include "gc/parallel/psTasks.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6759
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// Tasks for parallel compaction of the old generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Tasks are created and enqueued on a task queue. The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// tasks for parallel old collector for marking objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// are MarkFromRootsTask and ThreadRootsMarkingTask.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// MarkFromRootsTask's are created
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// with a root group (e.g., jni_handles) and when the do_it()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// method of a MarkFromRootsTask is executed, it starts marking
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// form it's root group.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// ThreadRootsMarkingTask's are created for each Java thread.  When
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// the do_it() method of a ThreadRootsMarkingTask is executed, it
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// starts marking from the thread's roots.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
    48
// The enqueueing of the MarkFromRootsTask and ThreadRootsMarkingTask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// do little more than create the task and put it on a queue.  The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// queue is a GCTaskQueue and threads steal tasks from this GCTaskQueue.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// In addition to the MarkFromRootsTask and ThreadRootsMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// tasks there are StealMarkingTask tasks.  The StealMarkingTask's
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// steal a reference from the marking stack of another
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// thread and transitively marks the object of the reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// and internal references.  After successfully stealing a reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// and marking it, the StealMarkingTask drains its marking stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// stack before attempting another steal.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// ThreadRootsMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
// This task marks from the roots of a single thread. This task
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// enables marking of thread roots in parallel.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
class ParallelTaskTerminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
class ThreadRootsMarkingTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
 private:
50058
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    70
  Thread* _thread;
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    71
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
 public:
50058
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    73
  ThreadRootsMarkingTask(Thread* root) : _thread(root) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  char* name() { return (char *)"thread-roots-marking-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
// MarkFromRootsTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
// This task marks from all the roots to all live
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
class MarkFromRootsTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  enum RootType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    universe              = 1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    jni_handles           = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    threads               = 3,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    object_synchronizer   = 4,
47106
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    96
    management            = 5,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    97
    jvmti                 = 6,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    98
    system_dictionary     = 7,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    99
    class_loader_data     = 8,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
   100
    code_cache            = 9
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  RootType _root_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  MarkFromRootsTask(RootType value) : _root_type(value) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  char* name() { return (char *)"mark-from-roots-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
// RefProcTaskProxy
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// This task is used as a proxy to parallel reference processing tasks .
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
class RefProcTaskProxy : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  ProcessTask & _rp_task;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  uint          _work_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  RefProcTaskProxy(ProcessTask & rp_task, uint work_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    : _rp_task(rp_task),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      _work_id(work_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  virtual char* name() { return (char *)"Process referents by policy in parallel"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
// RefProcTaskExecutor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// Task executor is an interface for the reference processor to run
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// tasks using GCTaskManager.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
class RefProcTaskExecutor: public AbstractRefProcTaskExecutor {
50606
8f1d5d706bdd 8043575: Dynamically parallelize reference processing work
tschatzl
parents: 50071
diff changeset
   143
  virtual void execute(ProcessTask& task, uint ergo_workers);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
// StealMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// This task is used to distribute work to idle threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
class StealMarkingTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
   ParallelTaskTerminator* const _terminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  char* name() { return (char *)"steal-marking-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  StealMarkingTask(ParallelTaskTerminator* t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  ParallelTaskTerminator* terminator() { return _terminator; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
//
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   169
// CompactionWithStealingTask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
// This task is used to distribute work to idle threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   174
class CompactionWithStealingTask : public GCTask {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
   ParallelTaskTerminator* const _terminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
 public:
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   178
  CompactionWithStealingTask(ParallelTaskTerminator* t);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   180
  char* name() { return (char *)"steal-region-task"; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  ParallelTaskTerminator* terminator() { return _terminator; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
// UpdateDensePrefixTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
// This task is used to update the dense prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
// of a space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
class UpdateDensePrefixTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  PSParallelCompact::SpaceId _space_id;
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   196
  size_t _region_index_start;
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   197
  size_t _region_index_end;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  char* name() { return (char *)"update-dense_prefix-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  UpdateDensePrefixTask(PSParallelCompact::SpaceId space_id,
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   203
                        size_t region_index_start,
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   204
                        size_t region_index_end);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
};
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50606
diff changeset
   208
#endif // SHARE_GC_PARALLEL_PCTASKS_HPP