hotspot/src/share/vm/compiler/compileBroker.cpp
changeset 21575 6a9645992cee
parent 21204 1c993523cf85
child 22851 4c4b6a45be43
child 22247 cde20a0fa906
equal deleted inserted replaced
21574:d47713227456 21575:6a9645992cee
   124 
   124 
   125 #endif // ndef DTRACE_ENABLED
   125 #endif // ndef DTRACE_ENABLED
   126 
   126 
   127 bool CompileBroker::_initialized = false;
   127 bool CompileBroker::_initialized = false;
   128 volatile bool CompileBroker::_should_block = false;
   128 volatile bool CompileBroker::_should_block = false;
       
   129 volatile jint CompileBroker::_print_compilation_warning = 0;
   129 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation;
   130 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation;
   130 
   131 
   131 // The installed compiler(s)
   132 // The installed compiler(s)
   132 AbstractCompiler* CompileBroker::_compilers[2];
   133 AbstractCompiler* CompileBroker::_compilers[2];
   133 
   134 
  2025     vm_exit(0);
  2026     vm_exit(0);
  2026   }
  2027   }
  2027 #endif
  2028 #endif
  2028 }
  2029 }
  2029 
  2030 
  2030 // ------------------------------------------------------------------
  2031 /**
  2031 // CompileBroker::handle_full_code_cache
  2032  * The CodeCache is full.  Print out warning and disable compilation
  2032 //
  2033  * or try code cache cleaning so compilation can continue later.
  2033 // The CodeCache is full.  Print out warning and disable compilation or
  2034  */
  2034 // try code cache cleaning so compilation can continue later.
       
  2035 void CompileBroker::handle_full_code_cache() {
  2035 void CompileBroker::handle_full_code_cache() {
  2036   UseInterpreter = true;
  2036   UseInterpreter = true;
  2037   if (UseCompiler || AlwaysCompileLoopMethods ) {
  2037   if (UseCompiler || AlwaysCompileLoopMethods ) {
  2038     if (xtty != NULL) {
  2038     if (xtty != NULL) {
  2039       ResourceMark rm;
  2039       ResourceMark rm;
  2046       xtty->begin_elem("code_cache_full");
  2046       xtty->begin_elem("code_cache_full");
  2047       xtty->print(s.as_string());
  2047       xtty->print(s.as_string());
  2048       xtty->stamp();
  2048       xtty->stamp();
  2049       xtty->end_elem();
  2049       xtty->end_elem();
  2050     }
  2050     }
  2051     warning("CodeCache is full. Compiler has been disabled.");
       
  2052     warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
       
  2053 
  2051 
  2054     CodeCache::report_codemem_full();
  2052     CodeCache::report_codemem_full();
  2055 
       
  2056 
  2053 
  2057 #ifndef PRODUCT
  2054 #ifndef PRODUCT
  2058     if (CompileTheWorld || ExitOnFullCodeCache) {
  2055     if (CompileTheWorld || ExitOnFullCodeCache) {
  2059       codecache_print(/* detailed= */ true);
  2056       codecache_print(/* detailed= */ true);
  2060       before_exit(JavaThread::current());
  2057       before_exit(JavaThread::current());
  2064 #endif
  2061 #endif
  2065     if (UseCodeCacheFlushing) {
  2062     if (UseCodeCacheFlushing) {
  2066       // Since code cache is full, immediately stop new compiles
  2063       // Since code cache is full, immediately stop new compiles
  2067       if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
  2064       if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
  2068         NMethodSweeper::log_sweep("disable_compiler");
  2065         NMethodSweeper::log_sweep("disable_compiler");
  2069 
       
  2070         // Switch to 'vm_state'. This ensures that possibly_sweep() can be called
       
  2071         // without having to consider the state in which the current thread is.
       
  2072         ThreadInVMfromUnknown in_vm;
       
  2073         NMethodSweeper::possibly_sweep();
       
  2074       }
  2066       }
       
  2067       // Switch to 'vm_state'. This ensures that possibly_sweep() can be called
       
  2068       // without having to consider the state in which the current thread is.
       
  2069       ThreadInVMfromUnknown in_vm;
       
  2070       NMethodSweeper::possibly_sweep();
  2075     } else {
  2071     } else {
  2076       disable_compilation_forever();
  2072       disable_compilation_forever();
  2077     }
  2073     }
  2078   }
  2074 
  2079   codecache_print(/* detailed= */ true);
  2075     // Print warning only once
       
  2076     if (should_print_compiler_warning()) {
       
  2077       warning("CodeCache is full. Compiler has been disabled.");
       
  2078       warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
       
  2079       codecache_print(/* detailed= */ true);
       
  2080     }
       
  2081   }
  2080 }
  2082 }
  2081 
  2083 
  2082 // ------------------------------------------------------------------
  2084 // ------------------------------------------------------------------
  2083 // CompileBroker::set_last_compile
  2085 // CompileBroker::set_last_compile
  2084 //
  2086 //