< prev index next >

src/hotspot/share/runtime/vmThread.cpp

Print this page
rev 56635 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch; merge with 8230876.patch; merge with jdk-14+15; merge with jdk-14+18.


  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileBroker.hpp"
  27 #include "gc/shared/collectedHeap.hpp"
  28 #include "jfr/jfrEvents.hpp"
  29 #include "jfr/support/jfrThreadId.hpp"
  30 #include "logging/log.hpp"
  31 #include "logging/logStream.hpp"
  32 #include "logging/logConfiguration.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "memory/universe.hpp"
  35 #include "oops/method.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "oops/verifyOopClosure.hpp"
  38 #include "runtime/handles.inline.hpp"
  39 #include "runtime/interfaceSupport.inline.hpp"
  40 #include "runtime/mutexLocker.hpp"
  41 #include "runtime/os.hpp"
  42 #include "runtime/safepoint.hpp"

  43 #include "runtime/thread.inline.hpp"
  44 #include "runtime/vmThread.hpp"
  45 #include "runtime/vmOperations.hpp"
  46 #include "services/runtimeService.hpp"
  47 #include "utilities/dtrace.hpp"
  48 #include "utilities/events.hpp"
  49 #include "utilities/vmError.hpp"
  50 #include "utilities/xmlstream.hpp"
  51 
  52 VMOperationQueue::VMOperationQueue() {
  53   // The queue is a circular doubled-linked list, which always contains
  54   // one element (i.e., one element means empty).
  55   for(int i = 0; i < nof_priorities; i++) {
  56     _queue_length[i] = 0;
  57     _queue_counter = 0;
  58     _queue[i] = new VM_None("QueueHead");
  59     _queue[i]->set_next(_queue[i]);
  60     _queue[i]->set_prev(_queue[i]);
  61   }
  62   _drain_list = NULL;


 293     : VMThreadPriority;
 294   // Note that I cannot call os::set_priority because it expects Java
 295   // priorities and I am *explicitly* using OS priorities so that it's
 296   // possible to set the VM thread priority higher than any Java thread.
 297   os::set_native_priority( this, prio );
 298 
 299   // Wait for VM_Operations until termination
 300   this->loop();
 301 
 302   // Note the intention to exit before safepointing.
 303   // 6295565  This has the effect of waiting for any large tty
 304   // outputs to finish.
 305   if (xtty != NULL) {
 306     ttyLocker ttyl;
 307     xtty->begin_elem("destroy_vm");
 308     xtty->stamp();
 309     xtty->end_elem();
 310     assert(should_terminate(), "termination flag must be set");
 311   }
 312 








 313   // 4526887 let VM thread exit at Safepoint
 314   _cur_vm_operation = &halt_op;
 315   SafepointSynchronize::begin();
 316 
 317   if (VerifyBeforeExit) {
 318     HandleMark hm(VMThread::vm_thread());
 319     // Among other things, this ensures that Eden top is correct.
 320     Universe::heap()->prepare_for_verify();
 321     // Silent verification so as not to pollute normal output,
 322     // unless we really asked for it.
 323     Universe::verify();
 324   }
 325 
 326   CompileBroker::set_should_block();
 327 
 328   // wait for threads (compiler threads or daemon threads) in the
 329   // _thread_in_native state to block.
 330   VM_Exit::wait_for_threads_in_native_to_block();
 331 
 332   // signal other threads that VM process is gone




  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileBroker.hpp"
  27 #include "gc/shared/collectedHeap.hpp"
  28 #include "jfr/jfrEvents.hpp"
  29 #include "jfr/support/jfrThreadId.hpp"
  30 #include "logging/log.hpp"
  31 #include "logging/logStream.hpp"
  32 #include "logging/logConfiguration.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "memory/universe.hpp"
  35 #include "oops/method.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "oops/verifyOopClosure.hpp"
  38 #include "runtime/handles.inline.hpp"
  39 #include "runtime/interfaceSupport.inline.hpp"
  40 #include "runtime/mutexLocker.hpp"
  41 #include "runtime/os.hpp"
  42 #include "runtime/safepoint.hpp"
  43 #include "runtime/synchronizer.hpp"
  44 #include "runtime/thread.inline.hpp"
  45 #include "runtime/vmThread.hpp"
  46 #include "runtime/vmOperations.hpp"
  47 #include "services/runtimeService.hpp"
  48 #include "utilities/dtrace.hpp"
  49 #include "utilities/events.hpp"
  50 #include "utilities/vmError.hpp"
  51 #include "utilities/xmlstream.hpp"
  52 
  53 VMOperationQueue::VMOperationQueue() {
  54   // The queue is a circular doubled-linked list, which always contains
  55   // one element (i.e., one element means empty).
  56   for(int i = 0; i < nof_priorities; i++) {
  57     _queue_length[i] = 0;
  58     _queue_counter = 0;
  59     _queue[i] = new VM_None("QueueHead");
  60     _queue[i]->set_next(_queue[i]);
  61     _queue[i]->set_prev(_queue[i]);
  62   }
  63   _drain_list = NULL;


 294     : VMThreadPriority;
 295   // Note that I cannot call os::set_priority because it expects Java
 296   // priorities and I am *explicitly* using OS priorities so that it's
 297   // possible to set the VM thread priority higher than any Java thread.
 298   os::set_native_priority( this, prio );
 299 
 300   // Wait for VM_Operations until termination
 301   this->loop();
 302 
 303   // Note the intention to exit before safepointing.
 304   // 6295565  This has the effect of waiting for any large tty
 305   // outputs to finish.
 306   if (xtty != NULL) {
 307     ttyLocker ttyl;
 308     xtty->begin_elem("destroy_vm");
 309     xtty->stamp();
 310     xtty->end_elem();
 311     assert(should_terminate(), "termination flag must be set");
 312   }
 313 
 314   if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
 315     // AsyncDeflateIdleMonitors does a special deflation at the final
 316     // safepoint in order to reduce the in-use monitor population that
 317     // is reported by ObjectSynchronizer::log_in_use_monitor_details()
 318     // at VM exit.
 319     ObjectSynchronizer::set_is_special_deflation_requested(true);
 320   }
 321 
 322   // 4526887 let VM thread exit at Safepoint
 323   _cur_vm_operation = &halt_op;
 324   SafepointSynchronize::begin();
 325 
 326   if (VerifyBeforeExit) {
 327     HandleMark hm(VMThread::vm_thread());
 328     // Among other things, this ensures that Eden top is correct.
 329     Universe::heap()->prepare_for_verify();
 330     // Silent verification so as not to pollute normal output,
 331     // unless we really asked for it.
 332     Universe::verify();
 333   }
 334 
 335   CompileBroker::set_should_block();
 336 
 337   // wait for threads (compiler threads or daemon threads) in the
 338   // _thread_in_native state to block.
 339   VM_Exit::wait_for_threads_in_native_to_block();
 340 
 341   // signal other threads that VM process is gone


< prev index next >