src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp
author zgu
Tue, 02 Jul 2019 10:21:23 -0400
changeset 55547 c7a7728eeddc
parent 55477 c396e381cfa4
child 57669 18f189e69b29
permissions -rw-r--r--
8227101: Shenandoah: Use ShenandoahSharedFlag for claimed flag in ShenandoahSerialRoot Reviewed-by: shade
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>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    96
class ShenandoahWeakRoot {
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:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   101
  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
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
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   107
template <>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   108
class ShenandoahWeakRoot<false /*concurrent*/> {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   109
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   110
  OopStorage::ParState<false /*concurrent*/, false /*is_const*/> _itr;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   111
  const ShenandoahPhaseTimings::GCParPhases _phase;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   112
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   113
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   114
  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   115
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   116
  template <typename IsAliveClosure, typename KeepAliveClosure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   117
  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
   118
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   119
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   120
template <bool CONCURRENT>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   121
class ShenandoahWeakRoots {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   122
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   123
  ShenandoahWeakRoot<CONCURRENT>  _jni_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   124
  ShenandoahWeakRoot<CONCURRENT>  _string_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   125
  ShenandoahWeakRoot<CONCURRENT>  _resolved_method_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   126
  ShenandoahWeakRoot<CONCURRENT>  _vm_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   127
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   128
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   129
  ShenandoahWeakRoots();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   130
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   131
  template <typename Closure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   132
  void oops_do(Closure* cl, uint worker_id = 0);
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
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   135
template <>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   136
class ShenandoahWeakRoots<false /*concurrent */> {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   137
private:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   138
  ShenandoahWeakRoot<false /*concurrent*/>  _jni_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   139
  ShenandoahWeakRoot<false /*concurrent*/>  _string_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   140
  ShenandoahWeakRoot<false /*concurrent*/>  _resolved_method_table_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   141
  ShenandoahWeakRoot<false /*concurrent*/>  _vm_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   142
public:
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   143
  ShenandoahWeakRoots();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   144
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   145
  template <typename Closure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   146
  void oops_do(Closure* cl, uint worker_id = 0);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   147
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   148
  template <typename IsAliveClosure, typename KeepAliveClosure>
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   149
  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
   150
};
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   151
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   152
template <bool CONCURRENT>
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   153
class ShenandoahJNIHandleRoots {
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   154
private:
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   155
  OopStorage::ParState<CONCURRENT, false /*is_const*/> _itr;
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   156
public:
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   157
  ShenandoahJNIHandleRoots();
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   158
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   159
  template <typename T>
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   160
  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
   161
};
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55121
diff changeset
   162
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   163
class ShenandoahThreadRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   164
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   165
  const bool _is_par;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   166
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   167
  ShenandoahThreadRoots(bool is_par);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   168
  ~ShenandoahThreadRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   169
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   170
  void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   171
  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
   172
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   173
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   174
class ShenandoahStringDedupRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   175
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   176
  ShenandoahStringDedupRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   177
  ~ShenandoahStringDedupRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   178
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   179
  void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   180
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   181
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   182
template <typename ITR>
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   183
class ShenandoahCodeCacheRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   184
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   185
  ITR _coderoots_iterator;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   186
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   187
  ShenandoahCodeCacheRoots();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   188
  ~ShenandoahCodeCacheRoots();
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
  void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   191
};
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   192
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   193
template <bool CONCURRENT, bool SINGLE_THREADED>
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   194
class ShenandoahClassLoaderDataRoots {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   195
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   196
  ShenandoahClassLoaderDataRoots();
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   197
  ~ShenandoahClassLoaderDataRoots();
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   198
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   199
  void always_strong_cld_do(CLDClosure* clds, uint worker_id = 0);
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   200
  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
   201
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   202
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   203
class ShenandoahRootProcessor : public StackObj {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   204
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   205
  ShenandoahHeap* const               _heap;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   206
  const ShenandoahPhaseTimings::Phase _phase;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   207
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   208
  ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   209
  ~ShenandoahRootProcessor();
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   210
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   211
  ShenandoahHeap* heap() const { return _heap; }
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   212
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   213
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   214
template <typename ITR>
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   215
class ShenandoahRootScanner : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   216
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   217
  ShenandoahSerialRoots                                     _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   218
  ShenandoahThreadRoots                                     _thread_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   219
  ShenandoahCodeCacheRoots<ITR>                             _code_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   220
  ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   221
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   222
                                                            _cld_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   223
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   224
  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
   225
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   226
  // 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
   227
  // during class unloading cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   228
  void strong_roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   229
  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
   230
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   231
  // 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
   232
  // roots when class unloading is disabled during this cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   233
  void roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   234
  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
   235
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   236
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   237
typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   238
typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   239
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   240
// 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
   241
// root scanning
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   242
class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   243
private:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   244
  ShenandoahSerialRoots                                    _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   245
  ShenandoahThreadRoots                                    _thread_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   246
  ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   247
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, true /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   248
                                                           _cld_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   249
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   250
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   251
public:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   252
  ShenandoahHeapIterationRootScanner();
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   253
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   254
  void roots_do(OopClosure* cl);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   255
  void strong_roots_do(OopClosure* cl);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   256
};
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   257
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   258
// Evacuate all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   259
class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   260
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   261
  ShenandoahSerialRoots                                     _serial_roots;
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   262
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   263
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   264
                                                            _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   265
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   266
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   267
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   268
  ShenandoahStringDedupRoots                                _dedup_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   269
  ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   270
  bool                                                      _include_concurrent_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   271
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   272
public:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   273
  ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   274
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   275
  void roots_do(uint worker_id, OopClosure* oops);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   276
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   277
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   278
// Update all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   279
class ShenandoahRootUpdater : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   280
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   281
  ShenandoahSerialRoots                                     _serial_roots;
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   282
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   283
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   284
                                                            _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   285
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   286
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   287
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   288
  ShenandoahStringDedupRoots                                _dedup_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   289
  ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   290
  const bool                                                _update_code_cache;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   291
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   292
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   293
  ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   294
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   295
  template<typename IsAlive, typename KeepAlive>
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   296
  void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   297
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   298
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   299
// Adjuster all roots at a safepoint during full gc
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   300
class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   301
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   302
  ShenandoahSerialRoots                                     _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   303
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   304
  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   305
                                                            _cld_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   306
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   307
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   308
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   309
  ShenandoahStringDedupRoots                                _dedup_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   310
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
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
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   313
  ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   314
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   315
  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
   316
};
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   317
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
   318
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP