1 /*
2 * Copyright (c) 1999, 2019, 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 *
211 static elapsedTimer _t_bailedout_compilation;
212
213 static int _total_compile_count;
214 static int _total_bailout_count;
215 static int _total_invalidated_count;
216 static int _total_native_compile_count;
217 static int _total_osr_compile_count;
218 static int _total_standard_compile_count;
219 static int _total_compiler_stopped_count;
220 static int _total_compiler_restarted_count;
221 static int _sum_osr_bytes_compiled;
222 static int _sum_standard_bytes_compiled;
223 static int _sum_nmethod_size;
224 static int _sum_nmethod_code_size;
225 static long _peak_compilation_time;
226
227 static CompilerStatistics _stats_per_level[];
228
229 static volatile int _print_compilation_warning;
230
231 static Handle create_thread_oop(const char* name, TRAPS);
232 static JavaThread* make_thread(jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD);
233 static void init_compiler_sweeper_threads();
234 static void possibly_add_compiler_threads(Thread* THREAD);
235 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
236
237 static CompileTask* create_compile_task(CompileQueue* queue,
238 int compile_id,
239 const methodHandle& method,
240 int osr_bci,
241 int comp_level,
242 const methodHandle& hot_method,
243 int hot_count,
244 CompileTask::CompileReason compile_reason,
245 bool blocking);
246 static void wait_for_completion(CompileTask* task);
247 #if INCLUDE_JVMCI
248 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
249 #endif
250
251 static void invoke_compiler_on_method(CompileTask* task);
252 static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
|
1 /*
2 * Copyright (c) 1999, 2020, 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 *
211 static elapsedTimer _t_bailedout_compilation;
212
213 static int _total_compile_count;
214 static int _total_bailout_count;
215 static int _total_invalidated_count;
216 static int _total_native_compile_count;
217 static int _total_osr_compile_count;
218 static int _total_standard_compile_count;
219 static int _total_compiler_stopped_count;
220 static int _total_compiler_restarted_count;
221 static int _sum_osr_bytes_compiled;
222 static int _sum_standard_bytes_compiled;
223 static int _sum_nmethod_size;
224 static int _sum_nmethod_code_size;
225 static long _peak_compilation_time;
226
227 static CompilerStatistics _stats_per_level[];
228
229 static volatile int _print_compilation_warning;
230
231 enum ThreadType {
232 compiler_t,
233 sweeper_t,
234 deoptimizer_t
235 };
236
237 static Handle create_thread_oop(const char* name, TRAPS);
238 static JavaThread* make_thread(ThreadType type, jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD);
239 static void init_compiler_sweeper_threads();
240 static void possibly_add_compiler_threads(Thread* THREAD);
241 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
242
243 static CompileTask* create_compile_task(CompileQueue* queue,
244 int compile_id,
245 const methodHandle& method,
246 int osr_bci,
247 int comp_level,
248 const methodHandle& hot_method,
249 int hot_count,
250 CompileTask::CompileReason compile_reason,
251 bool blocking);
252 static void wait_for_completion(CompileTask* task);
253 #if INCLUDE_JVMCI
254 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
255 #endif
256
257 static void invoke_compiler_on_method(CompileTask* task);
258 static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
|