src/share/vm/compiler/compileBroker.cpp

changeset 4438
9deda4d8e126
parent 4345
30866cd626b0
child 4450
eab4f9ed602c
equal deleted inserted replaced
4437:94fa3c4e7643 4438:9deda4d8e126
1712 #endif 1712 #endif
1713 ThreadInVMfromNative tivfn(JavaThread::current()); 1713 ThreadInVMfromNative tivfn(JavaThread::current());
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 // wrapper for CodeCache::print_summary()
1718 static void codecache_print(bool detailed)
1719 {
1720 ResourceMark rm;
1721 stringStream s;
1722 // Dump code cache into a buffer before locking the tty,
1723 {
1724 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1725 CodeCache::print_summary(&s, detailed);
1726 }
1727 ttyLocker ttyl;
1728 tty->print_cr(s.as_string());
1729 }
1730
1717 // ------------------------------------------------------------------ 1731 // ------------------------------------------------------------------
1718 // CompileBroker::invoke_compiler_on_method 1732 // CompileBroker::invoke_compiler_on_method
1719 // 1733 //
1720 // Compile a method. 1734 // Compile a method.
1721 // 1735 //
1839 tty->print("%s ", (is_osr ? "%" : " ")); 1853 tty->print("%s ", (is_osr ? "%" : " "));
1840 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); 1854 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size();
1841 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); 1855 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes());
1842 } 1856 }
1843 1857
1858 if (PrintCodeCacheOnCompilation)
1859 codecache_print(/* detailed= */ false);
1860
1844 // Disable compilation, if required. 1861 // Disable compilation, if required.
1845 switch (compilable) { 1862 switch (compilable) {
1846 case ciEnv::MethodCompilable_never: 1863 case ciEnv::MethodCompilable_never:
1847 if (is_osr) 1864 if (is_osr)
1848 method->set_not_osr_compilable_quietly(); 1865 method->set_not_osr_compilable_quietly();
1883 // try code cache cleaning so compilation can continue later. 1900 // try code cache cleaning so compilation can continue later.
1884 void CompileBroker::handle_full_code_cache() { 1901 void CompileBroker::handle_full_code_cache() {
1885 UseInterpreter = true; 1902 UseInterpreter = true;
1886 if (UseCompiler || AlwaysCompileLoopMethods ) { 1903 if (UseCompiler || AlwaysCompileLoopMethods ) {
1887 if (xtty != NULL) { 1904 if (xtty != NULL) {
1905 ResourceMark rm;
1888 stringStream s; 1906 stringStream s;
1889 // Dump code cache state into a buffer before locking the tty, 1907 // Dump code cache state into a buffer before locking the tty,
1890 // because log_state() will use locks causing lock conflicts. 1908 // because log_state() will use locks causing lock conflicts.
1891 CodeCache::log_state(&s); 1909 CodeCache::log_state(&s);
1892 // Lock to prevent tearing 1910 // Lock to prevent tearing
1896 xtty->stamp(); 1914 xtty->stamp();
1897 xtty->end_elem(); 1915 xtty->end_elem();
1898 } 1916 }
1899 warning("CodeCache is full. Compiler has been disabled."); 1917 warning("CodeCache is full. Compiler has been disabled.");
1900 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); 1918 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
1901 CodeCache::print_bounds(tty);
1902 #ifndef PRODUCT 1919 #ifndef PRODUCT
1903 if (CompileTheWorld || ExitOnFullCodeCache) { 1920 if (CompileTheWorld || ExitOnFullCodeCache) {
1921 codecache_print(/* detailed= */ true);
1904 before_exit(JavaThread::current()); 1922 before_exit(JavaThread::current());
1905 exit_globals(); // will delete tty 1923 exit_globals(); // will delete tty
1906 vm_direct_exit(CompileTheWorld ? 0 : 1); 1924 vm_direct_exit(CompileTheWorld ? 0 : 1);
1907 } 1925 }
1908 #endif 1926 #endif
1911 } else { 1929 } else {
1912 UseCompiler = false; 1930 UseCompiler = false;
1913 AlwaysCompileLoopMethods = false; 1931 AlwaysCompileLoopMethods = false;
1914 } 1932 }
1915 } 1933 }
1934 codecache_print(/* detailed= */ true);
1916 } 1935 }
1917 1936
1918 // ------------------------------------------------------------------ 1937 // ------------------------------------------------------------------
1919 // CompileBroker::set_last_compile 1938 // CompileBroker::set_last_compile
1920 // 1939 //

mercurial