1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
187 for (int index = (mons->length()-1); index >= 0; index--) { |
187 for (int index = (mons->length()-1); index >= 0; index--) { |
188 MonitorInfo* monitor = mons->at(index); |
188 MonitorInfo* monitor = mons->at(index); |
189 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code |
189 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code |
190 if (monitor->owner_is_scalar_replaced()) { |
190 if (monitor->owner_is_scalar_replaced()) { |
191 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); |
191 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); |
|
192 // format below for lockbits matches this one. |
192 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name()); |
193 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name()); |
193 } else { |
194 } else { |
194 oop obj = monitor->owner(); |
195 oop obj = monitor->owner(); |
195 if (obj != NULL) { |
196 if (obj != NULL) { |
196 print_locked_object_class_name(st, obj, "eliminated"); |
197 print_locked_object_class_name(st, obj, "eliminated"); |
204 // First, assume we have the monitor locked. If we haven't found an |
205 // First, assume we have the monitor locked. If we haven't found an |
205 // owned monitor before and this is the first frame, then we need to |
206 // owned monitor before and this is the first frame, then we need to |
206 // see if we have completed the lock or we are blocked trying to |
207 // see if we have completed the lock or we are blocked trying to |
207 // acquire it - we can only be blocked if the monitor is inflated |
208 // acquire it - we can only be blocked if the monitor is inflated |
208 |
209 |
|
210 markOop mark = NULL; |
209 const char *lock_state = "locked"; // assume we have the monitor locked |
211 const char *lock_state = "locked"; // assume we have the monitor locked |
210 if (!found_first_monitor && frame_count == 0) { |
212 if (!found_first_monitor && frame_count == 0) { |
211 markOop mark = monitor->owner()->mark(); |
213 mark = monitor->owner()->mark(); |
212 if (mark->has_monitor() && |
214 if (mark->has_monitor() && |
213 ( // we have marked ourself as pending on this monitor |
215 ( // we have marked ourself as pending on this monitor |
214 mark->monitor() == thread()->current_pending_monitor() || |
216 mark->monitor() == thread()->current_pending_monitor() || |
215 // we are not the owner of this monitor |
217 // we are not the owner of this monitor |
216 !mark->monitor()->is_entered(thread()) |
218 !mark->monitor()->is_entered(thread()) |
217 )) { |
219 )) { |
218 lock_state = "waiting to lock"; |
220 lock_state = "waiting to lock"; |
|
221 } else { |
|
222 mark = NULL; // Disable printing below |
219 } |
223 } |
220 } |
224 } |
|
225 print_locked_object_class_name(st, monitor->owner(), lock_state); |
|
226 if (Verbose && mark != NULL) { |
|
227 // match with format above, replacing "-" with " ". |
|
228 st->print("\t lockbits="); |
|
229 mark->print_on(st); |
|
230 st->cr(); |
|
231 } |
221 |
232 |
222 found_first_monitor = true; |
233 found_first_monitor = true; |
223 print_locked_object_class_name(st, monitor->owner(), lock_state); |
|
224 } |
234 } |
225 } |
235 } |
226 } |
236 } |
227 } |
237 } |
228 |
238 |
576 tty->print("( is scalar replaced %s)", k->external_name()); |
586 tty->print("( is scalar replaced %s)", k->external_name()); |
577 } else if (monitor->owner() == NULL) { |
587 } else if (monitor->owner() == NULL) { |
578 tty->print("( null )"); |
588 tty->print("( null )"); |
579 } else { |
589 } else { |
580 monitor->owner()->print_value(); |
590 monitor->owner()->print_value(); |
581 tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner()); |
591 tty->print("(owner=" INTPTR_FORMAT ")", (address)monitor->owner()); |
582 } |
592 } |
583 if (monitor->eliminated() && is_compiled_frame()) |
593 if (monitor->eliminated()) { |
584 tty->print(" ( lock is eliminated )"); |
594 if(is_compiled_frame()) { |
|
595 tty->print(" ( lock is eliminated in compiled frame )"); |
|
596 } else { |
|
597 tty->print(" ( lock is eliminated, frame not compiled )"); |
|
598 } |
|
599 } |
585 tty->cr(); |
600 tty->cr(); |
586 tty->print("\t "); |
601 tty->print("\t "); |
587 monitor->lock()->print_on(tty); |
602 monitor->lock()->print_on(tty); |
588 tty->cr(); |
603 tty->cr(); |
589 } |
604 } |