hotspot/src/share/vm/code/codeCache.cpp
changeset 46327 91576389a517
parent 43945 e7f2e49d2274
parent 46289 1904e7ec236e
child 46329 53ccc37bda19
equal deleted inserted replaced
44203:d2d435372329 46327:91576389a517
  1308     }
  1308     }
  1309   }
  1309   }
  1310 }
  1310 }
  1311 
  1311 
  1312 // A CodeHeap is full. Print out warning and report event.
  1312 // A CodeHeap is full. Print out warning and report event.
       
  1313 PRAGMA_DIAG_PUSH
       
  1314 PRAGMA_FORMAT_NONLITERAL_IGNORED
  1313 void CodeCache::report_codemem_full(int code_blob_type, bool print) {
  1315 void CodeCache::report_codemem_full(int code_blob_type, bool print) {
  1314   // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
  1316   // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
  1315   CodeHeap* heap = get_code_heap(code_blob_type);
  1317   CodeHeap* heap = get_code_heap(code_blob_type);
  1316   assert(heap != NULL, "heap is null");
  1318   assert(heap != NULL, "heap is null");
  1317 
  1319 
  1318   if ((heap->full_count() == 0) || print) {
  1320   if ((heap->full_count() == 0) || print) {
  1319     // Not yet reported for this heap, report
  1321     // Not yet reported for this heap, report
  1320     if (SegmentedCodeCache) {
  1322     if (SegmentedCodeCache) {
  1321       warning("%s is full. Compiler has been disabled.", get_code_heap_name(code_blob_type));
  1323       ResourceMark rm;
  1322       warning("Try increasing the code heap size using -XX:%s=", get_code_heap_flag_name(code_blob_type));
  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);
  1323     } else {
  1336     } else {
  1324       warning("CodeCache is full. Compiler has been disabled.");
  1337       const char *msg1 = "CodeCache is full. Compiler has been disabled.";
  1325       warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
  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);
  1326     }
  1344     }
  1327     ResourceMark rm;
  1345     ResourceMark rm;
  1328     stringStream s;
  1346     stringStream s;
  1329     // Dump code cache  into a buffer before locking the tty,
  1347     // Dump code cache  into a buffer before locking the tty,
  1330     {
  1348     {
  1349     event.set_unallocatedCapacity(heap->unallocated_capacity());
  1367     event.set_unallocatedCapacity(heap->unallocated_capacity());
  1350     event.set_fullCount(heap->full_count());
  1368     event.set_fullCount(heap->full_count());
  1351     event.commit();
  1369     event.commit();
  1352   }
  1370   }
  1353 }
  1371 }
       
  1372 PRAGMA_DIAG_POP
  1354 
  1373 
  1355 void CodeCache::print_memory_overhead() {
  1374 void CodeCache::print_memory_overhead() {
  1356   size_t wasted_bytes = 0;
  1375   size_t wasted_bytes = 0;
  1357   FOR_ALL_NMETHOD_HEAPS(heap) {
  1376   FOR_ALL_NMETHOD_HEAPS(heap) {
  1358       CodeHeap* curr_heap = *heap;
  1377       CodeHeap* curr_heap = *heap;