Skip to content

Commit

Permalink
8247878: Move Management strong oops to OopStorage
Browse files Browse the repository at this point in the history
Use OopStorage for strong oops stored with memory and thread sampling and dumping, and remove oops_do and GC calls.

Reviewed-by: dholmes, kbarrett
  • Loading branch information
coleenp committed Jul 20, 2020
1 parent c7d8485 commit 99eccaf
Show file tree
Hide file tree
Showing 34 changed files with 134 additions and 264 deletions.
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
_gc_par_phases[ThreadRoots] = new WorkerDataArray<double>("ThreadRoots", "Thread Roots (ms):", max_gc_threads);
_gc_par_phases[UniverseRoots] = new WorkerDataArray<double>("UniverseRoots", "Universe Roots (ms):", max_gc_threads);
_gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>("ObjectSynchronizerRoots", "ObjectSynchronizer Roots (ms):", max_gc_threads);
_gc_par_phases[ManagementRoots] = new WorkerDataArray<double>("ManagementRoots", "Management Roots (ms):", max_gc_threads);
_gc_par_phases[CLDGRoots] = new WorkerDataArray<double>("CLDGRoots", "CLDG Roots (ms):", max_gc_threads);
AOT_ONLY(_gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>("AOTCodeRoots", "AOT Root Scan (ms):", max_gc_threads);)
_gc_par_phases[CMRefRoots] = new WorkerDataArray<double>("CMRefRoots", "CM RefProcessor Roots (ms):", max_gc_threads);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
ThreadRoots,
UniverseRoots,
ObjectSynchronizerRoots,
ManagementRoots,
CLDGRoots,
AOT_ONLY(AOTCodeRoots COMMA)
CMRefRoots,
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/share/gc/g1/g1RootProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "memory/allocation.inline.hpp"
#include "memory/universe.hpp"
#include "runtime/mutex.hpp"
#include "services/management.hpp"
#include "utilities/macros.hpp"

G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, uint n_workers) :
Expand Down Expand Up @@ -196,13 +195,6 @@ void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
}
}

{
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_id);
if (_process_strong_tasks.try_claim_task(G1RP_PS_Management_oops_do)) {
Management::oops_do(strong_roots);
}
}

#if INCLUDE_AOT
if (UseAOT) {
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::AOTCodeRoots, worker_id);
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
#include "runtime/handles.inline.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/vmThread.hpp"
#include "services/management.hpp"
#include "services/memTracker.hpp"
#include "services/memoryService.hpp"
#include "utilities/align.hpp"
Expand Down Expand Up @@ -2020,10 +2019,6 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
ObjectSynchronizer::oops_do(&mark_and_push_closure);
break;

case ParallelRootType::management:
Management::oops_do(&mark_and_push_closure);
break;

