Skip to content

Commit 441bd12

Browse files
author
Serguei Spitsyn
committed
8352812: remove useless class and function parameter in SuspendThread impl
Reviewed-by: lmesnik, cjplummer
1 parent e83cccf commit 441bd12

File tree

5 files changed

+10
-68
lines changed

5 files changed

+10
-68
lines changed

src/hotspot/share/prims/jvmtiEnv.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -940,14 +940,14 @@ JvmtiEnv::SuspendThread(jthread thread) {
940940

941941
// Do not use JvmtiVTMSTransitionDisabler in context of self suspend to avoid deadlocks.
942942
if (java_thread != current) {
943-
err = suspend_thread(thread_oop, java_thread, /* single_suspend */ true, nullptr);
943+
err = suspend_thread(thread_oop, java_thread, /* single_suspend */ true);
944944
return err;
945945
}
946946
// protect thread_oop as a safepoint can be reached in disabler destructor
947947
self_tobj = Handle(current, thread_oop);
948948
}
949949
// Do self suspend for current JavaThread.
950-
err = suspend_thread(self_tobj(), current, /* single_suspend */ true, nullptr);
950+
err = suspend_thread(self_tobj(), current, /* single_suspend */ true);
951951
return err;
952952
} /* end SuspendThread */
953953

@@ -988,14 +988,14 @@ JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvm
988988
self_tobj = Handle(current, thread_oop);
989989
continue; // self suspend after all other suspends
990990
}
991-
results[i] = suspend_thread(thread_oop, java_thread, /* single_suspend */ true, nullptr);
991+
results[i] = suspend_thread(thread_oop, java_thread, /* single_suspend */ true);
992992
}
993993
}
994994
// Self suspend after all other suspends if necessary.
995995
// Do not use JvmtiVTMSTransitionDisabler in context of self suspend to avoid deadlocks.
996996
if (self_tobj() != nullptr) {
997997
// there should not be any error for current java_thread
998-
results[self_idx] = suspend_thread(self_tobj(), current, /* single_suspend */ true, nullptr);
998+
results[self_idx] = suspend_thread(self_tobj(), current, /* single_suspend */ true);
999999
}
10001000
// per-thread suspend results returned via results parameter
10011001
return JVMTI_ERROR_NONE;
@@ -1048,7 +1048,7 @@ JvmtiEnv::SuspendAllVirtualThreads(jint except_count, const jthread* except_list
10481048
self_tobj = Handle(current, vt_oop);
10491049
continue; // self suspend after all other suspends
10501050
}
1051-
suspend_thread(vt_oop, java_thread, /* single_suspend */ false, nullptr);
1051+
suspend_thread(vt_oop, java_thread, /* single_suspend */ false);
10521052
}
10531053
}
10541054
JvmtiVTSuspender::register_all_vthreads_suspend();
@@ -1065,7 +1065,7 @@ JvmtiEnv::SuspendAllVirtualThreads(jint except_count, const jthread* except_list
10651065
// Self suspend after all other suspends if necessary.
10661066
// Do not use JvmtiVTMSTransitionDisabler in context of self suspend to avoid deadlocks.
10671067
if (self_tobj() != nullptr) {
1068-
suspend_thread(self_tobj(), current, /* single_suspend */ false, nullptr);
1068+
suspend_thread(self_tobj(), current, /* single_suspend */ false);
10691069
}
10701070
return JVMTI_ERROR_NONE;
10711071
} /* end SuspendAllVirtualThreads */

