1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
122 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; |
122 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; |
123 oop Universe::_out_of_memory_error_realloc_objects = NULL; |
123 oop Universe::_out_of_memory_error_realloc_objects = NULL; |
124 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; |
124 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; |
125 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; |
125 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; |
126 bool Universe::_verify_in_progress = false; |
126 bool Universe::_verify_in_progress = false; |
|
127 long Universe::verify_flags = Universe::Verify_All; |
127 oop Universe::_null_ptr_exception_instance = NULL; |
128 oop Universe::_null_ptr_exception_instance = NULL; |
128 oop Universe::_arithmetic_exception_instance = NULL; |
129 oop Universe::_arithmetic_exception_instance = NULL; |
129 oop Universe::_virtual_machine_error_instance = NULL; |
130 oop Universe::_virtual_machine_error_instance = NULL; |
130 oop Universe::_vm_exception = NULL; |
131 oop Universe::_vm_exception = NULL; |
131 oop Universe::_allocation_context_notification_obj = NULL; |
132 oop Universe::_allocation_context_notification_obj = NULL; |
1359 heap()->print_extended_on(st); |
1363 heap()->print_extended_on(st); |
1360 } |
1364 } |
1361 st->print_cr("}"); |
1365 st->print_cr("}"); |
1362 } |
1366 } |
1363 |
1367 |
|
1368 void Universe::initialize_verify_flags() { |
|
1369 verify_flags = 0; |
|
1370 const char delimiter[] = " ,"; |
|
1371 |
|
1372 size_t length = strlen(VerifySubSet); |
|
1373 char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal); |
|
1374 strncpy(subset_list, VerifySubSet, length + 1); |
|
1375 |
|
1376 char* token = strtok(subset_list, delimiter); |
|
1377 while (token != NULL) { |
|
1378 if (strcmp(token, "threads") == 0) { |
|
1379 verify_flags |= Verify_Threads; |
|
1380 } else if (strcmp(token, "heap") == 0) { |
|
1381 verify_flags |= Verify_Heap; |
|
1382 } else if (strcmp(token, "symbol_table") == 0) { |
|
1383 verify_flags |= Verify_SymbolTable; |
|
1384 } else if (strcmp(token, "string_table") == 0) { |
|
1385 verify_flags |= Verify_StringTable; |
|
1386 } else if (strcmp(token, "codecache") == 0) { |
|
1387 verify_flags |= Verify_CodeCache; |
|
1388 } else if (strcmp(token, "dictionary") == 0) { |
|
1389 verify_flags |= Verify_SystemDictionary; |
|
1390 } else if (strcmp(token, "classloader_data_graph") == 0) { |
|
1391 verify_flags |= Verify_ClassLoaderDataGraph; |
|
1392 } else if (strcmp(token, "metaspace") == 0) { |
|
1393 verify_flags |= Verify_MetaspaceAux; |
|
1394 } else if (strcmp(token, "jni_handles") == 0) { |
|
1395 verify_flags |= Verify_JNIHandles; |
|
1396 } else if (strcmp(token, "c-heap") == 0) { |
|
1397 verify_flags |= Verify_CHeap; |
|
1398 } else if (strcmp(token, "codecache_oops") == 0) { |
|
1399 verify_flags |= Verify_CodeCacheOops; |
|
1400 } else { |
|
1401 vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token)); |
|
1402 } |
|
1403 token = strtok(NULL, delimiter); |
|
1404 } |
|
1405 FREE_C_HEAP_ARRAY(char, subset_list, mtInternal); |
|
1406 } |
|
1407 |
|
1408 bool Universe::should_verify_subset(uint subset) { |
|
1409 if (verify_flags & subset) { |
|
1410 return true; |
|
1411 } |
|
1412 return false; |
|
1413 } |
|
1414 |
1364 void Universe::verify(VerifyOption option, const char* prefix, bool silent) { |
1415 void Universe::verify(VerifyOption option, const char* prefix, bool silent) { |
1365 // The use of _verify_in_progress is a temporary work around for |
1416 // The use of _verify_in_progress is a temporary work around for |
1366 // 6320749. Don't bother with a creating a class to set and clear |
1417 // 6320749. Don't bother with a creating a class to set and clear |
1367 // it since it is only used in this method and the control flow is |
1418 // it since it is only used in this method and the control flow is |
1368 // straight forward. |
1419 // straight forward. |
1378 HandleMark hm; // Handles created during verification can be zapped |
1429 HandleMark hm; // Handles created during verification can be zapped |
1379 _verify_count++; |
1430 _verify_count++; |
1380 |
1431 |
1381 if (!silent) gclog_or_tty->print("%s", prefix); |
1432 if (!silent) gclog_or_tty->print("%s", prefix); |
1382 if (!silent) gclog_or_tty->print("[Verifying "); |
1433 if (!silent) gclog_or_tty->print("[Verifying "); |
1383 if (!silent) gclog_or_tty->print("threads "); |
1434 if (should_verify_subset(Verify_Threads)) { |
1384 Threads::verify(); |
1435 if (!silent) gclog_or_tty->print("Threads "); |
1385 if (!silent) gclog_or_tty->print("heap "); |
1436 Threads::verify(); |
1386 heap()->verify(silent, option); |
1437 } |
1387 if (!silent) gclog_or_tty->print("syms "); |
1438 if (should_verify_subset(Verify_Heap)) { |
1388 SymbolTable::verify(); |
1439 if (!silent) gclog_or_tty->print("Heap "); |
1389 if (!silent) gclog_or_tty->print("strs "); |
1440 heap()->verify(silent, option); |
1390 StringTable::verify(); |
1441 } |
|
1442 if (should_verify_subset(Verify_SymbolTable)) { |
|
1443 if (!silent) gclog_or_tty->print("SymbolTable "); |
|
1444 SymbolTable::verify(); |
|
1445 } |
|
1446 if (should_verify_subset(Verify_StringTable)) { |
|
1447 if (!silent) gclog_or_tty->print("StringTable "); |
|
1448 StringTable::verify(); |
|
1449 } |
|
1450 if (should_verify_subset(Verify_CodeCache)) { |
1391 { |
1451 { |
1392 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
1452 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
1393 if (!silent) gclog_or_tty->print("zone "); |
1453 if (!silent) gclog_or_tty->print("CodeCache "); |
1394 CodeCache::verify(); |
1454 CodeCache::verify(); |
1395 } |
1455 } |
1396 if (!silent) gclog_or_tty->print("dict "); |
1456 } |
1397 SystemDictionary::verify(); |
1457 if (should_verify_subset(Verify_SystemDictionary)) { |
|
1458 if (!silent) gclog_or_tty->print("SystemDictionary "); |
|
1459 SystemDictionary::verify(); |
|
1460 } |
1398 #ifndef PRODUCT |
1461 #ifndef PRODUCT |
1399 if (!silent) gclog_or_tty->print("cldg "); |
1462 if (should_verify_subset(Verify_ClassLoaderDataGraph)) { |
1400 ClassLoaderDataGraph::verify(); |
1463 if (!silent) gclog_or_tty->print("ClassLoaderDataGraph "); |
|
1464 ClassLoaderDataGraph::verify(); |
|
1465 } |
1401 #endif |
1466 #endif |
1402 if (!silent) gclog_or_tty->print("metaspace chunks "); |
1467 if (should_verify_subset(Verify_MetaspaceAux)) { |
1403 MetaspaceAux::verify_free_chunks(); |
1468 if (!silent) gclog_or_tty->print("MetaspaceAux "); |
1404 if (!silent) gclog_or_tty->print("hand "); |
1469 MetaspaceAux::verify_free_chunks(); |
1405 JNIHandles::verify(); |
1470 } |
1406 if (!silent) gclog_or_tty->print("C-heap "); |
1471 if (should_verify_subset(Verify_JNIHandles)) { |
1407 os::check_heap(); |
1472 if (!silent) gclog_or_tty->print("JNIHandles "); |
1408 if (!silent) gclog_or_tty->print("code cache "); |
1473 JNIHandles::verify(); |
1409 CodeCache::verify_oops(); |
1474 } |
|
1475 if (should_verify_subset(Verify_CHeap)) { |
|
1476 if (!silent) gclog_or_tty->print("C-heap "); |
|
1477 os::check_heap(); |
|
1478 } |
|
1479 if (should_verify_subset(Verify_CodeCacheOops)) { |
|
1480 if (!silent) gclog_or_tty->print("CodeCache Oops "); |
|
1481 CodeCache::verify_oops(); |
|
1482 } |
1410 if (!silent) gclog_or_tty->print_cr("]"); |
1483 if (!silent) gclog_or_tty->print_cr("]"); |
1411 |
1484 |
1412 _verify_in_progress = false; |
1485 _verify_in_progress = false; |
1413 } |
1486 } |
1414 |
1487 |