src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp
author zgu
Mon, 24 Jun 2019 11:46:46 -0400
changeset 55476 aee0d296c0ef
parent 55450 79a7fc6c9bc7
child 55477 c396e381cfa4
permissions -rw-r--r--
8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots Reviewed-by: rkennke
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:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    39
  volatile bool                             _claimed;
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
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   193
template <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();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   197
55450
79a7fc6c9bc7 8225590: Shenandoah: Refactor ShenandoahClassLoaderDataRoots API
zgu
parents: 55444
diff changeset
   198
  void always_strong_cld_do(CLDClosure* clds, uint worker_id);
79a7fc6c9bc7 8225590: Shenandoah: Refactor ShenandoahClassLoaderDataRoots API
zgu
parents: 55444
diff changeset
   199
  void cld_do(CLDClosure* clds, uint worker_id);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   200
};
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
class ShenandoahRootProcessor : public StackObj {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   203
private:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   204
  ShenandoahHeap* const               _heap;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   205
  const ShenandoahPhaseTimings::Phase _phase;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   206
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   207
  ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   208
  ~ShenandoahRootProcessor();
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   209
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   210
  ShenandoahHeap* heap() const { return _heap; }
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   211
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   212
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   213
template <typename ITR>
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   214
class ShenandoahRootScanner : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   215
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   216
  ShenandoahSerialRoots                                     _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   217
  ShenandoahThreadRoots                                     _thread_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   218
  ShenandoahCodeCacheRoots<ITR>                             _code_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   219
  ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   220
  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   221
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   222
  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
   223
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   224
  // 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
   225
  // during class unloading cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   226
  void strong_roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   227
  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
   228
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   229
  // 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
   230
  // roots when class unloading is disabled during this cycle
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   231
  void roots_do(uint worker_id, OopClosure* cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   232
  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
   233
};
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   234
54940
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   235
typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   236
typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
2d90a0988c95 8224210: Shenandoah: Refactor ShenandoahRootScanner to support scanning CSet codecache roots
zgu
parents: 54924
diff changeset
   237
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   238
// 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
   239
// root scanning
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   240
class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   241
private:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   242
  ShenandoahSerialRoots                                    _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   243
  ShenandoahThreadRoots                                    _thread_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   244
  ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   245
  ShenandoahClassLoaderDataRoots<true /*single threaded*/> _cld_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   246
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   247
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   248
public:
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   249
  ShenandoahHeapIterationRootScanner();
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
  void roots_do(OopClosure* cl);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   252
  void strong_roots_do(OopClosure* cl);
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
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   255
// Evacuate all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   256
class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   257
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   258
  ShenandoahSerialRoots                                     _serial_roots;
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   259
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   260
  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   261
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   262
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   263
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   264
  ShenandoahStringDedupRoots                                _dedup_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   265
  ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   266
  bool                                                      _include_concurrent_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   267
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   268
public:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   269
  ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   270
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   271
  void roots_do(uint worker_id, OopClosure* oops);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   272
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   273
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   274
// Update all roots at a safepoint
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   275
class ShenandoahRootUpdater : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   276
private:
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   277
  ShenandoahSerialRoots                                     _serial_roots;
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   278
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   279
  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   280
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   281
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   282
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   283
  ShenandoahStringDedupRoots                                _dedup_roots;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   284
  ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55395
diff changeset
   285
  const bool                                                _update_code_cache;
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   286
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   287
public:
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   288
  ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   289
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   290
  template<typename IsAlive, typename KeepAlive>
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   291
  void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   292
};
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   293
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   294
// Adjuster all roots at a safepoint during full gc
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   295
class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   296
private:
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   297
  ShenandoahSerialRoots                                     _serial_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   298
  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   299
  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   300
  ShenandoahThreadRoots                                     _thread_roots;
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   301
  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   302
  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   303
  ShenandoahStringDedupRoots                                _dedup_roots;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   304
  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   305
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   306
public:
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   307
  ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   308
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   309
  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
   310
};
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   311
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52925
diff changeset
   312
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP