hotspot/src/share/vm/compiler/compileBroker.cpp
changeset 26796 666464578742
parent 26587 e8b28fa936af
child 26799 0c349e16bbe8
child 26798 8bd1ac54be56
equal deleted inserted replaced
26706:1e985d72c57f 26796:666464578742
  1745   // space in the code cache to generate the necessary stubs, etc.
  1745   // space in the code cache to generate the necessary stubs, etc.
  1746   while (!is_compilation_disabled_forever()) {
  1746   while (!is_compilation_disabled_forever()) {
  1747     // We need this HandleMark to avoid leaking VM handles.
  1747     // We need this HandleMark to avoid leaking VM handles.
  1748     HandleMark hm(thread);
  1748     HandleMark hm(thread);
  1749 
  1749 
  1750     if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) {
  1750     // Check if the CodeCache is full
  1751       // the code cache is really full
  1751     int code_blob_type = 0;
  1752       handle_full_code_cache();
  1752     if (CodeCache::is_full(&code_blob_type)) {
       
  1753       // The CodeHeap for code_blob_type is really full
       
  1754       handle_full_code_cache(code_blob_type);
  1753     }
  1755     }
  1754 
  1756 
  1755     CompileTask* task = queue->get();
  1757     CompileTask* task = queue->get();
  1756     if (task == NULL) {
  1758     if (task == NULL) {
  1757       continue;
  1759       continue;
  2077 
  2079 
  2078 /**
  2080 /**
  2079  * The CodeCache is full.  Print out warning and disable compilation
  2081  * The CodeCache is full.  Print out warning and disable compilation
  2080  * or try code cache cleaning so compilation can continue later.
  2082  * or try code cache cleaning so compilation can continue later.
  2081  */
  2083  */
  2082 void CompileBroker::handle_full_code_cache() {
  2084 void CompileBroker::handle_full_code_cache(int code_blob_type) {
  2083   UseInterpreter = true;
  2085   UseInterpreter = true;
  2084   if (UseCompiler || AlwaysCompileLoopMethods ) {
  2086   if (UseCompiler || AlwaysCompileLoopMethods ) {
  2085     if (xtty != NULL) {
  2087     if (xtty != NULL) {
  2086       ResourceMark rm;
  2088       ResourceMark rm;
  2087       stringStream s;
  2089       stringStream s;
  2094       xtty->print("%s", s.as_string());
  2096       xtty->print("%s", s.as_string());
  2095       xtty->stamp();
  2097       xtty->stamp();
  2096       xtty->end_elem();
  2098       xtty->end_elem();
  2097     }
  2099     }
  2098 
  2100 
  2099     CodeCache::report_codemem_full();
       
  2100 
       
  2101 #ifndef PRODUCT
  2101 #ifndef PRODUCT
  2102     if (CompileTheWorld || ExitOnFullCodeCache) {
  2102     if (CompileTheWorld || ExitOnFullCodeCache) {
  2103       codecache_print(/* detailed= */ true);
  2103       codecache_print(/* detailed= */ true);
  2104       before_exit(JavaThread::current());
  2104       before_exit(JavaThread::current());
  2105       exit_globals(); // will delete tty
  2105       exit_globals(); // will delete tty
  2117       NMethodSweeper::possibly_sweep();
  2117       NMethodSweeper::possibly_sweep();
  2118     } else {
  2118     } else {
  2119       disable_compilation_forever();
  2119       disable_compilation_forever();
  2120     }
  2120     }
  2121 
  2121 
  2122     // Print warning only once
  2122     CodeCache::report_codemem_full(code_blob_type, should_print_compiler_warning());
  2123     if (should_print_compiler_warning()) {
       
  2124       warning("CodeCache is full. Compiler has been disabled.");
       
  2125       warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
       
  2126       codecache_print(/* detailed= */ true);
       
  2127     }
       
  2128   }
  2123   }
  2129 }
  2124 }
  2130 
  2125 
  2131 // ------------------------------------------------------------------
  2126 // ------------------------------------------------------------------
  2132 // CompileBroker::set_last_compile
  2127 // CompileBroker::set_last_compile