src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 59296 9186be5c78ba
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     1
/*
54058
be40860e8227 8220444: Shenandoah should use parallel version of WeakProcessor in root processor for weak roots
zgu
parents: 53244
diff changeset
     2
 * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     3
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     6
 * published by the Free Software Foundation.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     7
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    12
 * accompanied this code).
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    13
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    17
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    20
 * questions.
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    21
 *
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    22
 */
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    23
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    24
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
    25
#define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    26
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    27
#include "code/codeCache.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    28
#include "gc/shared/oopStorageParState.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    29
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    30
#include "gc/shenandoah/shenandoahHeap.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    31
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    32
#include "gc/shenandoah/shenandoahSharedVariables.hpp"
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    33
#include "memory/iterator.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    34
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    35
class ShenandoahSerialRoot {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    36
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    37
  typedef void (*OopsDo)(OopClosure*);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    38
private:
55547
c7a7728eeddc 8227101: Shenandoah: Use ShenandoahSharedFlag for claimed flag in ShenandoahSerialRoot
zgu
parents: 55477
diff changeset
    39
  ShenandoahSharedFlag                      _claimed;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    40
  const OopsDo                              _oops_do;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    41
  const ShenandoahPhaseTimings::GCParPhases _phase;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    42
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    43
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    44
  ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    45
  void oops_do(OopClosure* cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    46
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    47
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    48
class ShenandoahSerialRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    49
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    50
  ShenandoahSerialRoot  _universe_root;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    51
  ShenandoahSerialRoot  _object_synchronizer_root;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    52
  ShenandoahSerialRoot  _management_root;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    53
  ShenandoahSerialRoot  _system_dictionary_root;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    54
  ShenandoahSerialRoot  _jvmti_root;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    55
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    56
  ShenandoahSerialRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    57
  void oops_do(OopClosure* cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    58
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    59
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    60
class ShenandoahWeakSerialRoot {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    61
  typedef void (*WeakOopsDo)(BoolObjectClosure*, OopClosure*);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    62
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    63
  ShenandoahSharedFlag                      _claimed;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    64
  const WeakOopsDo                          _weak_oops_do;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    65
  const ShenandoahPhaseTimings::GCParPhases _phase;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    66
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    67
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    68
  ShenandoahWeakSerialRoot(WeakOopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    69
  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    70
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    71
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    72
#if INCLUDE_JVMTI
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    73
class ShenandoahJVMTIWeakRoot : public ShenandoahWeakSerialRoot {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    74
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    75
  ShenandoahJVMTIWeakRoot();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    76
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    77
#endif // INCLUDE_JVMTI
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    78
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    79
#if INCLUDE_JFR
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    80
class ShenandoahJFRWeakRoot : public ShenandoahWeakSerialRoot {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    81
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    82
  ShenandoahJFRWeakRoot();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    83
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    84
#endif // INCLUDE_JFR
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    85
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    86
class ShenandoahSerialWeakRoots {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    87
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    88
  JVMTI_ONLY(ShenandoahJVMTIWeakRoot _jvmti_weak_roots;)
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    89
  JFR_ONLY(ShenandoahJFRWeakRoot     _jfr_weak_roots;)
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    90
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    91
  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    92
  void weak_oops_do(OopClosure* cl, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    93
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    94
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    95
template <bool CONCURRENT>
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
    96
class ShenandoahVMRoot {
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    97
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    98
  OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    99
  const ShenandoahPhaseTimings::GCParPhases _phase;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   100
public:
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   101
  ShenandoahVMRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   102
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   103
  template <typename Closure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   104
  void oops_do(Closure* cl, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   105
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   106
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   107
template <bool CONCURRENT>
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   108
class ShenandoahWeakRoot : public ShenandoahVMRoot<CONCURRENT> {
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   109
public:
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   110
  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   111
};
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   112
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   113
template <>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   114
class ShenandoahWeakRoot<false /*concurrent*/> {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   115
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   116
  OopStorage::ParState<false /*concurrent*/, false /*is_const*/> _itr;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   117
  const ShenandoahPhaseTimings::GCParPhases _phase;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   118
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   119
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   120
  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   121
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   122
  template <typename IsAliveClosure, typename KeepAliveClosure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   123
  void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   124
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   125
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   126
template <bool CONCURRENT>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   127
class ShenandoahWeakRoots {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   128
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   129
  ShenandoahWeakRoot<CONCURRENT>  _jni_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   130
  ShenandoahWeakRoot<CONCURRENT>  _string_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   131
  ShenandoahWeakRoot<CONCURRENT>  _resolved_method_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   132
  ShenandoahWeakRoot<CONCURRENT>  _vm_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   133
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   134
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   135
  ShenandoahWeakRoots();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   136
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   137
  template <typename Closure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   138
  void oops_do(Closure* cl, uint worker_id = 0);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   139
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   140
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   141
template <>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   142
class ShenandoahWeakRoots<false /*concurrent */> {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   143
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   144
  ShenandoahWeakRoot<false /*concurrent*/>  _jni_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   145
  ShenandoahWeakRoot<false /*concurrent*/>  _string_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   146
  ShenandoahWeakRoot<false /*concurrent*/>  _resolved_method_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   147
  ShenandoahWeakRoot<false /*concurrent*/>  _vm_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   148
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   149
  ShenandoahWeakRoots();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   150
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   151
  template <typename Closure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   152
  void oops_do(Closure* cl, uint worker_id = 0);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   153
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   154
  template <typename IsAliveClosure, typename KeepAliveClosure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   155
  void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   156
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   157
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   158
template <bool CONCURRENT>
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   159
class ShenandoahVMRoots {
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   160
private:
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   161
  ShenandoahVMRoot<CONCURRENT>    _jni_handle_roots;
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   162
  ShenandoahVMRoot<CONCURRENT>    _vm_global_roots;
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   163
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   164
public:
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   165
  ShenandoahVMRoots();
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   166
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   167
  template <typename T>
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   168
  void oops_do(T* cl, uint worker_id = 0);
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   169
};
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   170
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   171
class ShenandoahThreadRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   172
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   173
  const bool _is_par;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   174
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   175
  ShenandoahThreadRoots(bool is_par);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   176
  ~ShenandoahThreadRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   177
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   178
  void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   179
  void threads_do(ThreadClosure* tc, uint worker_id);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   180
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   181
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   182
class ShenandoahStringDedupRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   183
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   184
  ShenandoahStringDedupRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   185
  ~ShenandoahStringDedupRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   186
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   187
  void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   188
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   189
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   190
template <typename ITR>
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   191
class ShenandoahCodeCacheRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   192
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   193
  ITR _coderoots_iterator;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   194
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   195
  ShenandoahCodeCacheRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   196
  ~ShenandoahCodeCacheRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   197
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   198
  void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   199
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   200
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   201
template <bool CONCURRENT, bool SINGLE_THREADED>
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   202
class ShenandoahClassLoaderDataRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   203
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   204
  ShenandoahClassLoaderDataRoots();
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   205
  ~ShenandoahClassLoaderDataRoots();
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   206
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   207
  void always_strong_cld_do(CLDClosure* clds, uint worker_id = 0);
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   208
  void cld_do(CLDClosure* clds, uint worker_id = 0);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   209
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   210
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   211
class ShenandoahRootProcessor : public StackObj {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   212
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   213
  ShenandoahHeap* const               _heap;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   214
  const ShenandoahPhaseTimings::Phase _phase;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   215
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   216
  ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   217
  ~ShenandoahRootProcessor();
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   218
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   219
  ShenandoahHeap* heap() const { return _heap; }
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   220
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   221
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   222
template <typename ITR>
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   223
class ShenandoahRootScanner : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   224
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   225
  ShenandoahSerialRoots                                     _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   226
  ShenandoahThreadRoots                                     _thread_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   227
  ShenandoahCodeCacheRoots<ITR>                             _code_roots;
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   228
  ShenandoahVMRoots<false /*concurrent*/ >                  _vm_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   229
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   230
                                                            _cld_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   231
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   232
  ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   233
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   234
  // Apply oops, clds and blobs to all strongly reachable roots in the system,
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   235
  // during class unloading cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   236
  void strong_roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   237
  void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
54338
7a34a3270270 8221435: Shenandoah should not mark through weak roots
zgu
parents: 54103
diff changeset
   238
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   239
  // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   240
  // roots when class unloading is disabled during this cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   241
  void roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   242
  void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   243
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   244
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   245
typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   246
typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   247
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   248
// This scanner is only for SH::object_iteration() and only supports single-threaded
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   249
// root scanning
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   250
class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   251
private:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   252
  ShenandoahSerialRoots                                    _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   253
  ShenandoahThreadRoots                                    _thread_roots;
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   254
  ShenandoahVMRoots<false /*concurrent*/>                  _vm_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   255
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, true /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   256
                                                           _cld_roots;
58233
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   257
  ShenandoahSerialWeakRoots                                _serial_weak_roots;
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   258
  ShenandoahWeakRoots<false /*concurrent*/>                _weak_roots;
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   259
  ShenandoahStringDedupRoots                               _dedup_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   260
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   261
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   262
public:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   263
  ShenandoahHeapIterationRootScanner();
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   264
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   265
  void roots_do(OopClosure* cl);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   266
  void strong_roots_do(OopClosure* cl);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   267
};
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   268
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   269
// Evacuate all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   270
class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   271
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   272
  ShenandoahSerialRoots                                     _serial_roots;
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   273
  ShenandoahVMRoots<false /*concurrent*/>                   _vm_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   274
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   275
                                                            _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   276
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   277
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   278
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   279
  ShenandoahStringDedupRoots                                _dedup_roots;
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 58686
diff changeset
   280
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   281
  bool                                                      _include_concurrent_roots;
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 58686
diff changeset
   282
  bool                                                      _include_concurrent_code_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   283
public:
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 58686
diff changeset
   284
  ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase,
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 58686
diff changeset
   285
                          bool include_concurrent_roots, bool _include_concurrent_code_roots);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   286
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   287
  void roots_do(uint worker_id, OopClosure* oops);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   288
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   289
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   290
// Update all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   291
class ShenandoahRootUpdater : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   292
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   293
  ShenandoahSerialRoots                                     _serial_roots;
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   294
  ShenandoahVMRoots<false /*concurrent*/>                   _vm_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   295
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   296
                                                            _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   297
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   298
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   299
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   300
  ShenandoahStringDedupRoots                                _dedup_roots;
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents: 58686
diff changeset
   301
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   302
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   303
public:
57732
23e13076e102 8229474: Shenandoah: Cleanup CM::update_roots()
zgu
parents: 57669
diff changeset
   304
  ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   305
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   306
  template<typename IsAlive, typename KeepAlive>
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   307
  void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   308
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   309
  void strong_roots_do(uint worker_id, OopClosure* oops_cl);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   310
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   311
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   312
// Adjuster all roots at a safepoint during full gc
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   313
class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   314
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   315
  ShenandoahSerialRoots                                     _serial_roots;
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55547
diff changeset
   316
  ShenandoahVMRoots<false /*concurrent*/>                   _vm_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   317
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   318
                                                            _cld_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   319
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   320
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   321
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   322
  ShenandoahStringDedupRoots                                _dedup_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   323
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   324
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   325
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   326
  ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   327
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   328
  void roots_do(uint worker_id, OopClosure* oops);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   329
};
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   330
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
   331
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP