8326106: Write and clear stack trace table outside of safepoint
Reviewed-by: egahlin
This commit is contained in:
parent
56c50841ee
commit
a776104e21
@ -223,9 +223,6 @@ class StackTraceBlobInstaller {
|
|||||||
StackTraceBlobInstaller() : _cache(JfrOptionSet::old_object_queue_size()) {
|
StackTraceBlobInstaller() : _cache(JfrOptionSet::old_object_queue_size()) {
|
||||||
prepare_for_resolution();
|
prepare_for_resolution();
|
||||||
}
|
}
|
||||||
~StackTraceBlobInstaller() {
|
|
||||||
JfrStackTraceRepository::clear_leak_profiler();
|
|
||||||
}
|
|
||||||
void sample_do(ObjectSample* sample) {
|
void sample_do(ObjectSample* sample) {
|
||||||
if (stack_trace_precondition(sample)) {
|
if (stack_trace_precondition(sample)) {
|
||||||
add_to_leakp_set(sample);
|
add_to_leakp_set(sample);
|
||||||
@ -280,11 +277,14 @@ void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler) {
|
|||||||
assert(LeakProfiler::is_running(), "invariant");
|
assert(LeakProfiler::is_running(), "invariant");
|
||||||
JavaThread* const thread = JavaThread::current();
|
JavaThread* const thread = JavaThread::current();
|
||||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(thread);)
|
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(thread);)
|
||||||
// can safepoint here
|
{
|
||||||
ThreadInVMfromNative transition(thread);
|
// can safepoint here
|
||||||
MutexLocker lock(ClassLoaderDataGraph_lock);
|
ThreadInVMfromNative transition(thread);
|
||||||
// the lock is needed to ensure the unload lists do not grow in the middle of inspection.
|
MutexLocker lock(ClassLoaderDataGraph_lock);
|
||||||
install_stack_traces(sampler);
|
// the lock is needed to ensure the unload lists do not grow in the middle of inspection.
|
||||||
|
install_stack_traces(sampler);
|
||||||
|
}
|
||||||
|
JfrStackTraceRepository::clear_leak_profiler();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_klass_unloaded(traceid klass_id) {
|
static bool is_klass_unloaded(traceid klass_id) {
|
||||||
|
@ -573,9 +573,7 @@ void JfrRecorderService::pre_safepoint_write() {
|
|||||||
ObjectSampleCheckpoint::on_rotation(ObjectSampler::acquire());
|
ObjectSampleCheckpoint::on_rotation(ObjectSampler::acquire());
|
||||||
}
|
}
|
||||||
write_storage(_storage, _chunkwriter);
|
write_storage(_storage, _chunkwriter);
|
||||||
if (_stack_trace_repository.is_modified()) {
|
write_stacktrace(_stack_trace_repository, _chunkwriter, true);
|
||||||
write_stacktrace(_stack_trace_repository, _chunkwriter, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JfrRecorderService::invoke_safepoint_write() {
|
void JfrRecorderService::invoke_safepoint_write() {
|
||||||
|
@ -98,11 +98,10 @@ bool JfrStackTraceRepository::is_modified() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t JfrStackTraceRepository::write(JfrChunkWriter& sw, bool clear) {
|
size_t JfrStackTraceRepository::write(JfrChunkWriter& sw, bool clear) {
|
||||||
|
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||||
if (_entries == 0) {
|
if (_entries == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
|
||||||
assert(_entries > 0, "invariant");
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (u4 i = 0; i < TABLE_SIZE; ++i) {
|
for (u4 i = 0; i < TABLE_SIZE; ++i) {
|
||||||
JfrStackTrace* stacktrace = _table[i];
|
JfrStackTrace* stacktrace = _table[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user