145 } 146 147 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) { 148 if (obj.not_null()) { 149 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj()); 150 if (obj->klass() == SystemDictionary::Class_klass()) { 151 Klass* target_klass = java_lang_Class::as_Klass(obj()); 152 st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name()); 153 } else { 154 Klass* k = obj->klass(); 155 st->print_cr("(a %s)", k->external_name()); 156 } 157 } 158 } 159 160 void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) { 161 ResourceMark rm; 162 163 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. 164 if (frame_count == 0) { 165 if (method()->name() == vmSymbols::wait_name() && 166 method()->method_holder()->name() == vmSymbols::java_lang_Object()) { 167 StackValueCollection* locs = locals(); 168 if (!locs->is_empty()) { 169 StackValue* sv = locs->at(0); 170 if (sv->type() == T_OBJECT) { 171 Handle o = locs->at(0)->get_obj(); 172 print_locked_object_class_name(st, o, "waiting on"); 173 } 174 } 175 } else if (thread()->current_park_blocker() != NULL) { 176 oop obj = thread()->current_park_blocker(); 177 Klass* k = obj->klass(); 178 st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name()); 179 } 180 } 181 182 183 // Print out all monitors that we have locked or are trying to lock 184 GrowableArray<MonitorInfo*>* mons = monitors(); 185 if (!mons->is_empty()) { 186 bool found_first_monitor = false; | 145 } 146 147 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) { 148 if (obj.not_null()) { 149 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj()); 150 if (obj->klass() == SystemDictionary::Class_klass()) { 151 Klass* target_klass = java_lang_Class::as_Klass(obj()); 152 st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name()); 153 } else { 154 Klass* k = obj->klass(); 155 st->print_cr("(a %s)", k->external_name()); 156 } 157 } 158 } 159 160 void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) { 161 ResourceMark rm; 162 163 // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. 164 if (frame_count == 0) { 165 if (method()->name()->equals(vmSymbols::wait_name()) && 166 method()->method_holder()->name()->equals(vmSymbols::java_lang_Object())) { 167 StackValueCollection* locs = locals(); 168 if (!locs->is_empty()) { 169 StackValue* sv = locs->at(0); 170 if (sv->type() == T_OBJECT) { 171 Handle o = locs->at(0)->get_obj(); 172 print_locked_object_class_name(st, o, "waiting on"); 173 } 174 } 175 } else if (thread()->current_park_blocker() != NULL) { 176 oop obj = thread()->current_park_blocker(); 177 Klass* k = obj->klass(); 178 st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name()); 179 } 180 } 181 182 183 // Print out all monitors that we have locked or are trying to lock 184 GrowableArray<MonitorInfo*>* mons = monitors(); 185 if (!mons->is_empty()) { 186 bool found_first_monitor = false; |