8248216: JFR: Unify handling of all OopStorage instances in LeakProfiler root processing
Reviewed-by: mgronlun, stefank
This commit is contained in:
parent
18cddad5a2
commit
57b792cba2
@ -27,7 +27,7 @@
|
|||||||
#include "classfile/classLoaderDataGraph.hpp"
|
#include "classfile/classLoaderDataGraph.hpp"
|
||||||
#include "classfile/stringTable.hpp"
|
#include "classfile/stringTable.hpp"
|
||||||
#include "gc/shared/oopStorage.inline.hpp"
|
#include "gc/shared/oopStorage.inline.hpp"
|
||||||
#include "gc/shared/oopStorageSet.hpp"
|
#include "gc/shared/oopStorageSet.inline.hpp"
|
||||||
#include "gc/shared/strongRootsScope.hpp"
|
#include "gc/shared/strongRootsScope.hpp"
|
||||||
#include "jfr/leakprofiler/chains/bfsClosure.hpp"
|
#include "jfr/leakprofiler/chains/bfsClosure.hpp"
|
||||||
#include "jfr/leakprofiler/chains/dfsClosure.hpp"
|
#include "jfr/leakprofiler/chains/dfsClosure.hpp"
|
||||||
@ -38,7 +38,6 @@
|
|||||||
#include "oops/access.inline.hpp"
|
#include "oops/access.inline.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "prims/jvmtiExport.hpp"
|
#include "prims/jvmtiExport.hpp"
|
||||||
#include "runtime/jniHandles.inline.hpp"
|
|
||||||
#include "runtime/synchronizer.hpp"
|
#include "runtime/synchronizer.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
#include "services/management.hpp"
|
#include "services/management.hpp"
|
||||||
@ -76,9 +75,8 @@ void RootSetClosure<Delegate>::process() {
|
|||||||
Threads::oops_do(this, NULL);
|
Threads::oops_do(this, NULL);
|
||||||
ObjectSynchronizer::oops_do(this);
|
ObjectSynchronizer::oops_do(this);
|
||||||
Universe::oops_do(this);
|
Universe::oops_do(this);
|
||||||
JNIHandles::oops_do(this);
|
|
||||||
JvmtiExport::oops_do(this);
|
JvmtiExport::oops_do(this);
|
||||||
OopStorageSet::vm_global()->oops_do(this);
|
OopStorageSet::strong_oops_do(this);
|
||||||
Management::oops_do(this);
|
Management::oops_do(this);
|
||||||
AOTLoader::oops_do(this);
|
AOTLoader::oops_do(this);
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,8 @@ class ReferenceToRootClosure : public StackObj {
|
|||||||
bool do_cldg_roots();
|
bool do_cldg_roots();
|
||||||
bool do_object_synchronizer_roots();
|
bool do_object_synchronizer_roots();
|
||||||
bool do_universe_roots();
|
bool do_universe_roots();
|
||||||
bool do_jni_handle_roots();
|
bool do_oop_storage_roots();
|
||||||
bool do_jvmti_roots();
|
bool do_jvmti_roots();
|
||||||
bool do_vm_global_roots();
|
|
||||||
bool do_management_roots();
|
bool do_management_roots();
|
||||||
bool do_string_table_roots();
|
bool do_string_table_roots();
|
||||||
bool do_aot_loader_roots();
|
bool do_aot_loader_roots();
|
||||||
@ -148,11 +147,22 @@ bool ReferenceToRootClosure::do_universe_roots() {
|
|||||||
return rlc.complete();
|
return rlc.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReferenceToRootClosure::do_jni_handle_roots() {
|
bool ReferenceToRootClosure::do_oop_storage_roots() {
|
||||||
assert(!complete(), "invariant");
|
int i = 0;
|
||||||
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_global_jni_handles, OldObjectRoot::_global_jni_handle, NULL);
|
for (OopStorageSet::Iterator it = OopStorageSet::strong_iterator(); !it.is_end(); ++it, ++i) {
|
||||||
JNIHandles::oops_do(&rlc);
|
assert(!complete(), "invariant");
|
||||||
return rlc.complete();
|
OopStorage* oop_storage = *it;
|
||||||
|
OldObjectRoot::Type type = oop_storage == OopStorageSet::jni_global() ?
|
||||||
|
OldObjectRoot::_global_jni_handle :
|
||||||
|
OldObjectRoot::_global_oop_handle;
|
||||||
|
OldObjectRoot::System system = OldObjectRoot::System(OldObjectRoot::_strong_oop_storage_set_first + i);
|
||||||
|
ReferenceLocateClosure rlc(_callback, system, type, NULL);
|
||||||
|
oop_storage->oops_do(&rlc);
|
||||||
|
if (rlc.complete()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReferenceToRootClosure::do_jvmti_roots() {
|
bool ReferenceToRootClosure::do_jvmti_roots() {
|
||||||
@ -162,13 +172,6 @@ bool ReferenceToRootClosure::do_jvmti_roots() {
|
|||||||
return rlc.complete();
|
return rlc.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReferenceToRootClosure::do_vm_global_roots() {
|
|
||||||
assert(!complete(), "invariant");
|
|
||||||
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_vm_global, OldObjectRoot::_type_undetermined, NULL);
|
|
||||||
OopStorageSet::vm_global()->oops_do(&rlc);
|
|
||||||
return rlc.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ReferenceToRootClosure::do_management_roots() {
|
bool ReferenceToRootClosure::do_management_roots() {
|
||||||
assert(!complete(), "invariant");
|
assert(!complete(), "invariant");
|
||||||
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_management, OldObjectRoot::_type_undetermined, NULL);
|
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_management, OldObjectRoot::_type_undetermined, NULL);
|
||||||
@ -203,7 +206,7 @@ bool ReferenceToRootClosure::do_roots() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_jni_handle_roots()) {
|
if (do_oop_storage_roots()) {
|
||||||
_complete = true;
|
_complete = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -213,11 +216,6 @@ bool ReferenceToRootClosure::do_roots() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_vm_global_roots()) {
|
|
||||||
_complete = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (do_management_roots()) {
|
if (do_management_roots()) {
|
||||||
_complete = true;
|
_complete = true;
|
||||||
return true;
|
return true;
|
||||||
|
97
src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp
Normal file
97
src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.hpp"
|
||||||
|
#include "gc/shared/oopStorage.hpp"
|
||||||
|
#include "gc/shared/oopStorageSet.hpp"
|
||||||
|
#include "jfr/leakprofiler/utilities/rootType.hpp"
|
||||||
|
#include "utilities/debug.hpp"
|
||||||
|
|
||||||
|
OopStorage* OldObjectRoot::system_oop_storage(System system) {
|
||||||
|
int val = int(system);
|
||||||
|
if (val >= _strong_oop_storage_set_first && val <= _strong_oop_storage_set_last) {
|
||||||
|
int index = val - _strong_oop_storage_set_first;
|
||||||
|
int i = 0;
|
||||||
|
for (OopStorageSet::Iterator it = OopStorageSet::strong_iterator(); !it.is_end(); ++it, ++i) {
|
||||||
|
if (i == index) {
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* OldObjectRoot::system_description(System system) {
|
||||||
|
OopStorage* oop_storage = system_oop_storage(system);
|
||||||
|
if (oop_storage != NULL) {
|
||||||
|
return oop_storage->name();
|
||||||
|
}
|
||||||
|
switch (system) {
|
||||||
|
case _system_undetermined:
|
||||||
|
return "<unknown>";
|
||||||
|
case _universe:
|
||||||
|
return "Universe";
|
||||||
|
case _threads:
|
||||||
|
return "Threads";
|
||||||
|
case _object_synchronizer:
|
||||||
|
return "Object Monitor";
|
||||||
|
case _class_loader_data:
|
||||||
|
return "Class Loader Data";
|
||||||
|
case _management:
|
||||||
|
return "Management";
|
||||||
|
case _jvmti:
|
||||||
|
return "JVMTI";
|
||||||
|
case _code_cache:
|
||||||
|
return "Code Cache";
|
||||||
|
case _aot:
|
||||||
|
return "AOT";
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
case _jvmci:
|
||||||
|
return "JVMCI";
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* OldObjectRoot::type_description(Type type) {
|
||||||
|
switch (type) {
|
||||||
|
case _type_undetermined:
|
||||||
|
return "<unknown>";
|
||||||
|
case _stack_variable:
|
||||||
|
return "Stack Variable";
|
||||||
|
case _local_jni_handle:
|
||||||
|
return "Local JNI Handle";
|
||||||
|
case _global_jni_handle:
|
||||||
|
return "Global JNI Handle";
|
||||||
|
case _global_oop_handle:
|
||||||
|
return "Global Object Handle";
|
||||||
|
case _handle_area:
|
||||||
|
return "Handle Area";
|
||||||
|
default:
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -25,18 +25,18 @@
|
|||||||
#ifndef SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
#ifndef SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
||||||
#define SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
#define SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
||||||
|
|
||||||
|
#include "gc/shared/oopStorageSet.hpp"
|
||||||
#include "memory/allocation.hpp"
|
#include "memory/allocation.hpp"
|
||||||
#include "utilities/debug.hpp"
|
|
||||||
|
|
||||||
class OldObjectRoot : public AllStatic {
|
class OldObjectRoot : public AllStatic {
|
||||||
public:
|
public:
|
||||||
enum System {
|
enum System {
|
||||||
_system_undetermined,
|
_system_undetermined,
|
||||||
_universe,
|
_universe,
|
||||||
_global_jni_handles,
|
|
||||||
_threads,
|
_threads,
|
||||||
|
_strong_oop_storage_set_first,
|
||||||
|
_strong_oop_storage_set_last = _strong_oop_storage_set_first + OopStorageSet::strong_count - 1,
|
||||||
_object_synchronizer,
|
_object_synchronizer,
|
||||||
_vm_global,
|
|
||||||
_class_loader_data,
|
_class_loader_data,
|
||||||
_management,
|
_management,
|
||||||
_jvmti,
|
_jvmti,
|
||||||
@ -51,61 +51,14 @@ class OldObjectRoot : public AllStatic {
|
|||||||
_stack_variable,
|
_stack_variable,
|
||||||
_local_jni_handle,
|
_local_jni_handle,
|
||||||
_global_jni_handle,
|
_global_jni_handle,
|
||||||
|
_global_oop_handle,
|
||||||
_handle_area,
|
_handle_area,
|
||||||
_number_of_types
|
_number_of_types
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* system_description(System system) {
|
static OopStorage* system_oop_storage(System system);
|
||||||
switch (system) {
|
static const char* system_description(System system);
|
||||||
case _system_undetermined:
|
static const char* type_description(Type type);
|
||||||
return "<unknown>";
|
|
||||||
case _universe:
|
|
||||||
return "Universe";
|
|
||||||
case _global_jni_handles:
|
|
||||||
return "Global JNI Handles";
|
|
||||||
case _threads:
|
|
||||||
return "Threads";
|
|
||||||
case _object_synchronizer:
|
|
||||||
return "Object Monitor";
|
|
||||||
case _vm_global:
|
|
||||||
return "VM Global";
|
|
||||||
case _class_loader_data:
|
|
||||||
return "Class Loader Data";
|
|
||||||
case _management:
|
|
||||||
return "Management";
|
|
||||||
case _jvmti:
|
|
||||||
return "JVMTI";
|
|
||||||
case _code_cache:
|
|
||||||
return "Code Cache";
|
|
||||||
case _aot:
|
|
||||||
return "AOT";
|
|
||||||
#if INCLUDE_JVMCI
|
|
||||||
case _jvmci:
|
|
||||||
return "JVMCI";
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* type_description(Type type) {
|
|
||||||
switch (type) {
|
|
||||||
case _type_undetermined:
|
|
||||||
return "<unknown>";
|
|
||||||
case _stack_variable:
|
|
||||||
return "Stack Variable";
|
|
||||||
case _local_jni_handle:
|
|
||||||
return "Local JNI Handle";
|
|
||||||
case _global_jni_handle:
|
|
||||||
return "Global JNI Handle";
|
|
||||||
case _handle_area:
|
|
||||||
return "Handle Area";
|
|
||||||
default:
|
|
||||||
ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
#endif // SHARE_JFR_LEAKPROFILER_UTILITIES_ROOTTYPE_HPP
|
||||||
|
Loading…
Reference in New Issue
Block a user