src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 58929 03f182a0f62c
child 59296 9186be5c78ba
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
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
/*
54103
8b61a38be0c5 8220546: Shenandoah Reports timing details for weak root processing
zgu
parents: 54058
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
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    24
#include "precompiled.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    25
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    26
#include "classfile/classLoaderDataGraph.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    27
#include "classfile/stringTable.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    28
#include "classfile/systemDictionary.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    29
#include "code/codeCache.hpp"
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    30
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
58929
03f182a0f62c 8233574: Shenandoah: build is broken without jfr
jiefu
parents: 58686
diff changeset
    31
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    32
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    33
#include "gc/shenandoah/shenandoahStringDedup.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    34
#include "gc/shenandoah/shenandoahTimingTracker.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    35
#include "gc/shenandoah/shenandoahVMOperations.hpp"
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    36
#include "jfr/jfr.hpp"
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    37
#include "memory/iterator.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    38
#include "memory/resourceArea.hpp"
54825
1b03400e5a8f 8223637: Fix build breakage after 8223136
stefank
parents: 54691
diff changeset
    39
#include "memory/universe.hpp"
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    40
#include "runtime/thread.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    41
#include "services/management.hpp"
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
    42
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    43
ShenandoahSerialRoot::ShenandoahSerialRoot(ShenandoahSerialRoot::OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases phase) :
55547
c7a7728eeddc 8227101: Shenandoah: Use ShenandoahSharedFlag for claimed flag in ShenandoahSerialRoot
zgu
parents: 55477
diff changeset
    44
  _oops_do(oops_do), _phase(phase) {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    45
}
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
void ShenandoahSerialRoot::oops_do(OopClosure* cl, uint worker_id) {
55547
c7a7728eeddc 8227101: Shenandoah: Use ShenandoahSharedFlag for claimed flag in ShenandoahSerialRoot
zgu
parents: 55477
diff changeset
    48
  if (_claimed.try_set()) {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    49
    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    50
    ShenandoahWorkerTimingsTracker timer(worker_times, _phase, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    51
    _oops_do(cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    52
  }
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    53
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    54
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
    55
// Overwrite the second argument for SD::oops_do, don't include vm global oop storage.
55740
b3ff56f955c8 8227653: Add VM Global OopStorage
kbarrett
parents: 55547
diff changeset
    56
static void system_dictionary_oops_do(OopClosure* cl) {
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
    57
  SystemDictionary::oops_do(cl, false);
55740
b3ff56f955c8 8227653: Add VM Global OopStorage
kbarrett
parents: 55547
diff changeset
    58
}
b3ff56f955c8 8227653: Add VM Global OopStorage
kbarrett
parents: 55547
diff changeset
    59
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    60
ShenandoahSerialRoots::ShenandoahSerialRoots() :
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    61
  _universe_root(&Universe::oops_do, ShenandoahPhaseTimings::UniverseRoots),
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    62
  _object_synchronizer_root(&ObjectSynchronizer::oops_do, ShenandoahPhaseTimings::ObjectSynchronizerRoots),
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    63
  _management_root(&Management::oops_do, ShenandoahPhaseTimings::ManagementRoots),
55740
b3ff56f955c8 8227653: Add VM Global OopStorage
kbarrett
parents: 55547
diff changeset
    64
  _system_dictionary_root(&system_dictionary_oops_do, ShenandoahPhaseTimings::SystemDictionaryRoots),
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55119
diff changeset
    65
  _jvmti_root(&JvmtiExport::oops_do, ShenandoahPhaseTimings::JVMTIRoots) {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    66
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    67
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    68
void ShenandoahSerialRoots::oops_do(OopClosure* cl, uint worker_id) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    69
  _universe_root.oops_do(cl, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    70
  _object_synchronizer_root.oops_do(cl, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    71
  _management_root.oops_do(cl, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    72
  _system_dictionary_root.oops_do(cl, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
    73
  _jvmti_root.oops_do(cl, worker_id);
55335
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55119
diff changeset
    74
}
f7cc25dda38a 8225572: Shenandoah: Move JNIHandles root out of serial roots
zgu
parents: 55119
diff changeset
    75
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    76
ShenandoahWeakSerialRoot::ShenandoahWeakSerialRoot(ShenandoahWeakSerialRoot::WeakOopsDo weak_oops_do, ShenandoahPhaseTimings::GCParPhases phase) :
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    77
  _weak_oops_do(weak_oops_do), _phase(phase) {
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
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    80
void ShenandoahWeakSerialRoot::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
    81
  if (_claimed.try_set()) {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    82
    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    83
    ShenandoahWorkerTimingsTracker timer(worker_times, _phase, worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    84
    _weak_oops_do(is_alive, keep_alive);
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
}
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    87
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    88
#if INCLUDE_JVMTI
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    89
ShenandoahJVMTIWeakRoot::ShenandoahJVMTIWeakRoot() :
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    90
  ShenandoahWeakSerialRoot(&JvmtiExport::weak_oops_do, ShenandoahPhaseTimings::JVMTIWeakRoots) {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    91
}
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    92
#endif // INCLUDE_JVMTI
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
#if INCLUDE_JFR
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    95
ShenandoahJFRWeakRoot::ShenandoahJFRWeakRoot() :
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    96
  ShenandoahWeakSerialRoot(&Jfr::weak_oops_do, ShenandoahPhaseTimings::JFRWeakRoots) {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    97
}
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    98
#endif // INCLUDE_JFR
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
    99
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   100
void ShenandoahSerialWeakRoots::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
   101
  JVMTI_ONLY(_jvmti_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);)
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   102
  JFR_ONLY(_jfr_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);)
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   103
}
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   104
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   105
void ShenandoahSerialWeakRoots::weak_oops_do(OopClosure* cl, uint worker_id) {
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   106
  AlwaysTrueClosure always_true;
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   107
  weak_oops_do(&always_true, cl, worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   108
}
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   109
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   110
ShenandoahThreadRoots::ShenandoahThreadRoots(bool is_par) : _is_par(is_par) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   111
  Threads::change_thread_claim_token();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   112
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   113
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   114
void ShenandoahThreadRoots::oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   115
  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   116
  ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   117
  ResourceMark rm;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   118
  Threads::possibly_parallel_oops_do(_is_par, oops_cl, code_cl);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   119
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   120
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   121
void ShenandoahThreadRoots::threads_do(ThreadClosure* tc, uint worker_id) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   122
  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   123
  ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   124
  ResourceMark rm;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   125
  Threads::possibly_parallel_threads_do(_is_par, tc);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   126
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   127
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   128
ShenandoahThreadRoots::~ShenandoahThreadRoots() {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   129
  Threads::assert_all_threads_claimed();
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   130
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   131
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   132
ShenandoahStringDedupRoots::ShenandoahStringDedupRoots() {
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   133
  if (ShenandoahStringDedup::is_enabled()) {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   134
    StringDedup::gc_prologue(false);
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   135
  }
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   136
}
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   137
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   138
ShenandoahStringDedupRoots::~ShenandoahStringDedupRoots() {
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   139
  if (ShenandoahStringDedup::is_enabled()) {
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   140
    StringDedup::gc_epilogue();
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   141
  }
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   142
}
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   143
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   144
void ShenandoahStringDedupRoots::oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   145
  if (ShenandoahStringDedup::is_enabled()) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   146
    ShenandoahStringDedup::parallel_oops_do(is_alive, keep_alive, worker_id);
54103
8b61a38be0c5 8220546: Shenandoah Reports timing details for weak root processing
zgu
parents: 54058
diff changeset
   147
  }
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   148
}
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   149
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   150
ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   151
  _heap(ShenandoahHeap::heap()),
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   152
  _phase(phase) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   153
  assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   154
  _heap->phase_timings()->record_workers_start(_phase);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   155
}
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   156
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   157
ShenandoahRootProcessor::~ShenandoahRootProcessor() {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   158
  assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   159
  _heap->phase_timings()->record_workers_end(_phase);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   160
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   161
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55335
diff changeset
   162
ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots) :
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   163
  ShenandoahRootProcessor(phase),
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   164
  _thread_roots(n_workers > 1),
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55335
diff changeset
   165
  _include_concurrent_roots(include_concurrent_roots) {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   166
}
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   167
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   168
void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   169
  MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations);
54687
df2b3565f343 8222992: Shenandoah: Pre-evacuate all roots
zgu
parents: 54664
diff changeset
   170
  AlwaysTrueClosure always_true;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   171
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   172
  _serial_roots.oops_do(oops, worker_id);
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   173
  _serial_weak_roots.weak_oops_do(oops, worker_id);
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55335
diff changeset
   174
  if (_include_concurrent_roots) {
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   175
    CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
   176
    _vm_roots.oops_do<OopClosure>(oops, worker_id);
55477
c396e381cfa4 8226310: Shenandoah: Concurrent evacuation of CLDG
zgu
parents: 55476
diff changeset
   177
    _cld_roots.cld_do(&clds, worker_id);
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   178
    _weak_roots.oops_do<OopClosure>(oops, worker_id);
55428
e9da3a44a7ed 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles
zgu
parents: 55335
diff changeset
   179
  }
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   180
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   181
  _thread_roots.oops_do(oops, NULL, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   182
  _code_roots.code_blobs_do(&blobsCl, worker_id);
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54344
diff changeset
   183
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   184
  _dedup_roots.oops_do(&always_true, oops, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   185
}
54423
6c0ab8bd8da5 8221766: Load-reference barriers for Shenandoah
rkennke
parents: 54344
diff changeset
   186
57732
23e13076e102 8229474: Shenandoah: Cleanup CM::update_roots()
zgu
parents: 57669
diff changeset
   187
ShenandoahRootUpdater::ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   188
  ShenandoahRootProcessor(phase),
57732
23e13076e102 8229474: Shenandoah: Cleanup CM::update_roots()
zgu
parents: 57669
diff changeset
   189
  _thread_roots(n_workers > 1) {
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   190
}
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   191
58686
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   192
void ShenandoahRootUpdater::strong_roots_do(uint worker_id, OopClosure* oops_cl) {
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   193
  CodeBlobToOopClosure update_blobs(oops_cl, CodeBlobToOopClosure::FixRelocations);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   194
  CLDToOopClosure clds(oops_cl, ClassLoaderData::_claim_strong);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   195
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   196
  _serial_roots.oops_do(oops_cl, worker_id);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   197
  _vm_roots.oops_do(oops_cl, worker_id);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   198
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   199
  _thread_roots.oops_do(oops_cl, NULL, worker_id);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   200
  _cld_roots.cld_do(&clds, worker_id);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   201
  _code_roots.code_blobs_do(&update_blobs, worker_id);
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   202
}
0279391875bf 8231324: Shenandoah: avoid duplicated weak root works during final traversal
zgu
parents: 58233
diff changeset
   203
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   204
ShenandoahRootAdjuster::ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   205
  ShenandoahRootProcessor(phase),
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   206
  _thread_roots(n_workers > 1) {
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   207
  assert(ShenandoahHeap::heap()->is_full_gc_in_progress(), "Full GC only");
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   208
}
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
void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   211
  CodeBlobToOopClosure adjust_code_closure(oops, CodeBlobToOopClosure::FixRelocations);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   212
  CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   213
  AlwaysTrueClosure always_true;
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   214
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   215
  _serial_roots.oops_do(oops, worker_id);
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
   216
  _vm_roots.oops_do(oops, worker_id);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   217
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   218
  _thread_roots.oops_do(oops, NULL, worker_id);
55450
79a7fc6c9bc7 8225590: Shenandoah: Refactor ShenandoahClassLoaderDataRoots API
zgu
parents: 55444
diff changeset
   219
  _cld_roots.cld_do(&adjust_cld_closure, worker_id);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   220
  _code_roots.code_blobs_do(&adjust_code_closure, worker_id);
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   221
55476
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   222
  _serial_weak_roots.weak_oops_do(oops, worker_id);
aee0d296c0ef 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
zgu
parents: 55450
diff changeset
   223
  _weak_roots.oops_do<OopClosure>(oops, worker_id);
54924
ba1eccda5450 8223774: Shenandoah: Refactor ShenandoahRootProcessor and family
zgu
parents: 54882
diff changeset
   224
  _dedup_roots.oops_do(&always_true, oops, worker_id);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff changeset
   225
}
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   226
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   227
 ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   228
   ShenandoahRootProcessor(ShenandoahPhaseTimings::_num_phases),
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   229
   _thread_roots(false /*is par*/) {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   230
 }
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   231
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   232
 void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   233
   assert(Thread::current()->is_VM_thread(), "Only by VM thread");
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   234
   // Must use _claim_none to avoid interfering with concurrent CLDG iteration
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   235
   CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   236
   MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   237
   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
