1050 // The count is only interesting if we have a _threads_list_ptr.
1051 st->print(", _nested_threads_hazard_ptr_cnt=%u", thread->_nested_threads_hazard_ptr_cnt);
1052 }
1053 if (SafepointSynchronize::is_at_safepoint() || Thread::current() == thread) {
1054 // It is only safe to walk the list if we're at a safepoint or the
1055 // calling thread is walking its own list.
1056 SafeThreadsListPtr* current = thread->_threads_list_ptr;
1057 if (current != NULL) {
1058 // Skip the top nesting level as it is always printed above.
1059 current = current->previous();
1060 }
1061 while (current != NULL) {
1062 current->print_on(st);
1063 current = current->previous();
1064 }
1065 }
1066 }
1067
1068 // Print Threads class SMR info.
1069 void ThreadsSMRSupport::print_info_on(outputStream* st) {
1070 // Only grab the Threads_lock if we don't already own it
1071 // and if we are not reporting an error.
1072 MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
1073
1074 st->print_cr("Threads class SMR info:");
1075 st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, "
1076 "elements={", p2i(_java_thread_list),
1077 _java_thread_list->length());
1078 print_info_elements_on(st, _java_thread_list);
1079 st->print_cr("}");
1080 if (_to_delete_list != NULL) {
1081 st->print_cr("_to_delete_list=" INTPTR_FORMAT ", length=%u, "
1082 "elements={", p2i(_to_delete_list),
1083 _to_delete_list->length());
1084 print_info_elements_on(st, _to_delete_list);
1085 st->print_cr("}");
1086 for (ThreadsList *t_list = _to_delete_list->next_list();
1087 t_list != NULL; t_list = t_list->next_list()) {
1088 st->print("next-> " INTPTR_FORMAT ", length=%u, "
1089 "elements={", p2i(t_list), t_list->length());
1090 print_info_elements_on(st, t_list);
1091 st->print_cr("}");
|
1050 // The count is only interesting if we have a _threads_list_ptr.
1051 st->print(", _nested_threads_hazard_ptr_cnt=%u", thread->_nested_threads_hazard_ptr_cnt);
1052 }
1053 if (SafepointSynchronize::is_at_safepoint() || Thread::current() == thread) {
1054 // It is only safe to walk the list if we're at a safepoint or the
1055 // calling thread is walking its own list.
1056 SafeThreadsListPtr* current = thread->_threads_list_ptr;
1057 if (current != NULL) {
1058 // Skip the top nesting level as it is always printed above.
1059 current = current->previous();
1060 }
1061 while (current != NULL) {
1062 current->print_on(st);
1063 current = current->previous();
1064 }
1065 }
1066 }
1067
1068 // Print Threads class SMR info.
1069 void ThreadsSMRSupport::print_info_on(outputStream* st) {
1070 // Only grab the Threads_lock if we don't already own it and if we
1071 // are not reporting an error.
1072 // Note: Not grabbing the Threads_lock during during error reporting
1073 // is dangerous because the data structures we want to print can be
1074 // freed concurrently. However, grabbing the Threads_lock during
1075 // error reporting can be equally dangerous since this thread might
1076 // block during error reporting or a nested error could leave the
1077 // Threads_lock held. The classic no win scenario.
1078 //
1079 MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
1080
1081 st->print_cr("Threads class SMR info:");
1082 st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, "
1083 "elements={", p2i(_java_thread_list),
1084 _java_thread_list->length());
1085 print_info_elements_on(st, _java_thread_list);
1086 st->print_cr("}");
1087 if (_to_delete_list != NULL) {
1088 st->print_cr("_to_delete_list=" INTPTR_FORMAT ", length=%u, "
1089 "elements={", p2i(_to_delete_list),
1090 _to_delete_list->length());
1091 print_info_elements_on(st, _to_delete_list);
1092 st->print_cr("}");
1093 for (ThreadsList *t_list = _to_delete_list->next_list();
1094 t_list != NULL; t_list = t_list->next_list()) {
1095 st->print("next-> " INTPTR_FORMAT ", length=%u, "
1096 "elements={", p2i(t_list), t_list->length());
1097 print_info_elements_on(st, t_list);
1098 st->print_cr("}");
|