56 #include "oops/instanceMirrorKlass.hpp"
57 #include "oops/instanceRefKlass.hpp"
58 #include "oops/objArrayOop.inline.hpp"
59 #include "oops/oop.inline.hpp"
60 #include "oops/typeArrayKlass.hpp"
61 #include "prims/resolvedMethodTable.hpp"
62 #include "runtime/arguments.hpp"
63 #include "runtime/atomic.hpp"
64 #include "runtime/deoptimization.hpp"
65 #include "runtime/flags/flagSetting.hpp"
66 #include "runtime/flags/jvmFlagConstraintList.hpp"
67 #include "runtime/handles.inline.hpp"
68 #include "runtime/init.hpp"
69 #include "runtime/java.hpp"
70 #include "runtime/javaCalls.hpp"
71 #include "runtime/sharedRuntime.hpp"
72 #include "runtime/synchronizer.hpp"
73 #include "runtime/thread.inline.hpp"
74 #include "runtime/timerTrace.hpp"
75 #include "runtime/vm_operations.hpp"
76 #include "services/memoryService.hpp"
77 #include "utilities/align.hpp"
78 #include "utilities/copy.hpp"
79 #include "utilities/debug.hpp"
80 #include "utilities/events.hpp"
81 #include "utilities/formatBuffer.hpp"
82 #include "utilities/hashtable.inline.hpp"
83 #include "utilities/macros.hpp"
84 #include "utilities/ostream.hpp"
85 #include "utilities/preserveException.hpp"
86
87 // Known objects
88 Klass* Universe::_typeArrayKlassObjs[T_LONG+1] = { NULL /*, NULL...*/ };
89 Klass* Universe::_objectArrayKlassObj = NULL;
90 oop Universe::_int_mirror = NULL;
91 oop Universe::_float_mirror = NULL;
92 oop Universe::_double_mirror = NULL;
93 oop Universe::_byte_mirror = NULL;
94 oop Universe::_bool_mirror = NULL;
95 oop Universe::_char_mirror = NULL;
1096 if (lt.is_enabled()) {
1097 LogStream ls(lt);
1098 ls.print("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1099 ResourceMark rm;
1100 heap()->print_on(&ls);
1101 }
1102 }
1103
1104 void Universe::print_heap_after_gc() {
1105 LogTarget(Debug, gc, heap) lt;
1106 if (lt.is_enabled()) {
1107 LogStream ls(lt);
1108 ls.print("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1109 ResourceMark rm;
1110 heap()->print_on(&ls);
1111 }
1112 }
1113
1114 void Universe::initialize_verify_flags() {
1115 verify_flags = 0;
1116 const char delimiter[] = " ,";
1117
1118 size_t length = strlen(VerifySubSet);
1119 char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
1120 strncpy(subset_list, VerifySubSet, length + 1);
1121
1122 char* token = strtok(subset_list, delimiter);
1123 while (token != NULL) {
1124 if (strcmp(token, "threads") == 0) {
1125 verify_flags |= Verify_Threads;
1126 } else if (strcmp(token, "heap") == 0) {
1127 verify_flags |= Verify_Heap;
1128 } else if (strcmp(token, "symbol_table") == 0) {
1129 verify_flags |= Verify_SymbolTable;
1130 } else if (strcmp(token, "string_table") == 0) {
1131 verify_flags |= Verify_StringTable;
1132 } else if (strcmp(token, "codecache") == 0) {
1133 verify_flags |= Verify_CodeCache;
1134 } else if (strcmp(token, "dictionary") == 0) {
1135 verify_flags |= Verify_SystemDictionary;
1136 } else if (strcmp(token, "classloader_data_graph") == 0) {
1137 verify_flags |= Verify_ClassLoaderDataGraph;
1138 } else if (strcmp(token, "metaspace") == 0) {
1139 verify_flags |= Verify_MetaspaceUtils;
1140 } else if (strcmp(token, "jni_handles") == 0) {
1141 verify_flags |= Verify_JNIHandles;
1142 } else if (strcmp(token, "codecache_oops") == 0) {
1143 verify_flags |= Verify_CodeCacheOops;
1144 } else {
1145 vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token));
1146 }
1147 token = strtok(NULL, delimiter);
1148 }
1149 FREE_C_HEAP_ARRAY(char, subset_list);
1150 }
1151
1152 bool Universe::should_verify_subset(uint subset) {
1153 if (verify_flags & subset) {
1154 return true;
1155 }
1156 return false;
1157 }
1158
1159 void Universe::verify(VerifyOption option, const char* prefix) {
1160 // The use of _verify_in_progress is a temporary work around for
1161 // 6320749. Don't bother with a creating a class to set and clear
1162 // it since it is only used in this method and the control flow is
1163 // straight forward.
1164 _verify_in_progress = true;
1165
1166 COMPILER2_PRESENT(
1167 assert(!DerivedPointerTable::is_active(),
|
56 #include "oops/instanceMirrorKlass.hpp"
57 #include "oops/instanceRefKlass.hpp"
58 #include "oops/objArrayOop.inline.hpp"
59 #include "oops/oop.inline.hpp"
60 #include "oops/typeArrayKlass.hpp"
61 #include "prims/resolvedMethodTable.hpp"
62 #include "runtime/arguments.hpp"
63 #include "runtime/atomic.hpp"
64 #include "runtime/deoptimization.hpp"
65 #include "runtime/flags/flagSetting.hpp"
66 #include "runtime/flags/jvmFlagConstraintList.hpp"
67 #include "runtime/handles.inline.hpp"
68 #include "runtime/init.hpp"
69 #include "runtime/java.hpp"
70 #include "runtime/javaCalls.hpp"
71 #include "runtime/sharedRuntime.hpp"
72 #include "runtime/synchronizer.hpp"
73 #include "runtime/thread.inline.hpp"
74 #include "runtime/timerTrace.hpp"
75 #include "runtime/vm_operations.hpp"
76 #include "runtime/os.inline.hpp"
77 #include "services/memoryService.hpp"
78 #include "utilities/align.hpp"
79 #include "utilities/copy.hpp"
80 #include "utilities/debug.hpp"
81 #include "utilities/events.hpp"
82 #include "utilities/formatBuffer.hpp"
83 #include "utilities/hashtable.inline.hpp"
84 #include "utilities/macros.hpp"
85 #include "utilities/ostream.hpp"
86 #include "utilities/preserveException.hpp"
87
88 // Known objects
89 Klass* Universe::_typeArrayKlassObjs[T_LONG+1] = { NULL /*, NULL...*/ };
90 Klass* Universe::_objectArrayKlassObj = NULL;
91 oop Universe::_int_mirror = NULL;
92 oop Universe::_float_mirror = NULL;
93 oop Universe::_double_mirror = NULL;
94 oop Universe::_byte_mirror = NULL;
95 oop Universe::_bool_mirror = NULL;
96 oop Universe::_char_mirror = NULL;
1097 if (lt.is_enabled()) {
1098 LogStream ls(lt);
1099 ls.print("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1100 ResourceMark rm;
1101 heap()->print_on(&ls);
1102 }
1103 }
1104
1105 void Universe::print_heap_after_gc() {
1106 LogTarget(Debug, gc, heap) lt;
1107 if (lt.is_enabled()) {
1108 LogStream ls(lt);
1109 ls.print("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1110 ResourceMark rm;
1111 heap()->print_on(&ls);
1112 }
1113 }
1114
1115 void Universe::initialize_verify_flags() {
1116 verify_flags = 0;
1117 char *save_ptr;
1118 const char delimiter[] = " ,";
1119
1120 size_t length = strlen(VerifySubSet);
1121 char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
1122 strncpy(subset_list, VerifySubSet, length + 1);
1123
1124 char* token = os::strtok(subset_list, delimiter, &save_ptr);
1125 while (token != NULL) {
1126 if (strcmp(token, "threads") == 0) {
1127 verify_flags |= Verify_Threads;
1128 } else if (strcmp(token, "heap") == 0) {
1129 verify_flags |= Verify_Heap;
1130 } else if (strcmp(token, "symbol_table") == 0) {
1131 verify_flags |= Verify_SymbolTable;
1132 } else if (strcmp(token, "string_table") == 0) {
1133 verify_flags |= Verify_StringTable;
1134 } else if (strcmp(token, "codecache") == 0) {
1135 verify_flags |= Verify_CodeCache;
1136 } else if (strcmp(token, "dictionary") == 0) {
1137 verify_flags |= Verify_SystemDictionary;
1138 } else if (strcmp(token, "classloader_data_graph") == 0) {
1139 verify_flags |= Verify_ClassLoaderDataGraph;
1140 } else if (strcmp(token, "metaspace") == 0) {
1141 verify_flags |= Verify_MetaspaceUtils;
1142 } else if (strcmp(token, "jni_handles") == 0) {
1143 verify_flags |= Verify_JNIHandles;
1144 } else if (strcmp(token, "codecache_oops") == 0) {
1145 verify_flags |= Verify_CodeCacheOops;
1146 } else {
1147 vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token));
1148 }
1149 token = os::strtok(NULL, delimiter, &save_ptr);
1150 }
1151 FREE_C_HEAP_ARRAY(char, subset_list);
1152 }
1153
1154 bool Universe::should_verify_subset(uint subset) {
1155 if (verify_flags & subset) {
1156 return true;
1157 }
1158 return false;
1159 }
1160
1161 void Universe::verify(VerifyOption option, const char* prefix) {
1162 // The use of _verify_in_progress is a temporary work around for
1163 // 6320749. Don't bother with a creating a class to set and clear
1164 // it since it is only used in this method and the control flow is
1165 // straight forward.
1166 _verify_in_progress = true;
1167
1168 COMPILER2_PRESENT(
1169 assert(!DerivedPointerTable::is_active(),
|