Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247967: SparkExamples24H.java SIGSEGV in various places
Reviewed-by: dcubed, dholmes
  • Loading branch information
Markus Grönlund committed Jun 23, 2020
1 parent e66a2a3 commit 4bcd70acc09dbad1a6f50d8d4ce2073df9f0edc4
Showing 1 changed file with 16 additions and 24 deletions.
@@ -427,34 +427,26 @@ void JfrCheckpointManager::on_unloading_classes() {
}
}

class JavaThreadToVM : public StackObj {
private:
JavaThread* _jt;
public:
JavaThreadToVM(Thread* thread) : _jt(thread->is_Java_thread() ? (JavaThread*)thread : NULL) {
if (_jt != NULL) {
assert(_jt->thread_state() == _thread_in_native, "invariant");
_jt->set_thread_state(_thread_in_vm);
}
}
~JavaThreadToVM() {
if (_jt != NULL) {
_jt->set_thread_state(_thread_in_native);
}
}
};
static size_t flush_type_set(Thread* thread) {
assert(thread != NULL, "invariant");
JfrCheckpointWriter writer(thread);
MutexLocker cld_lock(thread, ClassLoaderDataGraph_lock);
MutexLocker module_lock(thread, Module_lock);
return JfrTypeSet::serialize(&writer, NULL, false, true);
}

size_t JfrCheckpointManager::flush_type_set() {
size_t elements = 0;
if (JfrTraceIdEpoch::has_changed_tag_state()) {
Thread* const t = Thread::current();
// can safepoint here (if JavaThread)
JavaThreadToVM transition(t);
ResetNoHandleMark rnhm;
MutexLocker cld_lock(t, ClassLoaderDataGraph_lock);
MutexLocker module_lock(t, Module_lock);
JfrCheckpointWriter writer(t);
elements = JfrTypeSet::serialize(&writer, NULL, false, true);
Thread* const thread = Thread::current();
if (thread->is_Java_thread()) {
// can safepoint here
ThreadInVMfromNative transition((JavaThread*)thread);
ResetNoHandleMark rnhm;
elements = ::flush_type_set(thread);
} else {
elements = ::flush_type_set(thread);
}
}
if (is_constant_pending()) {
WriteOperation wo(_chunkwriter);

0 comments on commit 4bcd70a

Please sign in to comment.