8290908: misc tests fail: assert(!thread->owns_locks()) failed: must release all locks when leaving VM

Reviewed-by: cjplummer, amenkov
This commit is contained in:
Serguei Spitsyn 2022-08-02 22:41:17 +00:00
parent 5acf2d7cb4
commit 0ae8341057

View File

@ -892,10 +892,6 @@ JvmtiEventControllerPrivate::set_user_enabled(JvmtiEnvBase *env, JavaThread *thr
thread==NULL? "ALL": JvmtiTrace::safe_get_thread_name(thread),
enabled? "enabled" : "disabled", JvmtiTrace::event_name(event_type)));
if (event_type == JVMTI_EVENT_OBJECT_FREE) {
flush_object_free_events(env);
}
if (thread == NULL && thread_oop_h() == NULL) {
// NULL thread and NULL thread_oop now indicate setting globally instead
// of setting thread specific since NULL thread by itself means an
@ -1048,6 +1044,10 @@ JvmtiEventController::is_global_event(jvmtiEvent event_type) {
void
JvmtiEventController::set_user_enabled(JvmtiEnvBase *env, JavaThread *thread, oop thread_oop,
jvmtiEvent event_type, bool enabled) {
if (event_type == JVMTI_EVENT_OBJECT_FREE) {
JvmtiEventControllerPrivate::flush_object_free_events(env);
}
if (Threads::number_of_threads() == 0) {
// during early VM start-up locks don't exist, but we are safely single threaded,
// call the functionality without holding the JvmtiThreadState_lock.