@@ -929,13 +929,13 @@ JvmtiEnv::GetAllThreads(jint* threads_count_ptr, jthread** threads_ptr) {
929929jvmtiError
930930JvmtiEnv::SuspendThread (jthread thread) {
931931 JavaThread* current = JavaThread::current ();
932- ThreadsListHandle tlh (current);
933932
934933 jvmtiError err;
935934 JavaThread* java_thread = NULL ;
936935 oop thread_oop = NULL ;
937936 {
938937 JvmtiVTMSTransitionDisabler disabler (true );
938+ ThreadsListHandle tlh (current);
939939
940940 err = get_threadOop_and_JavaThread (tlh.list (), thread, &java_thread, &thread_oop);
941941 if (err != JVMTI_ERROR_NONE) {
@@ -960,13 +960,13 @@ JvmtiEnv::SuspendThread(jthread thread) {
960960jvmtiError
961961JvmtiEnv::SuspendThreadList (jint request_count, const jthread* request_list, jvmtiError* results) {
962962 JavaThread* current = JavaThread::current ();
963- ThreadsListHandle tlh (current);
964963 HandleMark hm (current);
965964 Handle self_tobj = Handle (current, NULL );
966965 int self_idx = -1 ;
967966
968967 {
969968 JvmtiVTMSTransitionDisabler disabler (true );
969+ ThreadsListHandle tlh (current);
970970
971971 for (int i = 0 ; i < request_count; i++) {
972972 JavaThread *java_thread = NULL ;
@@ -1013,19 +1013,20 @@ JvmtiEnv::SuspendAllVirtualThreads(jint except_count, const jthread* except_list
10131013 return JVMTI_ERROR_NONE; // Nothing to do when there are no virtual threads;
10141014 }
10151015 JavaThread* current = JavaThread::current ();
1016- ThreadsListHandle tlh (current);
1017- jvmtiError err = JvmtiEnvBase::check_thread_list (except_count, except_list);
1018- if (err != JVMTI_ERROR_NONE) {
1019- return err;
1020- }
10211016 HandleMark hm (current);
10221017 Handle self_tobj = Handle (current, NULL );
10231018
10241019 {
10251020 ResourceMark rm (current);
10261021 JvmtiVTMSTransitionDisabler disabler (true );
1022+ ThreadsListHandle tlh (current);
10271023 GrowableArray<jthread>* elist = new GrowableArray<jthread>(except_count);
10281024
1025+ jvmtiError err = JvmtiEnvBase::check_thread_list (except_count, except_list);
1026+ if (err != JVMTI_ERROR_NONE) {
1027+ return err;
1028+ }
1029+
10291030 // Collect threads from except_list for which resumed status must be restored.
10301031 for (int idx = 0 ; idx < except_count; idx++) {
10311032 jthread thread = except_list[idx];
0 commit comments