< prev index next >

src/hotspot/share/code/codeCache.cpp

Print this page
rev 49260 : [mq]: 8198691.patch
   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "code/codeBlob.hpp"
  28 #include "code/codeCache.hpp"

  29 #include "code/compiledIC.hpp"
  30 #include "code/dependencies.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "code/nmethod.hpp"
  33 #include "code/pcDesc.hpp"
  34 #include "compiler/compileBroker.hpp"
  35 #include "gc/shared/gcLocker.hpp"


  36 #include "memory/allocation.inline.hpp"
  37 #include "memory/iterator.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "oops/method.inline.hpp"
  40 #include "oops/objArrayOop.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "oops/verifyOopClosure.hpp"
  43 #include "runtime/arguments.hpp"
  44 #include "runtime/compilationPolicy.hpp"
  45 #include "runtime/deoptimization.hpp"
  46 #include "runtime/handles.inline.hpp"
  47 #include "runtime/icache.hpp"
  48 #include "runtime/java.hpp"
  49 #include "runtime/mutexLocker.hpp"
  50 #include "runtime/sweeper.hpp"
  51 #include "services/memoryService.hpp"
  52 #include "trace/tracing.hpp"
  53 #include "utilities/align.hpp"
  54 #include "utilities/vmError.hpp"
  55 #include "utilities/xmlstream.hpp"


1348       warning(msg1);
1349       warning(msg2);
1350     } else {
1351       const char *msg1 = "CodeCache is full. Compiler has been disabled.";
1352       const char *msg2 = "Try increasing the code cache size using -XX:ReservedCodeCacheSize=";
1353 
1354       log_warning(codecache)(msg1);
1355       log_warning(codecache)(msg2);
1356       warning(msg1);
1357       warning(msg2);
1358     }
1359     ResourceMark rm;
1360     stringStream s;
1361     // Dump code cache  into a buffer before locking the tty,
1362     {
1363       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1364       print_summary(&s);
1365     }
1366     ttyLocker ttyl;
1367     tty->print("%s", s.as_string());









1368   }
1369 
1370   heap->report_full();
1371 
1372   EventCodeCacheFull event;
1373   if (event.should_commit()) {
1374     event.set_codeBlobType((u1)code_blob_type);
1375     event.set_startAddress((u8)heap->low_boundary());
1376     event.set_commitedTopAddress((u8)heap->high());
1377     event.set_reservedTopAddress((u8)heap->high_boundary());
1378     event.set_entryCount(heap->blob_count());
1379     event.set_methodCount(heap->nmethod_count());
1380     event.set_adaptorCount(heap->adapter_count());
1381     event.set_unallocatedCapacity(heap->unallocated_capacity());
1382     event.set_fullCount(heap->full_count());
1383     event.commit();
1384   }
1385 }
1386 PRAGMA_DIAG_POP
1387 


1622     char* method_name = cm->method()->name_and_sig_as_C_string();
1623     st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
1624                  cm->compile_id(), cm->comp_level(), cm->get_state(),
1625                  method_name,
1626                  (intptr_t)cm->header_begin(), (intptr_t)cm->code_begin(), (intptr_t)cm->code_end());
1627   }
1628 }
1629 
1630 void CodeCache::print_layout(outputStream* st) {
1631   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1632   ResourceMark rm;
1633   print_summary(st, true);
1634 }
1635 
1636 void CodeCache::log_state(outputStream* st) {
1637   st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
1638             " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
1639             blob_count(), nmethod_count(), adapter_count(),
1640             unallocated_capacity());
1641 }



















































   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "code/codeBlob.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "code/codeHeapState.hpp"
  30 #include "code/compiledIC.hpp"
  31 #include "code/dependencies.hpp"
  32 #include "code/icBuffer.hpp"
  33 #include "code/nmethod.hpp"
  34 #include "code/pcDesc.hpp"
  35 #include "compiler/compileBroker.hpp"
  36 #include "gc/shared/gcLocker.hpp"
  37 #include "logging/log.hpp"
  38 #include "logging/logStream.hpp"
  39 #include "memory/allocation.inline.hpp"
  40 #include "memory/iterator.hpp"
  41 #include "memory/resourceArea.hpp"
  42 #include "oops/method.inline.hpp"
  43 #include "oops/objArrayOop.hpp"
  44 #include "oops/oop.inline.hpp"
  45 #include "oops/verifyOopClosure.hpp"
  46 #include "runtime/arguments.hpp"
  47 #include "runtime/compilationPolicy.hpp"
  48 #include "runtime/deoptimization.hpp"
  49 #include "runtime/handles.inline.hpp"
  50 #include "runtime/icache.hpp"
  51 #include "runtime/java.hpp"
  52 #include "runtime/mutexLocker.hpp"
  53 #include "runtime/sweeper.hpp"
  54 #include "services/memoryService.hpp"
  55 #include "trace/tracing.hpp"
  56 #include "utilities/align.hpp"
  57 #include "utilities/vmError.hpp"
  58 #include "utilities/xmlstream.hpp"


