mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8251302: Create dedicated OopStorages for Management and Jvmti
Reviewed-by: sspitsyn, dholmes
This commit is contained in:
parent
28f963f6fc
commit
b16a01bb67
7 changed files with 49 additions and 20 deletions
|
@ -37,7 +37,7 @@ class OopStorageSet : public AllStatic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Must be updated when new OopStorages are introduced
|
// Must be updated when new OopStorages are introduced
|
||||||
static const uint strong_count = 3;
|
static const uint strong_count = 4 JVMTI_ONLY(+ 1);
|
||||||
static const uint weak_count = 4 JFR_ONLY(+ 1);
|
static const uint weak_count = 4 JFR_ONLY(+ 1);
|
||||||
static const uint all_count = strong_count + weak_count;
|
static const uint all_count = strong_count + weak_count;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "code/nmethod.hpp"
|
#include "code/nmethod.hpp"
|
||||||
#include "code/pcDesc.hpp"
|
#include "code/pcDesc.hpp"
|
||||||
#include "code/scopeDesc.hpp"
|
#include "code/scopeDesc.hpp"
|
||||||
|
#include "gc/shared/oopStorageSet.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
|
@ -678,6 +679,18 @@ void JvmtiExport::post_vm_start() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static OopStorage* _jvmti_oop_storage = NULL;
|
||||||
|
|
||||||
|
OopStorage* JvmtiExport::jvmti_oop_storage() {
|
||||||
|
assert(_jvmti_oop_storage != NULL, "not yet initialized");
|
||||||
|
return _jvmti_oop_storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JvmtiExport::initialize_oop_storage() {
|
||||||
|
// OopStorage needs to be created early in startup and unconditionally
|
||||||
|
// because of OopStorageSet static array indices.
|
||||||
|
_jvmti_oop_storage = OopStorageSet::create_strong("JVMTI OopStorage");
|
||||||
|
}
|
||||||
|
|
||||||
void JvmtiExport::post_vm_initialized() {
|
void JvmtiExport::post_vm_initialized() {
|
||||||
EVT_TRIG_TRACE(JVMTI_EVENT_VM_INIT, ("Trg VM init event triggered" ));
|
EVT_TRIG_TRACE(JVMTI_EVENT_VM_INIT, ("Trg VM init event triggered" ));
|
||||||
|
@ -2828,7 +2841,7 @@ void JvmtiObjectAllocEventCollector::generate_call_for_allocated() {
|
||||||
oop obj = _allocated->at(i).resolve();
|
oop obj = _allocated->at(i).resolve();
|
||||||
_post_callback(JavaThread::current(), obj);
|
_post_callback(JavaThread::current(), obj);
|
||||||
// Release OopHandle
|
// Release OopHandle
|
||||||
_allocated->at(i).release(Universe::vm_global());
|
_allocated->at(i).release(JvmtiExport::jvmti_oop_storage());
|
||||||
|
|
||||||
}
|
}
|
||||||
delete _allocated, _allocated = NULL;
|
delete _allocated, _allocated = NULL;
|
||||||
|
@ -2840,7 +2853,7 @@ void JvmtiObjectAllocEventCollector::record_allocation(oop obj) {
|
||||||
if (_allocated == NULL) {
|
if (_allocated == NULL) {
|
||||||
_allocated = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<OopHandle>(1, mtServiceability);
|
_allocated = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<OopHandle>(1, mtServiceability);
|
||||||
}
|
}
|
||||||
_allocated->push(OopHandle(Universe::vm_global(), obj));
|
_allocated->push(OopHandle(JvmtiExport::jvmti_oop_storage(), obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable collection of VMObjectAlloc events
|
// Disable collection of VMObjectAlloc events
|
||||||
|
|
|
@ -47,6 +47,8 @@ class JvmtiManageCapabilities;
|
||||||
class JvmtiEnv;
|
class JvmtiEnv;
|
||||||
class JvmtiThreadState;
|
class JvmtiThreadState;
|
||||||
|
|
||||||
|
class OopStorage;
|
||||||
|
|
||||||
#define JVMTI_SUPPORT_FLAG(key) \
|
#define JVMTI_SUPPORT_FLAG(key) \
|
||||||
private: \
|
private: \
|
||||||
static bool _##key; \
|
static bool _##key; \
|
||||||
|
@ -162,6 +164,9 @@ class JvmtiExport : public AllStatic {
|
||||||
static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
|
static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
|
||||||
|
|
||||||
static void post_class_unload_internal(const char *name) NOT_JVMTI_RETURN;
|
static void post_class_unload_internal(const char *name) NOT_JVMTI_RETURN;
|
||||||
|
|
||||||
|
static void initialize_oop_storage() NOT_JVMTI_RETURN;
|
||||||
|
static OopStorage* jvmti_oop_storage();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// GenerateEvents support to allow posting of CompiledMethodLoad and
|
// GenerateEvents support to allow posting of CompiledMethodLoad and
|
||||||
|
|
|
@ -200,19 +200,19 @@ JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location)
|
||||||
assert(_method != NULL, "No method for breakpoint.");
|
assert(_method != NULL, "No method for breakpoint.");
|
||||||
assert(_bci >= 0, "Negative bci for breakpoint.");
|
assert(_bci >= 0, "Negative bci for breakpoint.");
|
||||||
oop class_holder_oop = _method->method_holder()->klass_holder();
|
oop class_holder_oop = _method->method_holder()->klass_holder();
|
||||||
_class_holder = OopHandle(Universe::vm_global(), class_holder_oop);
|
_class_holder = OopHandle(JvmtiExport::jvmti_oop_storage(), class_holder_oop);
|
||||||
}
|
}
|
||||||
|
|
||||||
JvmtiBreakpoint::~JvmtiBreakpoint() {
|
JvmtiBreakpoint::~JvmtiBreakpoint() {
|
||||||
if (_class_holder.peek() != NULL) {
|
if (_class_holder.peek() != NULL) {
|
||||||
_class_holder.release(Universe::vm_global());
|
_class_holder.release(JvmtiExport::jvmti_oop_storage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
|
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
|
||||||
_method = bp._method;
|
_method = bp._method;
|
||||||
_bci = bp._bci;
|
_bci = bp._bci;
|
||||||
_class_holder = OopHandle(Universe::vm_global(), bp._class_holder.resolve());
|
_class_holder = OopHandle(JvmtiExport::jvmti_oop_storage(), bp._class_holder.resolve());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) {
|
bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) {
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
#include "logging/logTag.hpp"
|
#include "logging/logTag.hpp"
|
||||||
#include "memory/universe.hpp"
|
#include "memory/universe.hpp"
|
||||||
|
#include "prims/jvmtiExport.hpp"
|
||||||
#include "prims/methodHandles.hpp"
|
#include "prims/methodHandles.hpp"
|
||||||
#include "runtime/atomic.hpp"
|
#include "runtime/atomic.hpp"
|
||||||
#include "runtime/flags/jvmFlag.hpp"
|
#include "runtime/flags/jvmFlag.hpp"
|
||||||
|
@ -106,6 +107,7 @@ void vm_init_globals() {
|
||||||
|
|
||||||
jint init_globals() {
|
jint init_globals() {
|
||||||
management_init();
|
management_init();
|
||||||
|
JvmtiExport::initialize_oop_storage();
|
||||||
bytecodes_init();
|
bytecodes_init();
|
||||||
classLoader_init1();
|
classLoader_init1();
|
||||||
compilationPolicy_init();
|
compilationPolicy_init();
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "classfile/systemDictionary.hpp"
|
#include "classfile/systemDictionary.hpp"
|
||||||
|
#include "gc/shared/oopStorageSet.hpp"
|
||||||
#include "memory/allocation.hpp"
|
#include "memory/allocation.hpp"
|
||||||
#include "memory/heapInspection.hpp"
|
#include "memory/heapInspection.hpp"
|
||||||
#include "memory/oopFactory.hpp"
|
#include "memory/oopFactory.hpp"
|
||||||
|
@ -67,6 +68,9 @@ ThreadDumpResult* ThreadService::_threaddump_list = NULL;
|
||||||
|
|
||||||
static const int INITIAL_ARRAY_SIZE = 10;
|
static const int INITIAL_ARRAY_SIZE = 10;
|
||||||
|
|
||||||
|
// OopStorage for thread stack sampling
|
||||||
|
static OopStorage* _thread_service_storage = NULL;
|
||||||
|
|
||||||
void ThreadService::init() {
|
void ThreadService::init() {
|
||||||
EXCEPTION_MARK;
|
EXCEPTION_MARK;
|
||||||
|
|
||||||
|
@ -95,6 +99,9 @@ void ThreadService::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_thread_allocated_memory_enabled = true; // Always on, so enable it
|
_thread_allocated_memory_enabled = true; // Always on, so enable it
|
||||||
|
|
||||||
|
// Initialize OopStorage for thread stack sampling walking
|
||||||
|
_thread_service_storage = OopStorageSet::create_strong("ThreadService OopStorage");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadService::reset_peak_thread_count() {
|
void ThreadService::reset_peak_thread_count() {
|
||||||
|
@ -563,7 +570,7 @@ ThreadsList* ThreadDumpResult::t_list() {
|
||||||
StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||||
_method = jvf->method();
|
_method = jvf->method();
|
||||||
_bci = jvf->bci();
|
_bci = jvf->bci();
|
||||||
_class_holder = OopHandle(Universe::vm_global(), _method->method_holder()->klass_holder());
|
_class_holder = OopHandle(_thread_service_storage, _method->method_holder()->klass_holder());
|
||||||
_locked_monitors = NULL;
|
_locked_monitors = NULL;
|
||||||
if (with_lock_info) {
|
if (with_lock_info) {
|
||||||
Thread* current_thread = Thread::current();
|
Thread* current_thread = Thread::current();
|
||||||
|
@ -576,7 +583,7 @@ StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
MonitorInfo* monitor = list->at(i);
|
MonitorInfo* monitor = list->at(i);
|
||||||
assert(monitor->owner() != NULL, "This monitor must have an owning object");
|
assert(monitor->owner() != NULL, "This monitor must have an owning object");
|
||||||
_locked_monitors->append(OopHandle(Universe::vm_global(), monitor->owner()));
|
_locked_monitors->append(OopHandle(_thread_service_storage, monitor->owner()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,11 +592,11 @@ StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||||
StackFrameInfo::~StackFrameInfo() {
|
StackFrameInfo::~StackFrameInfo() {
|
||||||
if (_locked_monitors != NULL) {
|
if (_locked_monitors != NULL) {
|
||||||
for (int i = 0; i < _locked_monitors->length(); i++) {
|
for (int i = 0; i < _locked_monitors->length(); i++) {
|
||||||
_locked_monitors->at(i).release(Universe::vm_global());
|
_locked_monitors->at(i).release(_thread_service_storage);
|
||||||
}
|
}
|
||||||
delete _locked_monitors;
|
delete _locked_monitors;
|
||||||
}
|
}
|
||||||
_class_holder.release(Universe::vm_global());
|
_class_holder.release(_thread_service_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackFrameInfo::metadata_do(void f(Metadata*)) {
|
void StackFrameInfo::metadata_do(void f(Metadata*)) {
|
||||||
|
@ -640,7 +647,7 @@ ThreadStackTrace::ThreadStackTrace(JavaThread* t, bool with_locked_monitors) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadStackTrace::add_jni_locked_monitor(oop object) {
|
void ThreadStackTrace::add_jni_locked_monitor(oop object) {
|
||||||
_jni_locked_monitors->append(OopHandle(Universe::vm_global(), object));
|
_jni_locked_monitors->append(OopHandle(_thread_service_storage, object));
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadStackTrace::~ThreadStackTrace() {
|
ThreadStackTrace::~ThreadStackTrace() {
|
||||||
|
@ -650,7 +657,7 @@ ThreadStackTrace::~ThreadStackTrace() {
|
||||||
delete _frames;
|
delete _frames;
|
||||||
if (_jni_locked_monitors != NULL) {
|
if (_jni_locked_monitors != NULL) {
|
||||||
for (int i = 0; i < _jni_locked_monitors->length(); i++) {
|
for (int i = 0; i < _jni_locked_monitors->length(); i++) {
|
||||||
_jni_locked_monitors->at(i).release(Universe::vm_global());
|
_jni_locked_monitors->at(i).release(_thread_service_storage);
|
||||||
}
|
}
|
||||||
delete _jni_locked_monitors;
|
delete _jni_locked_monitors;
|
||||||
}
|
}
|
||||||
|
@ -834,13 +841,13 @@ ThreadConcurrentLocks::ThreadConcurrentLocks(JavaThread* thread) {
|
||||||
|
|
||||||
ThreadConcurrentLocks::~ThreadConcurrentLocks() {
|
ThreadConcurrentLocks::~ThreadConcurrentLocks() {
|
||||||
for (int i = 0; i < _owned_locks->length(); i++) {
|
for (int i = 0; i < _owned_locks->length(); i++) {
|
||||||
_owned_locks->at(i).release(Universe::vm_global());
|
_owned_locks->at(i).release(_thread_service_storage);
|
||||||
}
|
}
|
||||||
delete _owned_locks;
|
delete _owned_locks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadConcurrentLocks::add_lock(instanceOop o) {
|
void ThreadConcurrentLocks::add_lock(instanceOop o) {
|
||||||
_owned_locks->append(OopHandle(Universe::vm_global(), o));
|
_owned_locks->append(OopHandle(_thread_service_storage, o));
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadStatistics::ThreadStatistics() {
|
ThreadStatistics::ThreadStatistics() {
|
||||||
|
@ -857,7 +864,7 @@ oop ThreadSnapshot::threadObj() const { return _threadObj.resolve(); }
|
||||||
void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
|
void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
|
||||||
_thread = thread;
|
_thread = thread;
|
||||||
oop threadObj = thread->threadObj();
|
oop threadObj = thread->threadObj();
|
||||||
_threadObj = OopHandle(Universe::vm_global(), threadObj);
|
_threadObj = OopHandle(_thread_service_storage, threadObj);
|
||||||
|
|
||||||
ThreadStatistics* stat = thread->get_thread_stat();
|
ThreadStatistics* stat = thread->get_thread_stat();
|
||||||
_contended_enter_ticks = stat->contended_enter_ticks();
|
_contended_enter_ticks = stat->contended_enter_ticks();
|
||||||
|
@ -910,10 +917,10 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocker_object != NULL) {
|
if (blocker_object != NULL) {
|
||||||
_blocker_object = OopHandle(Universe::vm_global(), blocker_object);
|
_blocker_object = OopHandle(_thread_service_storage, blocker_object);
|
||||||
}
|
}
|
||||||
if (blocker_object_owner != NULL) {
|
if (blocker_object_owner != NULL) {
|
||||||
_blocker_object_owner = OopHandle(Universe::vm_global(), blocker_object_owner);
|
_blocker_object_owner = OopHandle(_thread_service_storage, blocker_object_owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,9 +928,9 @@ oop ThreadSnapshot::blocker_object() const { return _blocker_object.re
|
||||||
oop ThreadSnapshot::blocker_object_owner() const { return _blocker_object_owner.resolve(); }
|
oop ThreadSnapshot::blocker_object_owner() const { return _blocker_object_owner.resolve(); }
|
||||||
|
|
||||||
ThreadSnapshot::~ThreadSnapshot() {
|
ThreadSnapshot::~ThreadSnapshot() {
|
||||||
_blocker_object.release(Universe::vm_global());
|
_blocker_object.release(_thread_service_storage);
|
||||||
_blocker_object_owner.release(Universe::vm_global());
|
_blocker_object_owner.release(_thread_service_storage);
|
||||||
_threadObj.release(Universe::vm_global());
|
_threadObj.release(_thread_service_storage);
|
||||||
|
|
||||||
delete _stack_trace;
|
delete _stack_trace;
|
||||||
delete _concurrent_locks;
|
delete _concurrent_locks;
|
||||||
|
|
|
@ -95,6 +95,8 @@ public class TestG1ParallelPhases {
|
||||||
"VM Global",
|
"VM Global",
|
||||||
"JNI Global",
|
"JNI Global",
|
||||||
"Thread OopStorage",
|
"Thread OopStorage",
|
||||||
|
"ThreadService OopStorage",
|
||||||
|
"JVMTI OopStorage",
|
||||||
"CLDGRoots",
|
"CLDGRoots",
|
||||||
"CMRefRoots",
|
"CMRefRoots",
|
||||||
"MergeER",
|
"MergeER",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue