Mercurial > hg > truffle
comparison src/share/vm/compiler/compileBroker.cpp @ 7643:3ac7d10a6572
Merge with hsx25/hotspot.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 31 Jan 2013 15:42:25 +0100 |
parents | 140d4d4ab3b9 eab4f9ed602c |
children | 5fc51c1ecdeb |
comparison
equal
deleted
inserted
replaced
7573:17b6a63fe7c2 | 7643:3ac7d10a6572 |
---|---|
1239 // return quickly if possible | 1239 // return quickly if possible |
1240 | 1240 |
1241 // lock, make sure that the compilation | 1241 // lock, make sure that the compilation |
1242 // isn't prohibited in a straightforward way. | 1242 // isn't prohibited in a straightforward way. |
1243 | 1243 |
1244 if (compiler(comp_level) == NULL || compilation_is_prohibited(method, osr_bci, comp_level)) { | 1244 if (compiler(comp_level) == NULL || !compiler(comp_level)->can_compile_method(method) || compilation_is_prohibited(method, osr_bci, comp_level)) { |
1245 return NULL; | 1245 return NULL; |
1246 } | 1246 } |
1247 | 1247 |
1248 if (osr_bci == InvocationEntryBci) { | 1248 if (osr_bci == InvocationEntryBci) { |
1249 // standard compilation | 1249 // standard compilation |
1735 #endif | 1735 #endif |
1736 ThreadInVMfromNative tivfn(JavaThread::current()); | 1736 ThreadInVMfromNative tivfn(JavaThread::current()); |
1737 } | 1737 } |
1738 } | 1738 } |
1739 | 1739 |
1740 // wrapper for CodeCache::print_summary() | |
1741 static void codecache_print(bool detailed) | |
1742 { | |
1743 ResourceMark rm; | |
1744 stringStream s; | |
1745 // Dump code cache into a buffer before locking the tty, | |
1746 { | |
1747 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
1748 CodeCache::print_summary(&s, detailed); | |
1749 } | |
1750 ttyLocker ttyl; | |
1751 tty->print_cr(s.as_string()); | |
1752 } | |
1753 | |
1740 // ------------------------------------------------------------------ | 1754 // ------------------------------------------------------------------ |
1741 // CompileBroker::invoke_compiler_on_method | 1755 // CompileBroker::invoke_compiler_on_method |
1742 // | 1756 // |
1743 // Compile a method. | 1757 // Compile a method. |
1744 // | 1758 // |
1862 tty->print("%s ", (is_osr ? "%" : " ")); | 1876 tty->print("%s ", (is_osr ? "%" : " ")); |
1863 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); | 1877 int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); |
1864 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); | 1878 tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); |
1865 } | 1879 } |
1866 | 1880 |
1881 if (PrintCodeCacheOnCompilation) | |
1882 codecache_print(/* detailed= */ false); | |
1883 | |
1867 // Disable compilation, if required. | 1884 // Disable compilation, if required. |
1868 switch (compilable) { | 1885 switch (compilable) { |
1869 case ciEnv::MethodCompilable_never: | 1886 case ciEnv::MethodCompilable_never: |
1870 if (is_osr) | 1887 if (is_osr) |
1871 method->set_not_osr_compilable_quietly(); | 1888 method->set_not_osr_compilable_quietly(); |
1906 // try code cache cleaning so compilation can continue later. | 1923 // try code cache cleaning so compilation can continue later. |
1907 void CompileBroker::handle_full_code_cache() { | 1924 void CompileBroker::handle_full_code_cache() { |
1908 UseInterpreter = true; | 1925 UseInterpreter = true; |
1909 if (UseCompiler || AlwaysCompileLoopMethods ) { | 1926 if (UseCompiler || AlwaysCompileLoopMethods ) { |
1910 if (xtty != NULL) { | 1927 if (xtty != NULL) { |
1928 ResourceMark rm; | |
1911 stringStream s; | 1929 stringStream s; |
1912 // Dump code cache state into a buffer before locking the tty, | 1930 // Dump code cache state into a buffer before locking the tty, |
1913 // because log_state() will use locks causing lock conflicts. | 1931 // because log_state() will use locks causing lock conflicts. |
1914 CodeCache::log_state(&s); | 1932 CodeCache::log_state(&s); |
1915 // Lock to prevent tearing | 1933 // Lock to prevent tearing |
1919 xtty->stamp(); | 1937 xtty->stamp(); |
1920 xtty->end_elem(); | 1938 xtty->end_elem(); |
1921 } | 1939 } |
1922 warning("CodeCache is full. Compiler has been disabled."); | 1940 warning("CodeCache is full. Compiler has been disabled."); |
1923 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); | 1941 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); |
1924 CodeCache::print_bounds(tty); | |
1925 #ifndef PRODUCT | 1942 #ifndef PRODUCT |
1926 if (CompileTheWorld || ExitOnFullCodeCache) { | 1943 if (CompileTheWorld || ExitOnFullCodeCache) { |
1944 codecache_print(/* detailed= */ true); | |
1927 before_exit(JavaThread::current()); | 1945 before_exit(JavaThread::current()); |
1928 exit_globals(); // will delete tty | 1946 exit_globals(); // will delete tty |
1929 vm_direct_exit(CompileTheWorld ? 0 : 1); | 1947 vm_direct_exit(CompileTheWorld ? 0 : 1); |
1930 } | 1948 } |
1931 #endif | 1949 #endif |
1934 } else { | 1952 } else { |
1935 UseCompiler = false; | 1953 UseCompiler = false; |
1936 AlwaysCompileLoopMethods = false; | 1954 AlwaysCompileLoopMethods = false; |
1937 } | 1955 } |
1938 } | 1956 } |
1957 codecache_print(/* detailed= */ true); | |
1939 } | 1958 } |
1940 | 1959 |
1941 // ------------------------------------------------------------------ | 1960 // ------------------------------------------------------------------ |
1942 // CompileBroker::set_last_compile | 1961 // CompileBroker::set_last_compile |
1943 // | 1962 // |