117 "must be at safepoint or it's a java frame of the current thread");
118
119 GrowableArray<MonitorInfo*>* mons = monitors();
120 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(mons->length());
121 if (mons->is_empty()) return result;
122
123 bool found_first_monitor = false;
124 ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
125 ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
126 oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL);
127 oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL);
128
129 for (int index = (mons->length()-1); index >= 0; index--) {
130 MonitorInfo* monitor = mons->at(index);
131 if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
132 oop obj = monitor->owner();
133 if (obj == NULL) continue; // skip unowned monitor
134 //
135 // Skip the monitor that the thread is blocked to enter or waiting on
136 //
137 if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
138 continue;
139 }
140 found_first_monitor = true;
141 result->append(monitor);
142 }
143 return result;
144 }
145
146 void javaVFrame::print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) {
147 if (obj.not_null()) {
148 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, p2i(obj()));
149 if (obj->klass() == SystemDictionary::Class_klass()) {
150 st->print_cr("(a java.lang.Class for %s)", java_lang_Class::as_external_name(obj()));
151 } else {
152 Klass* k = obj->klass();
153 st->print_cr("(a %s)", k->external_name());
154 }
155 }
156 }
157
|
117 "must be at safepoint or it's a java frame of the current thread");
118
119 GrowableArray<MonitorInfo*>* mons = monitors();
120 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(mons->length());
121 if (mons->is_empty()) return result;
122
123 bool found_first_monitor = false;
124 ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
125 ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
126 oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL);
127 oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL);
128
129 for (int index = (mons->length()-1); index >= 0; index--) {
130 MonitorInfo* monitor = mons->at(index);
131 if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
132 oop obj = monitor->owner();
133 if (obj == NULL) continue; // skip unowned monitor
134 //
135 // Skip the monitor that the thread is blocked to enter or waiting on
136 //
137 if (!found_first_monitor && (oopDesc::equals(obj, pending_obj) || oopDesc::equals(obj, waiting_obj))) {
138 continue;
139 }
140 found_first_monitor = true;
141 result->append(monitor);
142 }
143 return result;
144 }
145
146 void javaVFrame::print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) {
147 if (obj.not_null()) {
148 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, p2i(obj()));
149 if (obj->klass() == SystemDictionary::Class_klass()) {
150 st->print_cr("(a java.lang.Class for %s)", java_lang_Class::as_external_name(obj()));
151 } else {
152 Klass* k = obj->klass();
153 st->print_cr("(a %s)", k->external_name());
154 }
155 }
156 }
157
|