197 } |
197 } |
198 } |
198 } |
199 continue; |
199 continue; |
200 } |
200 } |
201 if (monitor->owner() != NULL) { |
201 if (monitor->owner() != NULL) { |
|
202 // the monitor is associated with an object, i.e., it is locked |
202 |
203 |
203 // First, assume we have the monitor locked. If we haven't found an |
204 // First, assume we have the monitor locked. If we haven't found an |
204 // owned monitor before and this is the first frame, then we need to |
205 // owned monitor before and this is the first frame, then we need to |
205 // see if we have completed the lock or we are blocked trying to |
206 // see if we have completed the lock or we are blocked trying to |
206 // acquire it - we can only be blocked if the monitor is inflated |
207 // acquire it - we can only be blocked if the monitor is inflated |
207 |
208 |
208 const char *lock_state = "locked"; // assume we have the monitor locked |
209 const char *lock_state = "locked"; // assume we have the monitor locked |
209 if (!found_first_monitor && frame_count == 0) { |
210 if (!found_first_monitor && frame_count == 0) { |
210 markOop mark = monitor->owner()->mark(); |
211 markOop mark = monitor->owner()->mark(); |
211 if (mark->has_monitor() && |
212 if (mark->has_monitor() && |
212 mark->monitor() == thread()->current_pending_monitor()) { |
213 ( // we have marked ourself as pending on this monitor |
|
214 mark->monitor() == thread()->current_pending_monitor() || |
|
215 // we are not the owner of this monitor |
|
216 !mark->monitor()->is_entered(thread()) |
|
217 )) { |
213 lock_state = "waiting to lock"; |
218 lock_state = "waiting to lock"; |
214 } |
219 } |
215 } |
220 } |
216 |
221 |
217 found_first_monitor = true; |
222 found_first_monitor = true; |