src/share/vm/compiler/compileBroker.cpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
   1 /*
   2  * Copyright (c) 1999, 2012, 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  *


  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/compileLog.hpp"
  31 #include "compiler/compilerOracle.hpp"
  32 #include "interpreter/linkResolver.hpp"
  33 #include "memory/allocation.inline.hpp"
  34 #include "oops/methodData.hpp"
  35 #include "oops/method.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "prims/nativeLookup.hpp"
  38 #include "runtime/arguments.hpp"
  39 #include "runtime/compilationPolicy.hpp"
  40 #include "runtime/init.hpp"
  41 #include "runtime/interfaceSupport.hpp"
  42 #include "runtime/javaCalls.hpp"
  43 #include "runtime/os.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/sweeper.hpp"

  46 #include "utilities/dtrace.hpp"
  47 #include "utilities/events.hpp"
  48 #ifdef COMPILER1
  49 #include "c1/c1_Compiler.hpp"
  50 #endif
  51 #ifdef COMPILER2
  52 #include "opto/c2compiler.hpp"
  53 #endif
  54 #ifdef SHARK
  55 #include "shark/sharkCompiler.hpp"
  56 #endif
  57 
  58 #ifdef DTRACE_ENABLED
  59 
  60 // Only bother with this argument setup if dtrace is available
  61 
  62 #ifndef USDT2
  63 HS_DTRACE_PROBE_DECL8(hotspot, method__compile__begin,
  64   char*, intptr_t, char*, intptr_t, char*, intptr_t, char*, intptr_t);
  65 HS_DTRACE_PROBE_DECL9(hotspot, method__compile__end,


 162 PerfVariable*       CompileBroker::_perf_last_compile_size = NULL;
 163 PerfVariable*       CompileBroker::_perf_last_failed_type = NULL;
 164 PerfVariable*       CompileBroker::_perf_last_invalidated_type = NULL;
 165 
 166 // Timers and counters for generating statistics
 167 elapsedTimer CompileBroker::_t_total_compilation;
 168 elapsedTimer CompileBroker::_t_osr_compilation;
 169 elapsedTimer CompileBroker::_t_standard_compilation;
 170 
 171 int CompileBroker::_total_bailout_count          = 0;
 172 int CompileBroker::_total_invalidated_count      = 0;
 173 int CompileBroker::_total_compile_count          = 0;
 174 int CompileBroker::_total_osr_compile_count      = 0;
 175 int CompileBroker::_total_standard_compile_count = 0;
 176 
 177 int CompileBroker::_sum_osr_bytes_compiled       = 0;
 178 int CompileBroker::_sum_standard_bytes_compiled  = 0;
 179 int CompileBroker::_sum_nmethod_size             = 0;
 180 int CompileBroker::_sum_nmethod_code_size        = 0;
 181 


 182 CompileQueue* CompileBroker::_c2_method_queue   = NULL;
 183 CompileQueue* CompileBroker::_c1_method_queue   = NULL;
 184 CompileTask*  CompileBroker::_task_free_list = NULL;
 185 
 186 GrowableArray<CompilerThread*>* CompileBroker::_method_threads = NULL;
 187 
 188 
 189 class CompilationLog : public StringEventLog {
 190  public:
 191   CompilationLog() : StringEventLog("Compilation events") {
 192   }
 193 
 194   void log_compile(JavaThread* thread, CompileTask* task) {
 195     StringLogMessage lm;
 196     stringStream sstr = lm.stream();
 197     // msg.time_stamp().update_to(tty->time_stamp().ticks());
 198     task->print_compilation(&sstr, NULL, true);
 199     log(thread, "%s", (const char*)lm);
 200   }
 201 


1783 
1784     ciEnv ci_env(task, system_dictionary_modification_counter);
1785     if (should_break) {
1786       ci_env.set_break_at_compile(true);
1787     }
1788     if (should_log) {
1789       ci_env.set_log(thread->log());
1790     }
1791     assert(thread->env() == &ci_env, "set by ci_env");
1792     // The thread-env() field is cleared in ~CompileTaskWrapper.
1793 
1794     // Cache Jvmti state
1795     ci_env.cache_jvmti_state();
1796 
1797     // Cache DTrace flags
1798     ci_env.cache_dtrace_flags();
1799 
1800     ciMethod* target = ci_env.get_method_from_handle(target_handle);
1801 
1802     TraceTime t1("compilation", &time);

1803 
1804     AbstractCompiler *comp = compiler(task_level);
1805     if (comp == NULL) {
1806       ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
1807     } else {
1808       comp->compile_method(&ci_env, target, osr_bci);
1809     }
1810 
1811     if (!ci_env.failing() && task->code() == NULL) {
1812       //assert(false, "compiler should always document failure");
1813       // The compiler elected, without comment, not to register a result.
1814       // Do not attempt further compilations of this method.
1815       ci_env.record_method_not_compilable("compile failed", !TieredCompilation);
1816     }
1817 
1818     // Copy this bit to the enclosing block:
1819     compilable = ci_env.compilable();
1820 
1821     if (ci_env.failing()) {
1822       const char* retry_message = ci_env.retry_message();


1824         _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
1825       }
1826       if (PrintCompilation) {
1827         FormatBufferResource msg = retry_message != NULL ?
1828             err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
1829             err_msg_res("COMPILE SKIPPED: %s",      ci_env.failure_reason());
1830         task->print_compilation(tty, msg);
1831       }
1832     } else {
1833       task->mark_success();
1834       task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes());
1835       if (_compilation_log != NULL) {
1836         nmethod* code = task->code();
1837         if (code != NULL) {
1838           _compilation_log->log_nmethod(thread, code);
1839         }
1840       }
1841     }
1842     // simulate crash during compilation
1843     assert(task->compile_id() != CICrashAt, "just as planned");










1844   }
1845   pop_jni_handle_block();
1846 
1847   methodHandle method(thread, task->method());
1848 
1849   DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
1850 
1851   collect_statistics(thread, time, task);
1852 
1853   if (PrintCompilation && PrintCompilation2) {
1854     tty->print("%7d ", (int) tty->time_stamp().milliseconds());  // print timestamp
1855     tty->print("%4d ", compile_id);    // print compilation number
1856     tty->print("%s ", (is_osr ? "%" : " "));
1857     if (task->code() != NULL) {
1858       tty->print("size: %d(%d) ", task->code()->total_size(), task->code()->insts_size());
1859     }
1860     tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes());
1861   }
1862 
1863   if (PrintCodeCacheOnCompilation)


1904 // The CodeCache is full.  Print out warning and disable compilation or
1905 // try code cache cleaning so compilation can continue later.
1906 void CompileBroker::handle_full_code_cache() {
1907   UseInterpreter = true;
1908   if (UseCompiler || AlwaysCompileLoopMethods ) {
1909     if (xtty != NULL) {
1910       ResourceMark rm;
1911       stringStream s;
1912       // Dump code cache state into a buffer before locking the tty,
1913       // because log_state() will use locks causing lock conflicts.
1914       CodeCache::log_state(&s);
1915       // Lock to prevent tearing
1916       ttyLocker ttyl;
1917       xtty->begin_elem("code_cache_full");
1918       xtty->print(s.as_string());
1919       xtty->stamp();
1920       xtty->end_elem();
1921     }
1922     warning("CodeCache is full. Compiler has been disabled.");
1923     warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");




1924 #ifndef PRODUCT
1925     if (CompileTheWorld || ExitOnFullCodeCache) {
1926       codecache_print(/* detailed= */ true);
1927       before_exit(JavaThread::current());
1928       exit_globals(); // will delete tty
1929       vm_direct_exit(CompileTheWorld ? 0 : 1);
1930     }
1931 #endif
1932     if (UseCodeCacheFlushing) {
1933       NMethodSweeper::handle_full_code_cache(true);
1934     } else {
1935       UseCompiler               = false;
1936       AlwaysCompileLoopMethods  = false;
1937     }
1938   }
1939   codecache_print(/* detailed= */ true);
1940 }
1941 
1942 // ------------------------------------------------------------------
1943 // CompileBroker::set_last_compile


2061     _total_bailout_count++;
2062     if (UsePerfData) {
2063       _perf_last_failed_method->set_value(counters->current_method());
2064       _perf_last_failed_type->set_value(counters->compile_type());
2065       _perf_total_bailout_count->inc();
2066     }
2067   } else if (code == NULL) {
2068     if (UsePerfData) {
2069       _perf_last_invalidated_method->set_value(counters->current_method());
2070       _perf_last_invalidated_type->set_value(counters->compile_type());
2071       _perf_total_invalidated_count->inc();
2072     }
2073     _total_invalidated_count++;
2074   } else {
2075     // Compilation succeeded
2076 
2077     // update compilation ticks - used by the implementation of
2078     // java.lang.management.CompilationMBean
2079     _perf_total_compilation->inc(time.ticks());
2080 
2081     if (CITime) {
2082       _t_total_compilation.add(time);



2083       if (is_osr) {
2084         _t_osr_compilation.add(time);
2085         _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
2086       } else {
2087         _t_standard_compilation.add(time);
2088         _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
2089       }
2090     }
2091 
2092     if (UsePerfData) {
2093       // save the name of the last method compiled
2094       _perf_last_method->set_value(counters->current_method());
2095       _perf_last_compile_type->set_value(counters->compile_type());
2096       _perf_last_compile_size->set_value(method->code_size() +
2097                                          task->num_inlined_bytecodes());
2098       if (is_osr) {
2099         _perf_osr_compilation->inc(time.ticks());
2100         _perf_sum_osr_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes());
2101       } else {
2102         _perf_standard_compilation->inc(time.ticks());


2160   }
2161   comp = compiler(CompLevel_full_optimization);
2162   if (comp != NULL) {
2163     comp->print_timers();
2164   }
2165   tty->cr();
2166   tty->print_cr("  Total compiled methods   : %6d methods", CompileBroker::_total_compile_count);
2167   tty->print_cr("    Standard compilation   : %6d methods", CompileBroker::_total_standard_compile_count);
2168   tty->print_cr("    On stack replacement   : %6d methods", CompileBroker::_total_osr_compile_count);
2169   int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled;
2170   tty->print_cr("  Total compiled bytecodes : %6d bytes", tcb);
2171   tty->print_cr("    Standard compilation   : %6d bytes", CompileBroker::_sum_standard_bytes_compiled);
2172   tty->print_cr("    On stack replacement   : %6d bytes", CompileBroker::_sum_osr_bytes_compiled);
2173   int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds());
2174   tty->print_cr("  Average compilation speed: %6d bytes/s", bps);
2175   tty->cr();
2176   tty->print_cr("  nmethod code size        : %6d bytes", CompileBroker::_sum_nmethod_code_size);
2177   tty->print_cr("  nmethod total size       : %6d bytes", CompileBroker::_sum_nmethod_size);
2178 }
2179 
2180 
2181 // Debugging output for failure
2182 void CompileBroker::print_last_compile() {
2183   if ( _last_compile_level != CompLevel_none &&
2184        compiler(_last_compile_level) != NULL &&
2185        _last_method_compiled != NULL &&
2186        _last_compile_type != no_compile) {
2187     if (_last_compile_type == osr_compile) {
2188       tty->print_cr("Last parse:  [osr]%d+++(%d) %s",
2189                     _osr_compilation_id, _last_compile_level, _last_method_compiled);
2190     } else {
2191       tty->print_cr("Last parse:  %d+++(%d) %s",
2192                     _compilation_id, _last_compile_level, _last_method_compiled);
2193     }
2194   }
2195 }
2196 
2197 
2198 void CompileBroker::print_compiler_threads_on(outputStream* st) {
2199 #ifndef PRODUCT
2200   st->print_cr("Compiler thread printing unimplemented.");
   1 /*
   2  * Copyright (c) 1999, 2013, 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  *


  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/compileLog.hpp"
  31 #include "compiler/compilerOracle.hpp"
  32 #include "interpreter/linkResolver.hpp"
  33 #include "memory/allocation.inline.hpp"
  34 #include "oops/methodData.hpp"
  35 #include "oops/method.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "prims/nativeLookup.hpp"
  38 #include "runtime/arguments.hpp"
  39 #include "runtime/compilationPolicy.hpp"
  40 #include "runtime/init.hpp"
  41 #include "runtime/interfaceSupport.hpp"
  42 #include "runtime/javaCalls.hpp"
  43 #include "runtime/os.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/sweeper.hpp"
  46 #include "trace/tracing.hpp"
  47 #include "utilities/dtrace.hpp"
  48 #include "utilities/events.hpp"
  49 #ifdef COMPILER1
  50 #include "c1/c1_Compiler.hpp"
  51 #endif
  52 #ifdef COMPILER2
  53 #include "opto/c2compiler.hpp"
  54 #endif
  55 #ifdef SHARK
  56 #include "shark/sharkCompiler.hpp"
  57 #endif
  58 
  59 #ifdef DTRACE_ENABLED
  60 
  61 // Only bother with this argument setup if dtrace is available
  62 
  63 #ifndef USDT2
  64 HS_DTRACE_PROBE_DECL8(hotspot, method__compile__begin,
  65   char*, intptr_t, char*, intptr_t, char*, intptr_t, char*, intptr_t);
  66 HS_DTRACE_PROBE_DECL9(hotspot, method__compile__end,


 163 PerfVariable*       CompileBroker::_perf_last_compile_size = NULL;
 164 PerfVariable*       CompileBroker::_perf_last_failed_type = NULL;
 165 PerfVariable*       CompileBroker::_perf_last_invalidated_type = NULL;
 166 
 167 // Timers and counters for generating statistics
 168 elapsedTimer CompileBroker::_t_total_compilation;
 169 elapsedTimer CompileBroker::_t_osr_compilation;
 170 elapsedTimer CompileBroker::_t_standard_compilation;
 171 
 172 int CompileBroker::_total_bailout_count          = 0;
 173 int CompileBroker::_total_invalidated_count      = 0;
 174 int CompileBroker::_total_compile_count          = 0;
 175 int CompileBroker::_total_osr_compile_count      = 0;
 176 int CompileBroker::_total_standard_compile_count = 0;
 177 
 178 int CompileBroker::_sum_osr_bytes_compiled       = 0;
 179 int CompileBroker::_sum_standard_bytes_compiled  = 0;
 180 int CompileBroker::_sum_nmethod_size             = 0;
 181 int CompileBroker::_sum_nmethod_code_size        = 0;
 182 
 183 long CompileBroker::_peak_compilation_time       = 0;
 184 
 185 CompileQueue* CompileBroker::_c2_method_queue    = NULL;
 186 CompileQueue* CompileBroker::_c1_method_queue    = NULL;
 187 CompileTask*  CompileBroker::_task_free_list     = NULL;
 188 
 189 GrowableArray<CompilerThread*>* CompileBroker::_method_threads = NULL;
 190 
 191 
 192 class CompilationLog : public StringEventLog {
 193  public:
 194   CompilationLog() : StringEventLog("Compilation events") {
 195   }
 196 
 197   void log_compile(JavaThread* thread, CompileTask* task) {
 198     StringLogMessage lm;
 199     stringStream sstr = lm.stream();
 200     // msg.time_stamp().update_to(tty->time_stamp().ticks());
 201     task->print_compilation(&sstr, NULL, true);
 202     log(thread, "%s", (const char*)lm);
 203   }
 204 


1786 
1787     ciEnv ci_env(task, system_dictionary_modification_counter);
1788     if (should_break) {
1789       ci_env.set_break_at_compile(true);
1790     }
1791     if (should_log) {
1792       ci_env.set_log(thread->log());
1793     }
1794     assert(thread->env() == &ci_env, "set by ci_env");
1795     // The thread-env() field is cleared in ~CompileTaskWrapper.
1796 
1797     // Cache Jvmti state
1798     ci_env.cache_jvmti_state();
1799 
1800     // Cache DTrace flags
1801     ci_env.cache_dtrace_flags();
1802 
1803     ciMethod* target = ci_env.get_method_from_handle(target_handle);
1804 
1805     TraceTime t1("compilation", &time);
1806     EventCompilation event;
1807 
1808     AbstractCompiler *comp = compiler(task_level);
1809     if (comp == NULL) {
1810       ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
1811     } else {
1812       comp->compile_method(&ci_env, target, osr_bci);
1813     }
1814 
1815     if (!ci_env.failing() && task->code() == NULL) {
1816       //assert(false, "compiler should always document failure");
1817       // The compiler elected, without comment, not to register a result.
1818       // Do not attempt further compilations of this method.
1819       ci_env.record_method_not_compilable("compile failed", !TieredCompilation);
1820     }
1821 
1822     // Copy this bit to the enclosing block:
1823     compilable = ci_env.compilable();
1824 
1825     if (ci_env.failing()) {
1826       const char* retry_message = ci_env.retry_message();


1828         _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
1829       }
1830       if (PrintCompilation) {
1831         FormatBufferResource msg = retry_message != NULL ?
1832             err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
1833             err_msg_res("COMPILE SKIPPED: %s",      ci_env.failure_reason());
1834         task->print_compilation(tty, msg);
1835       }
1836     } else {
1837       task->mark_success();
1838       task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes());
1839       if (_compilation_log != NULL) {
1840         nmethod* code = task->code();
1841         if (code != NULL) {
1842           _compilation_log->log_nmethod(thread, code);
1843         }
1844       }
1845     }
1846     // simulate crash during compilation
1847     assert(task->compile_id() != CICrashAt, "just as planned");
1848     if (event.should_commit()) {
1849       event.set_method(target->get_Method());
1850       event.set_compileID(compile_id);
1851       event.set_compileLevel(task->comp_level());
1852       event.set_succeded(task->is_success());
1853       event.set_isOsr(is_osr);
1854       event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size());
1855       event.set_inlinedBytes(task->num_inlined_bytecodes());
1856       event.commit();
1857     }
1858   }
1859   pop_jni_handle_block();
1860 
1861   methodHandle method(thread, task->method());
1862 
1863   DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
1864 
1865   collect_statistics(thread, time, task);
1866 
1867   if (PrintCompilation && PrintCompilation2) {
1868     tty->print("%7d ", (int) tty->time_stamp().milliseconds());  // print timestamp
1869     tty->print("%4d ", compile_id);    // print compilation number
1870     tty->print("%s ", (is_osr ? "%" : " "));
1871     if (task->code() != NULL) {
1872       tty->print("size: %d(%d) ", task->code()->total_size(), task->code()->insts_size());
1873     }
1874     tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes());
1875   }
1876 
1877   if (PrintCodeCacheOnCompilation)


1918 // The CodeCache is full.  Print out warning and disable compilation or
1919 // try code cache cleaning so compilation can continue later.
1920 void CompileBroker::handle_full_code_cache() {
1921   UseInterpreter = true;
1922   if (UseCompiler || AlwaysCompileLoopMethods ) {
1923     if (xtty != NULL) {
1924       ResourceMark rm;
1925       stringStream s;
1926       // Dump code cache state into a buffer before locking the tty,
1927       // because log_state() will use locks causing lock conflicts.
1928       CodeCache::log_state(&s);
1929       // Lock to prevent tearing
1930       ttyLocker ttyl;
1931       xtty->begin_elem("code_cache_full");
1932       xtty->print(s.as_string());
1933       xtty->stamp();
1934       xtty->end_elem();
1935     }
1936     warning("CodeCache is full. Compiler has been disabled.");
1937     warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
1938 
1939     CodeCache::report_codemem_full();
1940 
1941 
1942 #ifndef PRODUCT
1943     if (CompileTheWorld || ExitOnFullCodeCache) {
1944       codecache_print(/* detailed= */ true);
1945       before_exit(JavaThread::current());
1946       exit_globals(); // will delete tty
1947       vm_direct_exit(CompileTheWorld ? 0 : 1);
1948     }
1949 #endif
1950     if (UseCodeCacheFlushing) {
1951       NMethodSweeper::handle_full_code_cache(true);
1952     } else {
1953       UseCompiler               = false;
1954       AlwaysCompileLoopMethods  = false;
1955     }
1956   }
1957   codecache_print(/* detailed= */ true);
1958 }
1959 
1960 // ------------------------------------------------------------------
1961 // CompileBroker::set_last_compile


