Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/compileBroker.cpp @ 10405:f2110083203d
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>
author | sla |
---|---|
date | Mon, 10 Jun 2013 11:30:51 +0200 |
parents | 813f26e34135 |
children | 836a62f43af9 766fac3395d6 b5c8a61d7fa0 |
comparison
equal
deleted
inserted
replaced
10404:d0add7016434 | 10405:f2110083203d |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. | 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. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
41 #include "runtime/interfaceSupport.hpp" | 41 #include "runtime/interfaceSupport.hpp" |
42 #include "runtime/javaCalls.hpp" | 42 #include "runtime/javaCalls.hpp" |
43 #include "runtime/os.hpp" | 43 #include "runtime/os.hpp" |
44 #include "runtime/sharedRuntime.hpp" | 44 #include "runtime/sharedRuntime.hpp" |
45 #include "runtime/sweeper.hpp" | 45 #include "runtime/sweeper.hpp" |
46 #include "trace/tracing.hpp" | |
46 #include "utilities/dtrace.hpp" | 47 #include "utilities/dtrace.hpp" |
47 #include "utilities/events.hpp" | 48 #include "utilities/events.hpp" |
48 #ifdef COMPILER1 | 49 #ifdef COMPILER1 |
49 #include "c1/c1_Compiler.hpp" | 50 #include "c1/c1_Compiler.hpp" |
50 #endif | 51 #endif |
177 int CompileBroker::_sum_osr_bytes_compiled = 0; | 178 int CompileBroker::_sum_osr_bytes_compiled = 0; |
178 int CompileBroker::_sum_standard_bytes_compiled = 0; | 179 int CompileBroker::_sum_standard_bytes_compiled = 0; |
179 int CompileBroker::_sum_nmethod_size = 0; | 180 int CompileBroker::_sum_nmethod_size = 0; |
180 int CompileBroker::_sum_nmethod_code_size = 0; | 181 int CompileBroker::_sum_nmethod_code_size = 0; |
181 | 182 |
182 CompileQueue* CompileBroker::_c2_method_queue = NULL; | 183 long CompileBroker::_peak_compilation_time = 0; |
183 CompileQueue* CompileBroker::_c1_method_queue = NULL; | 184 |
184 CompileTask* CompileBroker::_task_free_list = NULL; | 185 CompileQueue* CompileBroker::_c2_method_queue = NULL; |
186 CompileQueue* CompileBroker::_c1_method_queue = NULL; | |
187 CompileTask* CompileBroker::_task_free_list = NULL; | |
185 | 188 |
186 GrowableArray<CompilerThread*>* CompileBroker::_method_threads = NULL; | 189 GrowableArray<CompilerThread*>* CompileBroker::_method_threads = NULL; |
187 | 190 |
188 | 191 |
189 class CompilationLog : public StringEventLog { | 192 class CompilationLog : public StringEventLog { |
1793 ci_env.cache_dtrace_flags(); | 1796 ci_env.cache_dtrace_flags(); |
1794 | 1797 |
1795 ciMethod* target = ci_env.get_method_from_handle(target_handle); | 1798 ciMethod* target = ci_env.get_method_from_handle(target_handle); |
1796 | 1799 |
1797 TraceTime t1("compilation", &time); | 1800 TraceTime t1("compilation", &time); |
1801 EventCompilation event; | |
1798 | 1802 |
1799 AbstractCompiler *comp = compiler(task_level); | 1803 AbstractCompiler *comp = compiler(task_level); |
1800 if (comp == NULL) { | 1804 if (comp == NULL) { |
1801 ci_env.record_method_not_compilable("no compiler", !TieredCompilation); | 1805 ci_env.record_method_not_compilable("no compiler", !TieredCompilation); |
1802 } else { | 1806 } else { |
1834 } | 1838 } |
1835 } | 1839 } |
1836 } | 1840 } |
1837 // simulate crash during compilation | 1841 // simulate crash during compilation |
1838 assert(task->compile_id() != CICrashAt, "just as planned"); | 1842 assert(task->compile_id() != CICrashAt, "just as planned"); |
1843 if (event.should_commit()) { | |
1844 event.set_method(target->get_Method()); | |
1845 event.set_compileID(compile_id); | |
1846 event.set_compileLevel(task->comp_level()); | |
1847 event.set_succeded(task->is_success()); | |
1848 event.set_isOsr(is_osr); | |
1849 event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size()); | |
1850 event.set_inlinedBytes(task->num_inlined_bytecodes()); | |
1851 event.commit(); | |
1852 } | |
1839 } | 1853 } |
1840 pop_jni_handle_block(); | 1854 pop_jni_handle_block(); |
1841 | 1855 |
1842 methodHandle method(thread, task->method()); | 1856 methodHandle method(thread, task->method()); |
1843 | 1857 |
1914 xtty->stamp(); | 1928 xtty->stamp(); |
1915 xtty->end_elem(); | 1929 xtty->end_elem(); |
1916 } | 1930 } |
1917 warning("CodeCache is full. Compiler has been disabled."); | 1931 warning("CodeCache is full. Compiler has been disabled."); |
1918 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); | 1932 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); |
1933 | |
1934 CodeCache::report_codemem_full(); | |
1935 | |
1936 | |
1919 #ifndef PRODUCT | 1937 #ifndef PRODUCT |
1920 if (CompileTheWorld || ExitOnFullCodeCache) { | 1938 if (CompileTheWorld || ExitOnFullCodeCache) { |
1921 codecache_print(/* detailed= */ true); | 1939 codecache_print(/* detailed= */ true); |
1922 before_exit(JavaThread::current()); | 1940 before_exit(JavaThread::current()); |
1923 exit_globals(); // will delete tty | 1941 exit_globals(); // will delete tty |
2071 | 2089 |
2072 // update compilation ticks - used by the implementation of | 2090 // update compilation ticks - used by the implementation of |
2073 // java.lang.management.CompilationMBean | 2091 // java.lang.management.CompilationMBean |
2074 _perf_total_compilation->inc(time.ticks()); | 2092 _perf_total_compilation->inc(time.ticks()); |
2075 | 2093 |
2094 _t_total_compilation.add(time); | |
2095 _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; | |
2096 | |
2076 if (CITime) { | 2097 if (CITime) { |
2077 _t_total_compilation.add(time); | |
2078 if (is_osr) { | 2098 if (is_osr) { |
2079 _t_osr_compilation.add(time); | 2099 _t_osr_compilation.add(time); |
2080 _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | 2100 _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); |
2081 } else { | 2101 } else { |
2082 _t_standard_compilation.add(time); | 2102 _t_standard_compilation.add(time); |
2170 tty->cr(); | 2190 tty->cr(); |
2171 tty->print_cr(" nmethod code size : %6d bytes", CompileBroker::_sum_nmethod_code_size); | 2191 tty->print_cr(" nmethod code size : %6d bytes", CompileBroker::_sum_nmethod_code_size); |
2172 tty->print_cr(" nmethod total size : %6d bytes", CompileBroker::_sum_nmethod_size); | 2192 tty->print_cr(" nmethod total size : %6d bytes", CompileBroker::_sum_nmethod_size); |
2173 } | 2193 } |
2174 | 2194 |
2175 | |
2176 // Debugging output for failure | 2195 // Debugging output for failure |
2177 void CompileBroker::print_last_compile() { | 2196 void CompileBroker::print_last_compile() { |
2178 if ( _last_compile_level != CompLevel_none && | 2197 if ( _last_compile_level != CompLevel_none && |
2179 compiler(_last_compile_level) != NULL && | 2198 compiler(_last_compile_level) != NULL && |
2180 _last_method_compiled != NULL && | 2199 _last_method_compiled != NULL && |