1293 Deoptimization::deoptimize_dependents(); 1294 1295 // Make the dependent methods not entrant 1296 make_marked_nmethods_not_entrant(); 1297 } 1298 } 1299 1300 void CodeCache::verify() { 1301 assert_locked_or_safepoint(CodeCache_lock); 1302 FOR_ALL_HEAPS(heap) { 1303 (*heap)->verify(); 1304 FOR_ALL_BLOBS(cb, *heap) { 1305 if (cb->is_alive()) { 1306 cb->verify(); 1307 } 1308 } 1309 } 1310 } 1311 1312 // A CodeHeap is full. Print out warning and report event. 1313 void CodeCache::report_codemem_full(int code_blob_type, bool print) { 1314 // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event 1315 CodeHeap* heap = get_code_heap(code_blob_type); 1316 assert(heap != NULL, "heap is null"); 1317 1318 if ((heap->full_count() == 0) || print) { 1319 // Not yet reported for this heap, report 1320 if (SegmentedCodeCache) { 1321 warning("%s is full. Compiler has been disabled.", get_code_heap_name(code_blob_type)); 1322 warning("Try increasing the code heap size using -XX:%s=", get_code_heap_flag_name(code_blob_type)); 1323 } else { 1324 warning("CodeCache is full. Compiler has been disabled."); 1325 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); 1326 } 1327 ResourceMark rm; 1328 stringStream s; 1329 // Dump code cache into a buffer before locking the tty, 1330 { 1331 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 1332 print_summary(&s); 1333 } 1334 ttyLocker ttyl; 1335 tty->print("%s", s.as_string()); 1336 } 1337 1338 heap->report_full(); 1339 1340 EventCodeCacheFull event; 1341 if (event.should_commit()) { 1342 event.set_codeBlobType((u1)code_blob_type); 1343 event.set_startAddress((u8)heap->low_boundary()); 1344 event.set_commitedTopAddress((u8)heap->high()); 1345 event.set_reservedTopAddress((u8)heap->high_boundary()); 1346 event.set_entryCount(heap->blob_count()); 1347 event.set_methodCount(heap->nmethod_count()); 1348 event.set_adaptorCount(heap->adapter_count()); 1349 event.set_unallocatedCapacity(heap->unallocated_capacity()); 1350 event.set_fullCount(heap->full_count()); 1351 event.commit(); 1352 } 1353 } 1354 1355 void CodeCache::print_memory_overhead() { 1356 size_t wasted_bytes = 0; 1357 FOR_ALL_NMETHOD_HEAPS(heap) { 1358 CodeHeap* curr_heap = *heap; 1359 for (CodeBlob* cb = (CodeBlob*)curr_heap->first(); cb != NULL; cb = (CodeBlob*)curr_heap->next(cb)) { 1360 HeapBlock* heap_block = ((HeapBlock*)cb) - 1; 1361 wasted_bytes += heap_block->length() * CodeCacheSegmentSize - cb->size(); 1362 } 1363 } 1364 // Print bytes that are allocated in the freelist 1365 ttyLocker ttl; 1366 tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelists_length()); 1367 tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelists()/K); 1368 tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K)); 1369 tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment 1370 } 1371 1372 //------------------------------------------------------------------------------------------------ 1373 // Non-product version | 1293 Deoptimization::deoptimize_dependents(); 1294 1295 // Make the dependent methods not entrant 1296 make_marked_nmethods_not_entrant(); 1297 } 1298 } 1299 1300 void CodeCache::verify() { 1301 assert_locked_or_safepoint(CodeCache_lock); 1302 FOR_ALL_HEAPS(heap) { 1303 (*heap)->verify(); 1304 FOR_ALL_BLOBS(cb, *heap) { 1305 if (cb->is_alive()) { 1306 cb->verify(); 1307 } 1308 } 1309 } 1310 } 1311 1312 // A CodeHeap is full. Print out warning and report event. 1313 PRAGMA_DIAG_PUSH 1314 PRAGMA_FORMAT_NONLITERAL_IGNORED 1315 void CodeCache::report_codemem_full(int code_blob_type, bool print) { 1316 // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event 1317 CodeHeap* heap = get_code_heap(code_blob_type); 1318 assert(heap != NULL, "heap is null"); 1319 1320 if ((heap->full_count() == 0) || print) { 1321 // Not yet reported for this heap, report 1322 if (SegmentedCodeCache) { 1323 ResourceMark rm; 1324 stringStream msg1_stream, msg2_stream; 1325 msg1_stream.print("%s is full. Compiler has been disabled.", 1326 get_code_heap_name(code_blob_type)); 1327 msg2_stream.print("Try increasing the code heap size using -XX:%s=", 1328 get_code_heap_flag_name(code_blob_type)); 1329 const char *msg1 = msg1_stream.as_string(); 1330 const char *msg2 = msg2_stream.as_string(); 1331 1332 log_warning(codecache)(msg1); 1333 log_warning(codecache)(msg2); 1334 warning(msg1); 1335 warning(msg2); 1336 } else { 1337 const char *msg1 = "CodeCache is full. Compiler has been disabled."; 1338 const char *msg2 = "Try increasing the code cache size using -XX:ReservedCodeCacheSize="; 1339 1340 log_warning(codecache)(msg1); 1341 log_warning(codecache)(msg2); 1342 warning(msg1); 1343 warning(msg2); 1344 } 1345 ResourceMark rm; 1346 stringStream s; 1347 // Dump code cache into a buffer before locking the tty, 1348 { 1349 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 1350 print_summary(&s); 1351 } 1352 ttyLocker ttyl; 1353 tty->print("%s", s.as_string()); 1354 } 1355 1356 heap->report_full(); 1357 1358 EventCodeCacheFull event; 1359 if (event.should_commit()) { 1360 event.set_codeBlobType((u1)code_blob_type); 1361 event.set_startAddress((u8)heap->low_boundary()); 1362 event.set_commitedTopAddress((u8)heap->high()); 1363 event.set_reservedTopAddress((u8)heap->high_boundary()); 1364 event.set_entryCount(heap->blob_count()); 1365 event.set_methodCount(heap->nmethod_count()); 1366 event.set_adaptorCount(heap->adapter_count()); 1367 event.set_unallocatedCapacity(heap->unallocated_capacity()); 1368 event.set_fullCount(heap->full_count()); 1369 event.commit(); 1370 } 1371 } 1372 PRAGMA_DIAG_POP 1373 1374 void CodeCache::print_memory_overhead() { 1375 size_t wasted_bytes = 0; 1376 FOR_ALL_NMETHOD_HEAPS(heap) { 1377 CodeHeap* curr_heap = *heap; 1378 for (CodeBlob* cb = (CodeBlob*)curr_heap->first(); cb != NULL; cb = (CodeBlob*)curr_heap->next(cb)) { 1379 HeapBlock* heap_block = ((HeapBlock*)cb) - 1; 1380 wasted_bytes += heap_block->length() * CodeCacheSegmentSize - cb->size(); 1381 } 1382 } 1383 // Print bytes that are allocated in the freelist 1384 ttyLocker ttl; 1385 tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelists_length()); 1386 tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelists()/K); 1387 tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K)); 1388 tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment 1389 } 1390 1391 //------------------------------------------------------------------------------------------------ 1392 // Non-product version |