2079     _total_bailout_count++;
2080     if (UsePerfData) {
2081       _perf_last_failed_method->set_value(counters->current_method());
2082       _perf_last_failed_type->set_value(counters->compile_type());
2083       _perf_total_bailout_count->inc();
2084     }
2085   } else if (code == NULL) {
2086     if (UsePerfData) {
2087       _perf_last_invalidated_method->set_value(counters->current_method());
2088       _perf_last_invalidated_type->set_value(counters->compile_type());
2089       _perf_total_invalidated_count->inc();
2090     }
2091     _total_invalidated_count++;
2092   } else {
2093     // Compilation succeeded
2094 
2095     // update compilation ticks - used by the implementation of
2096     // java.lang.management.CompilationMBean
2097     _perf_total_compilation->inc(time.ticks());
2098 

2099     _t_total_compilation.add(time);
2100     _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;
2101 
2102     if (CITime) {
2103       if (is_osr) {
2104         _t_osr_compilation.add(time);
2105         _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
2106       } else {
2107         _t_standard_compilation.add(time);
2108         _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
2109       }
2110     }
2111 
2112     if (UsePerfData) {
2113       // save the name of the last method compiled
2114       _perf_last_method->set_value(counters->current_method());
2115       _perf_last_compile_type->set_value(counters->compile_type());
2116       _perf_last_compile_size->set_value(method->code_size() +
2117                                          task->num_inlined_bytecodes());
2118       if (is_osr) {
2119         _perf_osr_compilation->inc(time.ticks());
2120         _perf_sum_osr_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes());
2121       } else {
2122         _perf_standard_compilation->inc(time.ticks());


2180   }
2181   comp = compiler(CompLevel_full_optimization);
2182   if (comp != NULL) {
2183     comp->print_timers();
2184   }
2185   tty->cr();
2186   tty->print_cr("  Total compiled methods   : %6d methods", CompileBroker::_total_compile_count);
2187   tty->print_cr("    Standard compilation   : %6d methods", CompileBroker::_total_standard_compile_count);
2188   tty->print_cr("    On stack replacement   : %6d methods", CompileBroker::_total_osr_compile_count);
2189   int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled;
2190   tty->print_cr("  Total compiled bytecodes : %6d bytes", tcb);
2191   tty->print_cr("    Standard compilation   : %6d bytes", CompileBroker::_sum_standard_bytes_compiled);
2192   tty->print_cr("    On stack replacement   : %6d bytes", CompileBroker::_sum_osr_bytes_compiled);
2193   int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds());
2194   tty->print_cr("  Average compilation speed: %6d bytes/s", bps);
2195   tty->cr();
2196   tty->print_cr("  nmethod code size        : %6d bytes", CompileBroker::_sum_nmethod_code_size);
2197   tty->print_cr("  nmethod total size       : %6d bytes", CompileBroker::_sum_nmethod_size);
2198 }
2199 

2200 // Debugging output for failure
2201 void CompileBroker::print_last_compile() {
2202   if ( _last_compile_level != CompLevel_none &&
2203        compiler(_last_compile_level) != NULL &&
2204        _last_method_compiled != NULL &&
2205        _last_compile_type != no_compile) {
2206     if (_last_compile_type == osr_compile) {
2207       tty->print_cr("Last parse:  [osr]%d+++(%d) %s",
2208                     _osr_compilation_id, _last_compile_level, _last_method_compiled);
2209     } else {
2210       tty->print_cr("Last parse:  %d+++(%d) %s",
2211                     _compilation_id, _last_compile_level, _last_method_compiled);
2212     }
2213   }
2214 }
2215 
2216 
2217 void CompileBroker::print_compiler_threads_on(outputStream* st) {
2218 #ifndef PRODUCT
2219   st->print_cr("Compiler thread printing unimplemented.");