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 *
209 static elapsedTimer _t_standard_compilation;
210 static elapsedTimer _t_invalidated_compilation;
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 volatile int _print_compilation_warning;
228
229 static Handle create_thread_oop(const char* name, TRAPS);
230 static JavaThread* make_thread(jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD);
231 static void init_compiler_sweeper_threads();
232 static void possibly_add_compiler_threads(Thread* THREAD);
233 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
234
235 static CompileTask* create_compile_task(CompileQueue* queue,
236 int compile_id,
237 const methodHandle& method,
238 int osr_bci,
239 int comp_level,
240 const methodHandle& hot_method,
241 int hot_count,
242 CompileTask::CompileReason compile_reason,
243 bool blocking);
244 static void wait_for_completion(CompileTask* task);
245 #if INCLUDE_JVMCI
246 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
247 #endif
248
249 static void invoke_compiler_on_method(CompileTask* task);
250 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 *
209 static elapsedTimer _t_standard_compilation;
210 static elapsedTimer _t_invalidated_compilation;
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 volatile int _print_compilation_warning;
228
229 enum ThreadType {
230 compiler_t,
231 sweeper_t,
232 deoptimizer_t
233 };
234
235 static Handle create_thread_oop(const char* name, TRAPS);
236 static JavaThread* make_thread(ThreadType type, jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD);
237 static void init_compiler_sweeper_threads();
238 static void possibly_add_compiler_threads(Thread* THREAD);
239 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
240
241 static CompileTask* create_compile_task(CompileQueue* queue,
242 int compile_id,
243 const methodHandle& method,
244 int osr_bci,
245 int comp_level,
246 const methodHandle& hot_method,
247 int hot_count,
248 CompileTask::CompileReason compile_reason,
249 bool blocking);
250 static void wait_for_completion(CompileTask* task);
251 #if INCLUDE_JVMCI
252 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
253 #endif
254
255 static void invoke_compiler_on_method(CompileTask* task);
256 static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
|