58233
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   238
   AlwaysTrueClosure always_true;
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   239
   ResourceMark rm;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   240
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   241
   _serial_roots.oops_do(oops, 0);
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
   242
   _vm_roots.oops_do(oops, 0);
55450
79a7fc6c9bc7 8225590: Shenandoah: Refactor ShenandoahClassLoaderDataRoots API
zgu
parents: 55444
diff changeset
   243
   _cld_roots.cld_do(&clds, 0);
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   244
   _thread_roots.threads_do(&tc_cl, 0);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   245
   _code_roots.code_blobs_do(&code, 0);
58233
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   246
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   247
   _serial_weak_roots.weak_oops_do(oops, 0);
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   248
   _weak_roots.oops_do<OopClosure>(oops, 0);
89033e6641ed 8231244: Shenandoah: all-roots heap walking misses some weak roots
shade
parents: 57732
diff changeset
   249
   _dedup_roots.oops_do(&always_true, oops, 0);
55444
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
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   252
 void ShenandoahHeapIterationRootScanner::strong_roots_do(OopClosure* oops) {
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   253
   assert(Thread::current()->is_VM_thread(), "Only by VM thread");
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   254
   // Must use _claim_none to avoid interfering with concurrent CLDG iteration
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   255
   CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   256
   MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   257
   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   258
   ResourceMark rm;
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   259
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   260
   _serial_roots.oops_do(oops, 0);
57669
18f189e69b29 8229213: Shenandoah: Allow VM global oop storage to be processed concurrently
zgu
parents: 55740
diff changeset
   261
   _vm_roots.oops_do(oops, 0);
55450
79a7fc6c9bc7 8225590: Shenandoah: Refactor ShenandoahClassLoaderDataRoots API
zgu
parents: 55444
diff changeset
   262
   _cld_roots.always_strong_cld_do(&clds, 0);
55444
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   263
   _thread_roots.threads_do(&tc_cl, 0);
6a7d6b6bbd78 8226413: Shenandoah: Separate root scanner for SH::object_iterate()
zgu
parents: 55428
diff changeset
   264
 }