src/hotspot/share/runtime/thread.cpp
changeset 47881 0ce0ac68ace7
parent 47799 1772ebf07d1f
child 47903 7f22774a5f42
equal deleted inserted replaced
47824:cf127be65014 47881:0ce0ac68ace7
    63 #include "runtime/commandLineFlagWriteableList.hpp"
    63 #include "runtime/commandLineFlagWriteableList.hpp"
    64 #include "runtime/commandLineFlagRangeList.hpp"
    64 #include "runtime/commandLineFlagRangeList.hpp"
    65 #include "runtime/deoptimization.hpp"
    65 #include "runtime/deoptimization.hpp"
    66 #include "runtime/frame.inline.hpp"
    66 #include "runtime/frame.inline.hpp"
    67 #include "runtime/globals.hpp"
    67 #include "runtime/globals.hpp"
       
    68 #include "runtime/handshake.hpp"
    68 #include "runtime/init.hpp"
    69 #include "runtime/init.hpp"
    69 #include "runtime/interfaceSupport.hpp"
    70 #include "runtime/interfaceSupport.hpp"
    70 #include "runtime/java.hpp"
    71 #include "runtime/java.hpp"
    71 #include "runtime/javaCalls.hpp"
    72 #include "runtime/javaCalls.hpp"
    72 #include "runtime/jniPeriodicChecker.hpp"
    73 #include "runtime/jniPeriodicChecker.hpp"
    75 #include "runtime/mutexLocker.hpp"
    76 #include "runtime/mutexLocker.hpp"
    76 #include "runtime/objectMonitor.hpp"
    77 #include "runtime/objectMonitor.hpp"
    77 #include "runtime/orderAccess.inline.hpp"
    78 #include "runtime/orderAccess.inline.hpp"
    78 #include "runtime/osThread.hpp"
    79 #include "runtime/osThread.hpp"
    79 #include "runtime/safepoint.hpp"
    80 #include "runtime/safepoint.hpp"
       
    81 #include "runtime/safepointMechanism.inline.hpp"
    80 #include "runtime/sharedRuntime.hpp"
    82 #include "runtime/sharedRuntime.hpp"
    81 #include "runtime/statSampler.hpp"
    83 #include "runtime/statSampler.hpp"
    82 #include "runtime/stubRoutines.hpp"
    84 #include "runtime/stubRoutines.hpp"
    83 #include "runtime/sweeper.hpp"
    85 #include "runtime/sweeper.hpp"
    84 #include "runtime/task.hpp"
    86 #include "runtime/task.hpp"
  1492   _popframe_condition = popframe_inactive;
  1494   _popframe_condition = popframe_inactive;
  1493   _popframe_preserved_args = NULL;
  1495   _popframe_preserved_args = NULL;
  1494   _popframe_preserved_args_size = 0;
  1496   _popframe_preserved_args_size = 0;
  1495   _frames_to_pop_failed_realloc = 0;
  1497   _frames_to_pop_failed_realloc = 0;
  1496 
  1498 
       
  1499   if (SafepointMechanism::uses_thread_local_poll()) {
       
  1500     SafepointMechanism::initialize_header(this);
       
  1501   }
       
  1502 
  1497   pd_initialize();
  1503   pd_initialize();
  1498 }
  1504 }
  1499 
  1505 
  1500 #if INCLUDE_ALL_GCS
  1506 #if INCLUDE_ALL_GCS
  1501 SATBMarkQueueSet JavaThread::_satb_mark_queue_set;
  1507 SATBMarkQueueSet JavaThread::_satb_mark_queue_set;
  1908     exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
  1914     exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
  1909     os::current_thread_id());
  1915     os::current_thread_id());
  1910 
  1916 
  1911   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
  1917   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
  1912   Threads::remove(this);
  1918   Threads::remove(this);
       
  1919 
       
  1920   // If someone set a handshake on us just as we entered exit path, we simple cancel it.
       
  1921   if (ThreadLocalHandshakes) {
       
  1922     cancel_handshake();
       
  1923   }
  1913 }
  1924 }
  1914 
  1925 
  1915 #if INCLUDE_ALL_GCS
  1926 #if INCLUDE_ALL_GCS
  1916 // Flush G1-related queues.
  1927 // Flush G1-related queues.
  1917 void JavaThread::flush_barrier_queues() {
  1928 void JavaThread::flush_barrier_queues() {
  2370     thread->set_thread_state(state);
  2381     thread->set_thread_state(state);
  2371 
  2382 
  2372     InterfaceSupport::serialize_thread_state_with_handler(thread);
  2383     InterfaceSupport::serialize_thread_state_with_handler(thread);
  2373   }
  2384   }
  2374 
  2385 
  2375   if (SafepointSynchronize::do_call_back()) {
  2386   SafepointMechanism::block_if_requested(curJT);
  2376     // If we are safepointing, then block the caller which may not be
       
  2377     // the same as the target thread (see above).
       
  2378     SafepointSynchronize::block(curJT);
       
  2379   }
       
  2380 
  2387 
  2381   if (thread->is_deopt_suspend()) {
  2388   if (thread->is_deopt_suspend()) {
  2382     thread->clear_deopt_suspend();
  2389     thread->clear_deopt_suspend();
  2383     RegisterMap map(thread, false);
  2390     RegisterMap map(thread, false);
  2384     frame f = thread->last_frame();
  2391     frame f = thread->last_frame();
  3548 
  3555 
  3549   HOTSPOT_VM_INIT_BEGIN();
  3556   HOTSPOT_VM_INIT_BEGIN();
  3550 
  3557 
  3551   // Timing (must come after argument parsing)
  3558   // Timing (must come after argument parsing)
  3552   TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
  3559   TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
       
  3560 
       
  3561   SafepointMechanism::initialize();
  3553 
  3562 
  3554   // Initialize the os module after parsing the args
  3563   // Initialize the os module after parsing the args
  3555   jint os_init_2_result = os::init_2();
  3564   jint os_init_2_result = os::init_2();
  3556   if (os_init_2_result != JNI_OK) return os_init_2_result;
  3565   if (os_init_2_result != JNI_OK) return os_init_2_result;
  3557 
  3566