< prev index next >

src/hotspot/share/prims/jvmtiThreadState.cpp

Print this page

   1 /*
   2  * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

 646 
 647 void
 648 JvmtiVTMSTransitionDisabler::VTMS_unmount_begin(jobject vthread, bool last_unmount) {
 649   JavaThread* thread = JavaThread::current();
 650 
 651   assert(!thread->is_in_tmp_VTMS_transition(), "sanity check");
 652   assert(!thread->is_in_VTMS_transition(), "sanity check");
 653 
 654   start_VTMS_transition(vthread, /* is_mount */ false);
 655   if (!last_unmount) {
 656     thread->rebind_to_jvmti_thread_state_of(thread->threadObj());
 657   }
 658 }
 659 
 660 void
 661 JvmtiVTMSTransitionDisabler::VTMS_unmount_end(jobject vthread) {
 662   JavaThread* thread = JavaThread::current();
 663   assert(thread->is_in_VTMS_transition(), "sanity check");
 664   assert(!thread->is_in_tmp_VTMS_transition(), "sanity check");
 665   finish_VTMS_transition(vthread, /* is_mount */ false);






 666 }
 667 
 668 
 669 //
 670 // Virtual Threads Suspend/Resume management
 671 //
 672 
 673 JvmtiVTSuspender::SR_Mode
 674 JvmtiVTSuspender::_SR_mode = SR_none;
 675 
 676 VirtualThreadList*
 677 JvmtiVTSuspender::_suspended_list = new VirtualThreadList();
 678 
 679 VirtualThreadList*
 680 JvmtiVTSuspender::_not_suspended_list = new VirtualThreadList();
 681 
 682 void
 683 JvmtiVTSuspender::register_all_vthreads_suspend() {
 684   MonitorLocker ml(JvmtiVTMSTransition_lock);
 685 

   1 /*
   2  * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

 646 
 647 void
 648 JvmtiVTMSTransitionDisabler::VTMS_unmount_begin(jobject vthread, bool last_unmount) {
 649   JavaThread* thread = JavaThread::current();
 650 
 651   assert(!thread->is_in_tmp_VTMS_transition(), "sanity check");
 652   assert(!thread->is_in_VTMS_transition(), "sanity check");
 653 
 654   start_VTMS_transition(vthread, /* is_mount */ false);
 655   if (!last_unmount) {
 656     thread->rebind_to_jvmti_thread_state_of(thread->threadObj());
 657   }
 658 }
 659 
 660 void
 661 JvmtiVTMSTransitionDisabler::VTMS_unmount_end(jobject vthread) {
 662   JavaThread* thread = JavaThread::current();
 663   assert(thread->is_in_VTMS_transition(), "sanity check");
 664   assert(!thread->is_in_tmp_VTMS_transition(), "sanity check");
 665   finish_VTMS_transition(vthread, /* is_mount */ false);
 666 
 667   if (thread->pending_jvmti_unmount_event()) {
 668     assert(java_lang_VirtualThread::is_preempted(JNIHandles::resolve(vthread)), "should be marked preempted");
 669     JvmtiExport::post_vthread_unmount(vthread);
 670     thread->set_pending_jvmti_unmount_event(false);
 671   }
 672 }
 673 
 674 
 675 //
 676 // Virtual Threads Suspend/Resume management
 677 //
 678 
 679 JvmtiVTSuspender::SR_Mode
 680 JvmtiVTSuspender::_SR_mode = SR_none;
 681 
 682 VirtualThreadList*
 683 JvmtiVTSuspender::_suspended_list = new VirtualThreadList();
 684 
 685 VirtualThreadList*
 686 JvmtiVTSuspender::_not_suspended_list = new VirtualThreadList();
 687 
 688 void
 689 JvmtiVTSuspender::register_all_vthreads_suspend() {
 690   MonitorLocker ml(JvmtiVTMSTransition_lock);
 691 
< prev index next >