67 // interpreter, and both C1 and C2 fast-path inline locking code emission.
68 //
69 //
70 // -----------------------------------------------------------------------------
71
72 #ifdef DTRACE_ENABLED
73
74 // Only bother with this argument setup if dtrace is available
75 // TODO-FIXME: probes should not fire when caller is _blocked. assert() accordingly.
76
77 #define DTRACE_MONITOR_PROBE_COMMON(obj, thread) \
78 char* bytes = NULL; \
79 int len = 0; \
80 jlong jtid = SharedRuntime::get_java_tid(thread); \
81 Symbol* klassname = ((oop)(obj))->klass()->name(); \
82 if (klassname != NULL) { \
83 bytes = (char*)klassname->bytes(); \
84 len = klassname->utf8_length(); \
85 }
86
87 #ifndef USDT2
88 HS_DTRACE_PROBE_DECL5(hotspot, monitor__wait,
89 jlong, uintptr_t, char*, int, long);
90 HS_DTRACE_PROBE_DECL4(hotspot, monitor__waited,
91 jlong, uintptr_t, char*, int);
92
93 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \
94 { \
95 if (DTraceMonitorProbes) { \
96 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
97 HS_DTRACE_PROBE5(hotspot, monitor__wait, jtid, \
98 (monitor), bytes, len, (millis)); \
99 } \
100 }
101
102 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \
103 { \
104 if (DTraceMonitorProbes) { \
105 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
106 HS_DTRACE_PROBE4(hotspot, monitor__##probe, jtid, \
107 (uintptr_t)(monitor), bytes, len); \
108 } \
109 }
110
111 #else /* USDT2 */
112
113 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \
114 { \
115 if (DTraceMonitorProbes) { \
116 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
117 HOTSPOT_MONITOR_WAIT(jtid, \
118 (uintptr_t)(monitor), bytes, len, (millis)); \
119 } \
120 }
121
122 #define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_WAITED
123
124 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \
125 { \
126 if (DTraceMonitorProbes) { \
127 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
128 HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \
129 (uintptr_t)(monitor), bytes, len); \
130 } \
131 }
132
133 #endif /* USDT2 */
134 #else // ndef DTRACE_ENABLED
135
136 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon) {;}
137 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon) {;}
138
139 #endif // ndef DTRACE_ENABLED
140
141 // This exists only as a workaround of dtrace bug 6254741
142 int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, Thread* thr) {
143 DTRACE_MONITOR_PROBE(waited, monitor, obj(), thr);
144 return 0;
145 }
146
147 #define NINFLATIONLOCKS 256
148 static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
149
150 ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
151 ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL ;
152 ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL ;
153 int ObjectSynchronizer::gOmInUseCount = 0;
|
67 // interpreter, and both C1 and C2 fast-path inline locking code emission.
68 //
69 //
70 // -----------------------------------------------------------------------------
71
72 #ifdef DTRACE_ENABLED
73
74 // Only bother with this argument setup if dtrace is available
75 // TODO-FIXME: probes should not fire when caller is _blocked. assert() accordingly.
76
77 #define DTRACE_MONITOR_PROBE_COMMON(obj, thread) \
78 char* bytes = NULL; \
79 int len = 0; \
80 jlong jtid = SharedRuntime::get_java_tid(thread); \
81 Symbol* klassname = ((oop)(obj))->klass()->name(); \
82 if (klassname != NULL) { \
83 bytes = (char*)klassname->bytes(); \
84 len = klassname->utf8_length(); \
85 }
86
87 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \
88 { \
89 if (DTraceMonitorProbes) { \
90 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
91 HOTSPOT_MONITOR_WAIT(jtid, \
92 (uintptr_t)(monitor), bytes, len, (millis)); \
93 } \
94 }
95
96 #define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_WAITED
97
98 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \
99 { \
100 if (DTraceMonitorProbes) { \
101 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
102 HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \
103 (uintptr_t)(monitor), bytes, len); \
104 } \
105 }
106
107 #else // ndef DTRACE_ENABLED
108
109 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon) {;}
110 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon) {;}
111
112 #endif // ndef DTRACE_ENABLED
113
114 // This exists only as a workaround of dtrace bug 6254741
115 int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, Thread* thr) {
116 DTRACE_MONITOR_PROBE(waited, monitor, obj(), thr);
117 return 0;
118 }
119
120 #define NINFLATIONLOCKS 256
121 static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
122
123 ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
124 ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL ;
125 ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL ;
126 int ObjectSynchronizer::gOmInUseCount = 0;
|