src/hotspot/share/prims/jvmtiEnvBase.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,8 +1750,7 @@ JvmtiEnvBase::disable_virtual_threads_notify_jvmti() {
17501750

17511751
// java_thread - protected by ThreadsListHandle
17521752
jvmtiError
1753-
JvmtiEnvBase::suspend_thread(oop thread_oop, JavaThread* java_thread, bool single_suspend,
1754-
int* need_safepoint_p) {
1753+
JvmtiEnvBase::suspend_thread(oop thread_oop, JavaThread* java_thread, bool single_suspend) {
17551754
JavaThread* current = JavaThread::current();
17561755
HandleMark hm(current);
17571756
Handle thread_h(current, thread_oop);
@@ -1807,7 +1806,7 @@ JvmtiEnvBase::suspend_thread(oop thread_oop, JavaThread* java_thread, bool singl
18071806
assert(single_suspend || thread_h()->is_a(vmClasses::BaseVirtualThread_klass()),
18081807
"SuspendAllVirtualThreads should never suspend non-virtual threads");
18091808
// Case of mounted virtual or attached carrier thread.
1810-
if (!JvmtiSuspendControl::suspend(java_thread)) {
1809+
if (!java_thread->java_suspend()) {
18111810
// Thread is already suspended or in process of exiting.
18121811
if (java_thread->is_exiting()) {
18131812
// The thread was in the process of exiting.
@@ -1869,7 +1868,7 @@ JvmtiEnvBase::resume_thread(oop thread_oop, JavaThread* java_thread, bool single
18691868
assert(single_resume || thread_h()->is_a(vmClasses::BaseVirtualThread_klass()),
18701869
"ResumeAllVirtualThreads should never resume non-virtual threads");
18711870
if (java_thread->is_suspended()) {
1872-
if (!JvmtiSuspendControl::resume(java_thread)) {
1871+
if (!java_thread->java_resume()) {
18731872
return JVMTI_ERROR_THREAD_NOT_SUSPENDED;
18741873
}
18751874
}

src/hotspot/share/prims/jvmtiEnvBase.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
9090
// It is unsafe to use this function when virtual threads are executed.
9191
static bool disable_virtual_threads_notify_jvmti();
9292

93-
static jvmtiError suspend_thread(oop thread_oop, JavaThread* java_thread, bool single_suspend,
94-
int* need_safepoint_p);
93+
static jvmtiError suspend_thread(oop thread_oop, JavaThread* java_thread, bool single_suspend);
9594
static jvmtiError resume_thread(oop thread_oop, JavaThread* java_thread, bool single_resume);
9695
static jvmtiError check_thread_list(jint count, const jthread* list);
9796
static bool is_in_thread_list(jint count, const jthread* list, oop jt_oop);

src/hotspot/share/prims/jvmtiImpl.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -745,40 +745,6 @@ VM_VirtualThreadGetReceiver::VM_VirtualThreadGetReceiver(
745745
: VM_VirtualThreadGetOrSetLocal(env, vthread_h, caller_thread, depth, 0, self) {}
746746

747747

748-
/////////////////////////////////////////////////////////////////////////////////////////
749-
//
750-
// class JvmtiSuspendControl - see comments in jvmtiImpl.hpp
751-
//
752-
753-
bool JvmtiSuspendControl::suspend(JavaThread *java_thread) {
754-
return java_thread->java_suspend();
755-
}
756-
757-
bool JvmtiSuspendControl::resume(JavaThread *java_thread) {
758-
return java_thread->java_resume();
759-
}
760-
761-
void JvmtiSuspendControl::print() {
762-
#ifndef PRODUCT
763-
ResourceMark rm;
764-
LogStreamHandle(Trace, jvmti) log_stream;
765-
log_stream.print("Suspended Threads: [");
766-
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
767-
#ifdef JVMTI_TRACE
768-
const char *name = JvmtiTrace::safe_get_thread_name(thread);
769-
#else
770-
const char *name = "";
771-
#endif /*JVMTI_TRACE */
772-
log_stream.print("%s(%c ", name, thread->is_suspended() ? 'S' : '_');
773-
if (!thread->has_last_Java_frame()) {
774-
log_stream.print("no stack");
775-
}
776-
log_stream.print(") ");
777-
}
778-
log_stream.print_cr("]");
779-
#endif
780-
}
781-
782748
JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
783749
nmethod* nm) {
784750
JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_LOAD);

src/hotspot/share/prims/jvmtiImpl.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -278,28 +278,6 @@ class VM_VirtualThreadGetReceiver : public VM_VirtualThreadGetOrSetLocal {
278278
};
279279

280280

281-
///////////////////////////////////////////////////////////////
282-
//
283-
// class JvmtiSuspendControl
284-
//
285-
// Convenience routines for suspending and resuming threads.
286-
//
287-
// All attempts by JVMTI to suspend and resume threads must go through the
288-
// JvmtiSuspendControl interface.
289-
//
290-
// methods return true if successful
291-
//
292-
class JvmtiSuspendControl : public AllStatic {
293-
public:
294-
// suspend the thread, taking it to a safepoint
295-
static bool suspend(JavaThread *java_thread);
296-
// resume the thread
297-
static bool resume(JavaThread *java_thread);
298-
299-
static void print();
300-
};
301-
302-
303281
/**
304282
* When a thread (such as the compiler thread or VM thread) cannot post a
305283
* JVMTI event itself because the event needs to be posted from a Java

0 commit comments

Comments
 (0)