case ParallelRootType::class_loader_data:
{
CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
Expand Down Expand Up @@ -2236,7 +2231,6 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
Universe::oops_do(&oop_closure);
Threads::oops_do(&oop_closure, NULL);
ObjectSynchronizer::oops_do(&oop_closure);
Management::oops_do(&oop_closure);
OopStorageSet::strong_oops_do(&oop_closure);
CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::cld_do(&cld_closure);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/parallel/psRootType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class ParallelRootType : public AllStatic {
enum Value {
universe,
object_synchronizer,
management,
class_loader_data,
code_cache,
//"threads" are handled in parallel as a special case
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/parallel/psScavenge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
#include "runtime/threadCritical.hpp"
#include "runtime/vmThread.hpp"
#include "runtime/vmOperations.hpp"
#include "services/management.hpp"
#include "services/memoryService.hpp"
#include "utilities/stack.inline.hpp"

Expand Down Expand Up @@ -108,10 +107,6 @@ static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_i
}
break;

case ParallelRootType::management:
Management::oops_do(&roots_closure);
break;

case ParallelRootType::code_cache:
{
MarkingCodeBlobClosure code_closure(&roots_to_old_closure, CodeBlobToOopClosure::FixRelocations);
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/vmThread.hpp"
#include "services/management.hpp"
#include "services/memoryService.hpp"
#include "utilities/autoRestore.hpp"
#include "utilities/debug.hpp"
Expand Down Expand Up @@ -829,9 +828,6 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
if (_process_strong_tasks->try_claim_task(GCH_PS_ObjectSynchronizer_oops_do)) {
ObjectSynchronizer::oops_do(strong_roots);
}
if (_process_strong_tasks->try_claim_task(GCH_PS_Management_oops_do)) {
Management::oops_do(strong_roots);
}
#if INCLUDE_AOT
if (UseAOT && _process_strong_tasks->try_claim_task(GCH_PS_aot_oops_do)) {
AOTLoader::oops_do(strong_roots);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shared/genCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class GenCollectedHeap : public CollectedHeap {
enum GCH_strong_roots_tasks {
GCH_PS_Universe_oops_do,
GCH_PS_ObjectSynchronizer_oops_do,
GCH_PS_Management_oops_do,
GCH_PS_OopStorageSet_oops_do,
GCH_PS_ClassLoaderDataGraph_oops_do,
GCH_PS_CodeCache_oops_do,
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class outputStream;
f(CNT_PREFIX ## VMStrongRoots, DESC_PREFIX "VM Strong Roots") \
f(CNT_PREFIX ## VMWeakRoots, DESC_PREFIX "VM Weak Roots") \
f(CNT_PREFIX ## ObjectSynchronizerRoots, DESC_PREFIX "Synchronizer Roots") \
f(CNT_PREFIX ## ManagementRoots, DESC_PREFIX "Management Roots") \
f(CNT_PREFIX ## CLDGRoots, DESC_PREFIX "CLDG Roots") \
f(CNT_PREFIX ## JVMTIWeakRoots, DESC_PREFIX "JVMTI Weak Roots") \
f(CNT_PREFIX ## JFRWeakRoots, DESC_PREFIX "JFR Weak Roots") \
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "runtime/thread.hpp"
#include "services/management.hpp"

ShenandoahSerialRoot::ShenandoahSerialRoot(ShenandoahSerialRoot::OopsDo oops_do,
ShenandoahPhaseTimings::Phase phase, ShenandoahPhaseTimings::ParPhase par_phase) :
Expand All @@ -56,14 +55,12 @@ void ShenandoahSerialRoot::oops_do(OopClosure* cl, uint worker_id) {

ShenandoahSerialRoots::ShenandoahSerialRoots(ShenandoahPhaseTimings::Phase phase) :
_universe_root(&Universe::oops_do, phase, ShenandoahPhaseTimings::UniverseRoots),
_object_synchronizer_root(&ObjectSynchronizer::oops_do, phase, ShenandoahPhaseTimings::ObjectSynchronizerRoots),
_management_root(&Management::oops_do, phase, ShenandoahPhaseTimings::ManagementRoots) {
_object_synchronizer_root(&ObjectSynchronizer::oops_do, phase, ShenandoahPhaseTimings::ObjectSynchronizerRoots) {
}

void ShenandoahSerialRoots::oops_do(OopClosure* cl, uint worker_id) {
_universe_root.oops_do(cl, worker_id);
_object_synchronizer_root.oops_do(cl, worker_id);
_management_root.oops_do(cl, worker_id);
}

ShenandoahWeakSerialRoot::ShenandoahWeakSerialRoot(ShenandoahWeakSerialRoot::WeakOopsDo weak_oops_do,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ShenandoahSerialRoots {
private:
ShenandoahSerialRoot _universe_root;
ShenandoahSerialRoot _object_synchronizer_root;
ShenandoahSerialRoot _management_root;
public:
ShenandoahSerialRoots(ShenandoahPhaseTimings::Phase phase);
void oops_do(OopClosure* cl, uint worker_id);
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "gc/shared/weakProcessor.inline.hpp"
#include "memory/universe.hpp"
#include "runtime/thread.hpp"
#include "services/management.hpp"
#include "utilities/debug.hpp"

// Check for overflow of number of root types.
Expand Down Expand Up @@ -77,7 +76,6 @@ void ShenandoahRootVerifier::oops_do(OopClosure* oops) {
if (verify(SerialRoots)) {
shenandoah_assert_safepoint();
Universe::oops_do(oops);
Management::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
}

Expand Down Expand Up @@ -122,7 +120,6 @@ void ShenandoahRootVerifier::roots_do(OopClosure* oops) {
ClassLoaderDataGraph::cld_do(&clds);

Universe::oops_do(oops);
Management::oops_do(oops);
JNIHandles::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
Universe::vm_global()->oops_do(oops);
Expand All @@ -149,7 +146,6 @@ void ShenandoahRootVerifier::strong_roots_do(OopClosure* oops) {
ClassLoaderDataGraph::roots_cld_do(&clds, NULL);

Universe::oops_do(oops);
Management::oops_do(oops);
JNIHandles::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
Universe::vm_global()->oops_do(oops);
Expand Down
9 changes: 0 additions & 9 deletions src/hotspot/share/gc/z/zRootsIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include "runtime/synchronizer.hpp"
#include "runtime/thread.hpp"
#include "runtime/vmThread.hpp"
#include "services/management.hpp"
#include "utilities/debug.hpp"
#if INCLUDE_JFR
#include "jfr/jfr.hpp"
Expand All @@ -60,7 +59,6 @@ static const ZStatSubPhase ZSubPhasePauseRoots("Pause Roots");
static const ZStatSubPhase ZSubPhasePauseRootsTeardown("Pause Roots Teardown");
static const ZStatSubPhase ZSubPhasePauseRootsUniverse("Pause Roots Universe");
static const ZStatSubPhase ZSubPhasePauseRootsObjectSynchronizer("Pause Roots ObjectSynchronizer");
static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
static const ZStatSubPhase ZSubPhasePauseRootsVMThread("Pause Roots VM Thread");
static const ZStatSubPhase ZSubPhasePauseRootsJavaThreads("Pause Roots Java Threads");
Expand Down Expand Up @@ -193,7 +191,6 @@ ZRootsIterator::ZRootsIterator(bool visit_jvmti_weak_export) :
_java_threads_iter(),
_universe(this),
_object_synchronizer(this),
_management(this),
_jvmti_weak_export(this),
_vm_thread(this),
_java_threads(this),
Expand Down Expand Up @@ -230,11 +227,6 @@ void ZRootsIterator::do_object_synchronizer(ZRootsIteratorClosure* cl) {
ObjectSynchronizer::oops_do(cl);
}

void ZRootsIterator::do_management(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsManagement);
Management::oops_do(cl);
}

void ZRootsIterator::do_jvmti_weak_export(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsJVMTIWeakExport);
AlwaysTrueClosure always_alive;
Expand Down Expand Up @@ -262,7 +254,6 @@ void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRoots);
_universe.oops_do(cl);
_object_synchronizer.oops_do(cl);
_management.oops_do(cl);
_vm_thread.oops_do(cl);
_java_threads.oops_do(cl);
if (!ClassUnloading) {
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/gc/z/zRootsIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,13 @@ class ZRootsIterator {

void do_universe(ZRootsIteratorClosure* cl);
void do_object_synchronizer(ZRootsIteratorClosure* cl);
void do_management(ZRootsIteratorClosure* cl);
void do_jvmti_weak_export(ZRootsIteratorClosure* cl);
void do_vm_thread(ZRootsIteratorClosure* cl);
void do_java_threads(ZRootsIteratorClosure* cl);
void do_code_cache(ZRootsIteratorClosure* cl);

ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread;
ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void RootSetClosure<Delegate>::process() {
ObjectSynchronizer::oops_do(this);
Universe::oops_do(this);
OopStorageSet::strong_oops_do(this);
Management::oops_do(this);
AOTLoader::oops_do(this);
}

Expand Down
13 changes: 0 additions & 13 deletions src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class ReferenceToRootClosure : public StackObj {
bool do_object_synchronizer_roots();
bool do_universe_roots();
bool do_oop_storage_roots();
bool do_management_roots();
bool do_string_table_roots();
bool do_aot_loader_roots();

Expand Down Expand Up @@ -164,13 +163,6 @@ bool ReferenceToRootClosure::do_oop_storage_roots() {
return false;
}

bool ReferenceToRootClosure::do_management_roots() {
assert(!complete(), "invariant");
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_management, OldObjectRoot::_type_undetermined, NULL);
Management::oops_do(&rlc);
return rlc.complete();
}

bool ReferenceToRootClosure::do_aot_loader_roots() {
assert(!complete(), "invariant");
ReferenceLocateClosure rcl(_callback, OldObjectRoot::_aot, OldObjectRoot::_type_undetermined, NULL);
Expand Down Expand Up @@ -203,11 +195,6 @@ bool ReferenceToRootClosure::do_roots() {
return true;
}

if (do_management_roots()) {
_complete = true;
return true;
}

if (do_aot_loader_roots()) {
_complete = true;
return true;
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ const char* OldObjectRoot::system_description(System system) {
return "Object Monitor";
case _class_loader_data:
return "Class Loader Data";
case _management:
return "Management";
case _code_cache:
return "Code Cache";
case _aot:
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/jfr/leakprofiler/utilities/rootType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class OldObjectRoot : public AllStatic {
_strong_oop_storage_set_last = _strong_oop_storage_set_first + OopStorageSet::strong_count - 1,
_object_synchronizer,
_class_loader_data,
_management,
_code_cache,
_aot,
JVMCI_ONLY(_jvmci COMMA)
Expand Down
23 changes: 16 additions & 7 deletions src/hotspot/share/oops/oopHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@
#ifndef SHARE_OOPS_OOPHANDLE_HPP
#define SHARE_OOPS_OOPHANDLE_HPP

#include "metaprogramming/primitiveConversions.hpp"
#include "oops/oopsHierarchy.hpp"

class OopStorage;

// Simple class for encapsulating oop pointers stored in metadata.
// These are different from Handle. The Handle class stores pointers
// to oops on the stack, and manages the allocation from a thread local
// area in the constructor.
// This assumes that the caller will allocate the handle in the appropriate
// area. The reason for the encapsulation is to help with naming and to allow
// future uses for read barriers.
// Simple classes for wrapping oop and atomically accessed oop pointers
// stored in OopStorage, or stored in the ClassLoaderData handles area.
// These classes help with allocation, release, and NativeAccess loads and
// stores with the appropriate barriers.

class OopHandle {
friend class VMStructs;
Expand All @@ -56,4 +54,15 @@ class OopHandle {
oop* ptr_raw() const { return _obj; }
};

// Convert OopHandle to oop*

template<>
struct PrimitiveConversions::Translate<OopHandle> : public TrueType {
typedef OopHandle Value;
typedef oop* Decayed;

static Decayed decay(Value x) { return x.ptr_raw(); }
static Value recover(Decayed x) { return OopHandle(x); }
};

#endif // SHARE_OOPS_OOPHANDLE_HPP
8 changes: 5 additions & 3 deletions src/hotspot/share/oops/oopHandle.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ inline OopHandle::OopHandle(OopStorage* storage, oop obj) :
}

inline void OopHandle::release(OopStorage* storage) {
// Clear the OopHandle first
NativeAccess<>::oop_store(_obj, (oop)NULL);
storage->release(_obj);
if (peek() != NULL) {
// Clear the OopHandle first
NativeAccess<>::oop_store(_obj, (oop)NULL);
storage->release(_obj);
}
}

#endif // SHARE_OOPS_OOPHANDLE_INLINE_HPP
Loading

0 comments on commit 99eccaf

Please sign in to comment.