src/share/vm/memory/universe.cpp
Print this page
*** 127,136 ****
--- 127,137 ----
oop Universe::_out_of_memory_error_realloc_objects = NULL;
oop Universe::_delayed_stack_overflow_error_message = NULL;
objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
bool Universe::_verify_in_progress = false;
+ long Universe::verify_flags = Universe::Verify_All;
oop Universe::_null_ptr_exception_instance = NULL;
oop Universe::_arithmetic_exception_instance = NULL;
oop Universe::_virtual_machine_error_instance = NULL;
oop Universe::_vm_exception = NULL;
oop Universe::_allocation_context_notification_obj = NULL;
*** 667,676 ****
--- 668,680 ----
if (DumpSharedSpaces) {
MetaspaceShared::prepare_for_dumping();
}
}
+ if (VerifySubSet[0] != '\0') {
+ Universe::initialize_verify_flags();
+ }
return JNI_OK;
}
CollectedHeap* Universe::create_heap() {
*** 1101,1110 ****
--- 1105,1164 ----
ResourceMark rm;
heap()->print_on(log.trace_stream());
}
}
+ void Universe::initialize_verify_flags() {
+ verify_flags = 0;
+
+ size_t length = strlen(VerifySubSet);
+ char* subset_list = (char*) os::malloc(length + 1, mtInternal);
+ if (subset_list == NULL) {
+ tty->print_cr("VerifySubSet: Could not allocate memory for verify-subset, skipping subset initailization.");
+ return;
+ }
+ strncpy(subset_list, VerifySubSet, length + 1);
+
+ char* token = strtok(subset_list, " ,");
+ while (token != NULL) {
+ if (strcmp(token, "threads") == 0) {
+ verify_flags |= Verify_Threads;
+ } else if (strcmp(token, "heap") == 0) {
+ verify_flags |= Verify_Heap;
+ } else if (strcmp(token, "symbol_table") == 0) {
+ verify_flags |= Verify_SymbolTable;
+ } else if (strcmp(token, "string_table") == 0) {
+ verify_flags |= Verify_StringTable;
+ } else if (strcmp(token, "codecache") == 0) {
+ verify_flags |= Verify_CodeCache;
+ } else if (strcmp(token, "dictionary") == 0) {
+ verify_flags |= Verify_SystemDictionary;
+ } else if (strcmp(token, "classloader_data_graph") == 0) {
+ verify_flags |= Verify_ClassLoaderDataGraph;
+ } else if (strcmp(token, "metaspace") == 0) {
+ verify_flags |= Verify_MetaspaceAux;
+ } else if (strcmp(token, "jni_handles") == 0) {
+ verify_flags |= Verify_JNIHandles;
+ } else if (strcmp(token, "c-heap") == 0) {
+ verify_flags |= Verify_CHeap;
+ } else if (strcmp(token, "codecache_oops") == 0) {
+ verify_flags |= Verify_CodeCacheOops;
+ } else {
+ tty->print_cr("VerifySubSet: %s is unknown, skipping it.", token);
+ }
+ token = strtok(NULL, " ,");
+ }
+ free(subset_list);
+ }
+
+ bool Universe::should_verify_subset(uint subset) {
+ if (verify_flags & subset) {
+ return true;
+ }
+ return false;
+ }
+
void Universe::verify(VerifyOption option, const char* prefix) {
// The use of _verify_in_progress is a temporary work around for
// 6320749. Don't bother with a creating a class to set and clear
// it since it is only used in this method and the control flow is
// straight forward.
*** 1120,1156 ****
--- 1174,1232 ----
HandleMark hm; // Handles created during verification can be zapped
_verify_count++;
FormatBuffer<> title("Verifying %s", prefix);
GCTraceTime(Info, gc, verify) tm(title.buffer());
+ if (should_verify_subset(Verify_Threads)) {
log_debug(gc, verify)("Threads");
Threads::verify();
+ }
+ if (should_verify_subset(Verify_Heap)) {
log_debug(gc, verify)("Heap");
heap()->verify(option);
+ }
+ if (should_verify_subset(Verify_SymbolTable)) {
log_debug(gc, verify)("SymbolTable");
SymbolTable::verify();
+ }
+ if (should_verify_subset(Verify_StringTable)) {
log_debug(gc, verify)("StringTable");
StringTable::verify();
+ }
+ if (should_verify_subset(Verify_CodeCache)) {
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
log_debug(gc, verify)("CodeCache");
CodeCache::verify();
}
+ }
+ if (should_verify_subset(Verify_SystemDictionary)) {
log_debug(gc, verify)("SystemDictionary");
SystemDictionary::verify();
+ }
#ifndef PRODUCT
+ if (should_verify_subset(Verify_ClassLoaderDataGraph)) {
log_debug(gc, verify)("ClassLoaderDataGraph");
ClassLoaderDataGraph::verify();
+ }
#endif
+ if (should_verify_subset(Verify_MetaspaceAux)) {
log_debug(gc, verify)("MetaspaceAux");
MetaspaceAux::verify_free_chunks();
+ }
+ if (should_verify_subset(Verify_JNIHandles)) {
log_debug(gc, verify)("JNIHandles");
JNIHandles::verify();
+ }
+ if (should_verify_subset(Verify_CHeap)) {
log_debug(gc, verify)("C-heap");
os::check_heap();
+ }
+ if (should_verify_subset(Verify_CodeCacheOops)) {
log_debug(gc, verify)("CodeCache Oops");
CodeCache::verify_oops();
+ }
_verify_in_progress = false;
}