src/share/vm/runtime/objectMonitor.cpp

Print this page
rev 5893 : 8034080: Remove the USDT1 dtrace code from Hotspot


  61   #define ATTR
  62 #endif
  63 
  64 
  65 #ifdef DTRACE_ENABLED
  66 
  67 // Only bother with this argument setup if dtrace is available
  68 // TODO-FIXME: probes should not fire when caller is _blocked.  assert() accordingly.
  69 
  70 
  71 #define DTRACE_MONITOR_PROBE_COMMON(obj, thread)                           \
  72   char* bytes = NULL;                                                      \
  73   int len = 0;                                                             \
  74   jlong jtid = SharedRuntime::get_java_tid(thread);                        \
  75   Symbol* klassname = ((oop)obj)->klass()->name();                         \
  76   if (klassname != NULL) {                                                 \
  77     bytes = (char*)klassname->bytes();                                     \
  78     len = klassname->utf8_length();                                        \
  79   }
  80 
  81 #ifndef USDT2
  82 
  83 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notify,
  84   jlong, uintptr_t, char*, int);
  85 HS_DTRACE_PROBE_DECL4(hotspot, monitor__notifyAll,
  86   jlong, uintptr_t, char*, int);
  87 HS_DTRACE_PROBE_DECL4(hotspot, monitor__contended__enter,
  88   jlong, uintptr_t, char*, int);
  89 HS_DTRACE_PROBE_DECL4(hotspot, monitor__contended__entered,
  90   jlong, uintptr_t, char*, int);
  91 HS_DTRACE_PROBE_DECL4(hotspot, monitor__contended__exit,
  92   jlong, uintptr_t, char*, int);
  93 
  94 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis)       \
  95   {                                                                        \
  96     if (DTraceMonitorProbes) {                                            \
  97       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                       \
  98       HS_DTRACE_PROBE5(hotspot, monitor__wait, jtid,                       \
  99                        (monitor), bytes, len, (millis));                   \
 100     }                                                                      \
 101   }
 102 
 103 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread)             \
 104   {                                                                        \
 105     if (DTraceMonitorProbes) {                                            \
 106       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                       \
 107       HS_DTRACE_PROBE4(hotspot, monitor__##probe, jtid,                    \
 108                        (uintptr_t)(monitor), bytes, len);                  \
 109     }                                                                      \
 110   }
 111 
 112 #else /* USDT2 */
 113 
 114 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis)            \
 115   {                                                                        \
 116     if (DTraceMonitorProbes) {                                            \
 117       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                            \
 118       HOTSPOT_MONITOR_WAIT(jtid,                                           \
 119                        (monitor), bytes, len, (millis));                   \
 120     }                                                                      \
 121   }
 122 
 123 #define HOTSPOT_MONITOR_contended__enter HOTSPOT_MONITOR_CONTENDED_ENTER
 124 #define HOTSPOT_MONITOR_contended__entered HOTSPOT_MONITOR_CONTENDED_ENTERED
 125 #define HOTSPOT_MONITOR_contended__exit HOTSPOT_MONITOR_CONTENDED_EXIT
 126 #define HOTSPOT_MONITOR_notify HOTSPOT_MONITOR_NOTIFY
 127 #define HOTSPOT_MONITOR_notifyAll HOTSPOT_MONITOR_NOTIFYALL
 128 
 129 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread)                  \
 130   {                                                                        \
 131     if (DTraceMonitorProbes) {                                            \
 132       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                            \
 133       HOTSPOT_MONITOR_##probe(jtid,                                               \
 134                        (uintptr_t)(monitor), bytes, len);                  \
 135     }                                                                      \
 136   }
 137 
 138 #endif /* USDT2 */
 139 #else //  ndef DTRACE_ENABLED
 140 
 141 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon)    {;}
 142 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon)          {;}
 143 
 144 #endif // ndef DTRACE_ENABLED
 145 
 146 // Tunables ...
 147 // The knob* variables are effectively final.  Once set they should
 148 // never be modified hence.  Consider using __read_mostly with GCC.
 149 
 150 int ObjectMonitor::Knob_Verbose    = 0 ;
 151 int ObjectMonitor::Knob_SpinLimit  = 5000 ;    // derived by an external tool -
 152 static int Knob_LogSpins           = 0 ;       // enable jvmstat tally for spins
 153 static int Knob_HandOff            = 0 ;
 154 static int Knob_ReportSettings     = 0 ;
 155 
 156 static int Knob_SpinBase           = 0 ;       // Floor AKA SpinMin
 157 static int Knob_SpinBackOff        = 0 ;       // spin-loop backoff
 158 static int Knob_CASPenalty         = -1 ;      // Penalty for failed CAS




  61   #define ATTR
  62 #endif
  63 
  64 
  65 #ifdef DTRACE_ENABLED
  66 
  67 // Only bother with this argument setup if dtrace is available
  68 // TODO-FIXME: probes should not fire when caller is _blocked.  assert() accordingly.
  69 
  70 
  71 #define DTRACE_MONITOR_PROBE_COMMON(obj, thread)                           \
  72   char* bytes = NULL;                                                      \
  73   int len = 0;                                                             \
  74   jlong jtid = SharedRuntime::get_java_tid(thread);                        \
  75   Symbol* klassname = ((oop)obj)->klass()->name();                         \
  76   if (klassname != NULL) {                                                 \
  77     bytes = (char*)klassname->bytes();                                     \
  78     len = klassname->utf8_length();                                        \
  79   }
  80 

































  81 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis)            \
  82   {                                                                        \
  83     if (DTraceMonitorProbes) {                                            \
  84       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                            \
  85       HOTSPOT_MONITOR_WAIT(jtid,                                           \
  86                        (monitor), bytes, len, (millis));                   \
  87     }                                                                      \
  88   }
  89 
  90 #define HOTSPOT_MONITOR_contended__enter HOTSPOT_MONITOR_CONTENDED_ENTER
  91 #define HOTSPOT_MONITOR_contended__entered HOTSPOT_MONITOR_CONTENDED_ENTERED
  92 #define HOTSPOT_MONITOR_contended__exit HOTSPOT_MONITOR_CONTENDED_EXIT
  93 #define HOTSPOT_MONITOR_notify HOTSPOT_MONITOR_NOTIFY
  94 #define HOTSPOT_MONITOR_notifyAll HOTSPOT_MONITOR_NOTIFYALL
  95 
  96 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread)                  \
  97   {                                                                        \
  98     if (DTraceMonitorProbes) {                                            \
  99       DTRACE_MONITOR_PROBE_COMMON(obj, thread);                            \
 100       HOTSPOT_MONITOR_##probe(jtid,                                               \
 101                        (uintptr_t)(monitor), bytes, len);                  \
 102     }                                                                      \
 103   }
 104 

 105 #else //  ndef DTRACE_ENABLED
 106 
 107 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon)    {;}
 108 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon)          {;}
 109 
 110 #endif // ndef DTRACE_ENABLED
 111 
 112 // Tunables ...
 113 // The knob* variables are effectively final.  Once set they should
 114 // never be modified hence.  Consider using __read_mostly with GCC.
 115 
 116 int ObjectMonitor::Knob_Verbose    = 0 ;
 117 int ObjectMonitor::Knob_SpinLimit  = 5000 ;    // derived by an external tool -
 118 static int Knob_LogSpins           = 0 ;       // enable jvmstat tally for spins
 119 static int Knob_HandOff            = 0 ;
 120 static int Knob_ReportSettings     = 0 ;
 121 
 122 static int Knob_SpinBase           = 0 ;       // Floor AKA SpinMin
 123 static int Knob_SpinBackOff        = 0 ;       // spin-loop backoff
 124 static int Knob_CASPenalty         = -1 ;      // Penalty for failed CAS