< prev index next >

src/hotspot/share/runtime/vmThread.cpp

Print this page
rev 57595 : v2.09a with 8235795, 8235931 and 8236035 extracted; rebased to jdk-14+28; merge with 8236035.patch.cr1; merge with 8235795.patch.cr1; merge with 8236035.patch.cr2; merge with 8235795.patch.cr2; merge with 8235795.patch.cr3.


  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/atomic.hpp"
  39 #include "runtime/handles.inline.hpp"
  40 #include "runtime/interfaceSupport.inline.hpp"
  41 #include "runtime/mutexLocker.hpp"
  42 #include "runtime/os.hpp"
  43 #include "runtime/safepoint.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 VM_QueueHead VMOperationQueue::_queue_head[VMOperationQueue::nof_priorities];
  54 
  55 VMOperationQueue::VMOperationQueue() {
  56   // The queue is a circular doubled-linked list, which always contains
  57   // one element (i.e., one element means empty).
  58   for(int i = 0; i < nof_priorities; i++) {
  59     _queue_length[i] = 0;
  60     _queue_counter = 0;
  61     _queue[i] = &_queue_head[i];
  62     _queue[i]->set_next(_queue[i]);
  63     _queue[i]->set_prev(_queue[i]);


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








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




  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/atomic.hpp"
  39 #include "runtime/handles.inline.hpp"
  40 #include "runtime/interfaceSupport.inline.hpp"
  41 #include "runtime/mutexLocker.hpp"
  42 #include "runtime/os.hpp"
  43 #include "runtime/safepoint.hpp"
  44 #include "runtime/synchronizer.hpp"
  45 #include "runtime/thread.inline.hpp"
  46 #include "runtime/vmThread.hpp"
  47 #include "runtime/vmOperations.hpp"
  48 #include "services/runtimeService.hpp"
  49 #include "utilities/dtrace.hpp"
  50 #include "utilities/events.hpp"
  51 #include "utilities/vmError.hpp"
  52 #include "utilities/xmlstream.hpp"
  53 
  54 VM_QueueHead VMOperationQueue::_queue_head[VMOperationQueue::nof_priorities];
  55 
  56 VMOperationQueue::VMOperationQueue() {
  57   // The queue is a circular doubled-linked list, which always contains
  58   // one element (i.e., one element means empty).
  59   for(int i = 0; i < nof_priorities; i++) {
  60     _queue_length[i] = 0;
  61     _queue_counter = 0;
  62     _queue[i] = &_queue_head[i];
  63     _queue[i]->set_next(_queue[i]);
  64     _queue[i]->set_prev(_queue[i]);


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


< prev index next >