src/hotspot/share/gc/parallel/pcTasks.hpp
author kbarrett
Thu, 18 Jul 2019 14:57:32 -0400
changeset 55740 b3ff56f955c8
parent 54678 93f09ca4a7f8
child 57767 b3e44e1b135d
permissions -rw-r--r--
8227653: Add VM Global OopStorage Summary: Replaced conditional JVMCI global storage with VM global storage. Reviewed-by: tschatzl, lfoltan, kvn
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"
54678
93f09ca4a7f8 8198505: Remove CollectorPolicy and its subclasses
stefank
parents: 54669
diff changeset
    31
#include "gc/shared/referenceProcessor.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6759
diff changeset
    32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// Tasks for parallel compaction of the old generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Tasks are created and enqueued on a task queue. The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// tasks for parallel old collector for marking objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// are MarkFromRootsTask and ThreadRootsMarkingTask.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// MarkFromRootsTask's are created
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// with a root group (e.g., jni_handles) and when the do_it()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// method of a MarkFromRootsTask is executed, it starts marking
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// form it's root group.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// ThreadRootsMarkingTask's are created for each Java thread.  When
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// the do_it() method of a ThreadRootsMarkingTask is executed, it
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// starts marking from the thread's roots.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
    49
// The enqueueing of the MarkFromRootsTask and ThreadRootsMarkingTask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// do little more than create the task and put it on a queue.  The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// queue is a GCTaskQueue and threads steal tasks from this GCTaskQueue.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// In addition to the MarkFromRootsTask and ThreadRootsMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// tasks there are StealMarkingTask tasks.  The StealMarkingTask's
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// steal a reference from the marking stack of another
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// thread and transitively marks the object of the reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// and internal references.  After successfully stealing a reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// and marking it, the StealMarkingTask drains its marking stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// stack before attempting another steal.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// ThreadRootsMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// This task marks from the roots of a single thread. This task
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// enables marking of thread roots in parallel.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
class ParallelTaskTerminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
class ThreadRootsMarkingTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
 private:
50058
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    71
  Thread* _thread;
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    72
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
 public:
50058
f7e564cacfbc 8202649: Move the Parallel GC specific task creation functions out of Threads
stefank
parents: 47216
diff changeset
    74
  ThreadRootsMarkingTask(Thread* root) : _thread(root) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  char* name() { return (char *)"thread-roots-marking-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  virtual void do_it(GCTaskManager* manager, uint which);
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
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// MarkFromRootsTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// This task marks from all the roots to all live
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
// objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
class MarkFromRootsTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  enum RootType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    universe              = 1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    jni_handles           = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    threads               = 3,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    object_synchronizer   = 4,
47106
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    97
    management            = 5,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    98
    jvmti                 = 6,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
    99
    system_dictionary     = 7,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
   100
    class_loader_data     = 8,
bed18a111b90 8173715: Remove FlatProfiler
gziemski
parents: 38250
diff changeset
   101
    code_cache            = 9
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  RootType _root_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  MarkFromRootsTask(RootType value) : _root_type(value) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  char* name() { return (char *)"mark-from-roots-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
// RefProcTaskProxy
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// This task is used as a proxy to parallel reference processing tasks .
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
class RefProcTaskProxy : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  ProcessTask & _rp_task;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  uint          _work_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  RefProcTaskProxy(ProcessTask & rp_task, uint work_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    : _rp_task(rp_task),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      _work_id(work_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  virtual char* name() { return (char *)"Process referents by policy in parallel"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  virtual void do_it(GCTaskManager* manager, uint which);
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
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
// RefProcTaskExecutor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// Task executor is an interface for the reference processor to run
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
// tasks using GCTaskManager.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
class RefProcTaskExecutor: public AbstractRefProcTaskExecutor {
50606
8f1d5d706bdd 8043575: Dynamically parallelize reference processing work
tschatzl
parents: 50071
diff changeset
   144
  virtual void execute(ProcessTask& task, uint ergo_workers);
1
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
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
// StealMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
// This task is used to distribute work to idle threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
class StealMarkingTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
   ParallelTaskTerminator* const _terminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  char* name() { return (char *)"steal-marking-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  StealMarkingTask(ParallelTaskTerminator* t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  ParallelTaskTerminator* terminator() { return _terminator; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
//
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   170
// CompactionWithStealingTask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
// This task is used to distribute work to idle threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   175
class CompactionWithStealingTask : public GCTask {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
   ParallelTaskTerminator* const _terminator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
 public:
38250
37d739fb07fc 8155992: Change name of StealRegionCompactionTask to something that emphasizes the compaction task.
jmasa
parents: 38170
diff changeset
   179
  CompactionWithStealingTask(ParallelTaskTerminator* t);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   181
  char* name() { return (char *)"steal-region-task"; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  ParallelTaskTerminator* terminator() { return _terminator; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
// UpdateDensePrefixTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
// This task is used to update the dense prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// of a space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
class UpdateDensePrefixTask : public GCTask {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  PSParallelCompact::SpaceId _space_id;
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   197
  size_t _region_index_start;
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   198
  size_t _region_index_end;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  char* name() { return (char *)"update-dense_prefix-task"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  UpdateDensePrefixTask(PSParallelCompact::SpaceId space_id,
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   204
                        size_t region_index_start,
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 1
diff changeset
   205
                        size_t region_index_end);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  virtual void do_it(GCTaskManager* manager, uint which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
};
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50606
diff changeset
   209
#endif // SHARE_GC_PARALLEL_PCTASKS_HPP