src/share/vm/runtime/thread.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/share/vm/runtime

src/share/vm/runtime/thread.cpp

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


  90 # include "os_solaris.inline.hpp"
  91 #endif
  92 #ifdef TARGET_OS_FAMILY_windows
  93 # include "os_windows.inline.hpp"
  94 #endif
  95 #ifdef TARGET_OS_FAMILY_bsd
  96 # include "os_bsd.inline.hpp"
  97 #endif
  98 #if INCLUDE_ALL_GCS
  99 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 100 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
 101 #include "gc_implementation/parallelScavenge/pcTasks.hpp"
 102 #endif // INCLUDE_ALL_GCS
 103 #ifdef COMPILER1
 104 #include "c1/c1_Compiler.hpp"
 105 #endif
 106 #ifdef COMPILER2
 107 #include "opto/c2compiler.hpp"
 108 #include "opto/idealGraphPrinter.hpp"
 109 #endif



 110 
 111 #ifdef DTRACE_ENABLED
 112 
 113 // Only bother with this argument setup if dtrace is available
 114 
 115 #ifndef USDT2
 116 HS_DTRACE_PROBE_DECL(hotspot, vm__init__begin);
 117 HS_DTRACE_PROBE_DECL(hotspot, vm__init__end);
 118 HS_DTRACE_PROBE_DECL5(hotspot, thread__start, char*, intptr_t,
 119   intptr_t, intptr_t, bool);
 120 HS_DTRACE_PROBE_DECL5(hotspot, thread__stop, char*, intptr_t,
 121   intptr_t, intptr_t, bool);
 122 
 123 #define DTRACE_THREAD_PROBE(probe, javathread)                             \
 124   {                                                                        \
 125     ResourceMark rm(this);                                                 \
 126     int len = 0;                                                           \
 127     const char* name = (javathread)->get_thread_name();                    \
 128     len = strlen(name);                                                    \
 129     HS_DTRACE_PROBE5(hotspot, thread__##probe,                             \


3653   }
3654 
3655 #if INCLUDE_MANAGEMENT
3656   Management::initialize(THREAD);
3657 #endif // INCLUDE_MANAGEMENT
3658 
3659   if (HAS_PENDING_EXCEPTION) {
3660     // management agent fails to start possibly due to
3661     // configuration problem and is responsible for printing
3662     // stack trace if appropriate. Simply exit VM.
3663     vm_exit(1);
3664   }
3665 
3666   if (Arguments::has_profile())       FlatProfiler::engage(main_thread, true);
3667   if (MemProfiling)                   MemProfiler::engage();
3668   StatSampler::engage();
3669   if (CheckJNICalls)                  JniPeriodicChecker::engage();
3670 
3671   BiasedLocking::init();
3672 




3673   if (JDK_Version::current().post_vm_init_hook_enabled()) {
3674     call_postVMInitHook(THREAD);
3675     // The Java side of PostVMInitHook.run must deal with all
3676     // exceptions and provide means of diagnosis.
3677     if (HAS_PENDING_EXCEPTION) {
3678       CLEAR_PENDING_EXCEPTION;
3679     }
3680   }
3681 
3682   {
3683       MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
3684       // Make sure the watcher thread can be started by WatcherThread::start()
3685       // or by dynamic enrollment.
3686       WatcherThread::make_startable();
3687       // Start up the WatcherThread if there are any periodic tasks
3688       // NOTE:  All PeriodicTasks should be registered by now. If they
3689       //   aren't, late joiners might appear to start slowly (we might
3690       //   take a while to process their first tick).
3691       if (PeriodicTask::num_tasks() > 0) {
3692           WatcherThread::start();




  90 # include "os_solaris.inline.hpp"
  91 #endif
  92 #ifdef TARGET_OS_FAMILY_windows
  93 # include "os_windows.inline.hpp"
  94 #endif
  95 #ifdef TARGET_OS_FAMILY_bsd
  96 # include "os_bsd.inline.hpp"
  97 #endif
  98 #if INCLUDE_ALL_GCS
  99 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 100 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
 101 #include "gc_implementation/parallelScavenge/pcTasks.hpp"
 102 #endif // INCLUDE_ALL_GCS
 103 #ifdef COMPILER1
 104 #include "c1/c1_Compiler.hpp"
 105 #endif
 106 #ifdef COMPILER2
 107 #include "opto/c2compiler.hpp"
 108 #include "opto/idealGraphPrinter.hpp"
 109 #endif
 110 #if INCLUDE_RTM_OPT
 111 #include "runtime/rtmLocking.hpp"
 112 #endif
 113 
 114 #ifdef DTRACE_ENABLED
 115 
 116 // Only bother with this argument setup if dtrace is available
 117 
 118 #ifndef USDT2
 119 HS_DTRACE_PROBE_DECL(hotspot, vm__init__begin);
 120 HS_DTRACE_PROBE_DECL(hotspot, vm__init__end);
 121 HS_DTRACE_PROBE_DECL5(hotspot, thread__start, char*, intptr_t,
 122   intptr_t, intptr_t, bool);
 123 HS_DTRACE_PROBE_DECL5(hotspot, thread__stop, char*, intptr_t,
 124   intptr_t, intptr_t, bool);
 125 
 126 #define DTRACE_THREAD_PROBE(probe, javathread)                             \
 127   {                                                                        \
 128     ResourceMark rm(this);                                                 \
 129     int len = 0;                                                           \
 130     const char* name = (javathread)->get_thread_name();                    \
 131     len = strlen(name);                                                    \
 132     HS_DTRACE_PROBE5(hotspot, thread__##probe,                             \


3656   }
3657 
3658 #if INCLUDE_MANAGEMENT
3659   Management::initialize(THREAD);
3660 #endif // INCLUDE_MANAGEMENT
3661 
3662   if (HAS_PENDING_EXCEPTION) {
3663     // management agent fails to start possibly due to
3664     // configuration problem and is responsible for printing
3665     // stack trace if appropriate. Simply exit VM.
3666     vm_exit(1);
3667   }
3668 
3669   if (Arguments::has_profile())       FlatProfiler::engage(main_thread, true);
3670   if (MemProfiling)                   MemProfiler::engage();
3671   StatSampler::engage();
3672   if (CheckJNICalls)                  JniPeriodicChecker::engage();
3673 
3674   BiasedLocking::init();
3675 
3676 #if INCLUDE_RTM_OPT
3677   RTMLockingCounters::init();
3678 #endif
3679 
3680   if (JDK_Version::current().post_vm_init_hook_enabled()) {
3681     call_postVMInitHook(THREAD);
3682     // The Java side of PostVMInitHook.run must deal with all
3683     // exceptions and provide means of diagnosis.
3684     if (HAS_PENDING_EXCEPTION) {
3685       CLEAR_PENDING_EXCEPTION;
3686     }
3687   }
3688 
3689   {
3690       MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
3691       // Make sure the watcher thread can be started by WatcherThread::start()
3692       // or by dynamic enrollment.
3693       WatcherThread::make_startable();
3694       // Start up the WatcherThread if there are any periodic tasks
3695       // NOTE:  All PeriodicTasks should be registered by now. If they
3696       //   aren't, late joiners might appear to start slowly (we might
3697       //   take a while to process their first tick).
3698       if (PeriodicTask::num_tasks() > 0) {
3699           WatcherThread::start();


src/share/vm/runtime/thread.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File