1351       warning(msg1);
1352       warning(msg2);
1353     } else {
1354       const char *msg1 = "CodeCache is full. Compiler has been disabled.";
1355       const char *msg2 = "Try increasing the code cache size using -XX:ReservedCodeCacheSize=";
1356 
1357       log_warning(codecache)(msg1);
1358       log_warning(codecache)(msg2);
1359       warning(msg1);
1360       warning(msg2);
1361     }
1362     ResourceMark rm;
1363     stringStream s;
1364     // Dump code cache  into a buffer before locking the tty,
1365     {
1366       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1367       print_summary(&s);
1368     }
1369     ttyLocker ttyl;
1370     tty->print("%s", s.as_string());
1371 
1372     if (heap->full_count() == 0) {
1373       LogTarget(Debug, codecache) lt;
1374       if (lt.is_enabled()) {
1375 //         LogStream ls(lt);
1376 //         CompileBroker::print_heapinfo(&ls, "all", "4096"); // details, may be a lot!
1377         CompileBroker::print_heapinfo(tty, "all", "4096"); // details, may be a lot!
1378       }
1379     }
1380   }
1381 
1382   heap->report_full();
1383 
1384   EventCodeCacheFull event;
1385   if (event.should_commit()) {
1386     event.set_codeBlobType((u1)code_blob_type);
1387     event.set_startAddress((u8)heap->low_boundary());
1388     event.set_commitedTopAddress((u8)heap->high());
1389     event.set_reservedTopAddress((u8)heap->high_boundary());
1390     event.set_entryCount(heap->blob_count());
1391     event.set_methodCount(heap->nmethod_count());
1392     event.set_adaptorCount(heap->adapter_count());
1393     event.set_unallocatedCapacity(heap->unallocated_capacity());
1394     event.set_fullCount(heap->full_count());
1395     event.commit();
1396   }
1397 }
1398 PRAGMA_DIAG_POP
1399 


1634     char* method_name = cm->method()->name_and_sig_as_C_string();
1635     st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
1636                  cm->compile_id(), cm->comp_level(), cm->get_state(),
1637                  method_name,
1638                  (intptr_t)cm->header_begin(), (intptr_t)cm->code_begin(), (intptr_t)cm->code_end());
1639   }
1640 }
1641 
1642 void CodeCache::print_layout(outputStream* st) {
1643   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1644   ResourceMark rm;
1645   print_summary(st, true);
1646 }
1647 
1648 void CodeCache::log_state(outputStream* st) {
1649   st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
1650             " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
1651             blob_count(), nmethod_count(), adapter_count(),
1652             unallocated_capacity());
1653 }
1654 
1655 //---<  BEGIN  >--- CodeHeap State Analytics.
1656 
1657 void CodeCache::aggregate(outputStream *out, const char* granularity) {
1658   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1659     CodeHeapState::aggregate(out, (*heap), granularity);
1660   }
1661 }
1662 
1663 void CodeCache::discard(outputStream *out) {
1664   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1665     CodeHeapState::discard(out, (*heap));
1666   }
1667 }
1668 
1669 void CodeCache::print_usedSpace(outputStream *out) {
1670   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1671     CodeHeapState::print_usedSpace(out, (*heap));
1672   }
1673 }
1674 
1675 void CodeCache::print_freeSpace(outputStream *out) {
1676   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1677     CodeHeapState::print_freeSpace(out, (*heap));
1678   }
1679 }
1680 
1681 void CodeCache::print_count(outputStream *out) {
1682   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1683     CodeHeapState::print_count(out, (*heap));
1684   }
1685 }
1686 
1687 void CodeCache::print_space(outputStream *out) {
1688   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1689     CodeHeapState::print_space(out, (*heap));
1690   }
1691 }
1692 
1693 void CodeCache::print_age(outputStream *out) {
1694   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1695     CodeHeapState::print_age(out, (*heap));
1696   }
1697 }
1698 
1699 void CodeCache::print_names(outputStream *out) {
1700   FOR_ALL_ALLOCABLE_HEAPS(heap) {
1701     CodeHeapState::print_names(out, (*heap));
1702   }
1703 }
1704 //---<  END  >--- CodeHeap State Analytics.
< prev index next >