156
157 // This flag can be used to stop compilation or turn it back on
158 static volatile jint _should_compile_new_jobs;
159
160 // The installed compiler(s)
161 static AbstractCompiler* _compilers[2];
162
163 // The maximum numbers of compiler threads to be determined during startup.
164 static int _c1_count, _c2_count;
165
166 // An array of compiler thread Java objects
167 static jobject *_compiler1_objects, *_compiler2_objects;
168
169 // An array of compiler logs
170 static CompileLog **_compiler1_logs, **_compiler2_logs;
171
172 // These counters are used for assigning id's to each compilation
173 static volatile jint _compilation_id;
174 static volatile jint _osr_compilation_id;
175
176 static CompileQueue* _c2_compile_queue;
177 static CompileQueue* _c1_compile_queue;
178
179 // performance counters
180 static PerfCounter* _perf_total_compilation;
181 static PerfCounter* _perf_native_compilation;
182 static PerfCounter* _perf_osr_compilation;
183 static PerfCounter* _perf_standard_compilation;
184
185 static PerfCounter* _perf_total_bailout_count;
186 static PerfCounter* _perf_total_invalidated_count;
187 static PerfCounter* _perf_total_compile_count;
188 static PerfCounter* _perf_total_native_compile_count;
189 static PerfCounter* _perf_total_osr_compile_count;
190 static PerfCounter* _perf_total_standard_compile_count;
191
192 static PerfCounter* _perf_sum_osr_bytes_compiled;
193 static PerfCounter* _perf_sum_standard_bytes_compiled;
194 static PerfCounter* _perf_sum_nmethod_size;
195 static PerfCounter* _perf_sum_nmethod_code_size;
233 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
234 static void preload_classes (const methodHandle& method, TRAPS);
235
236 static CompileTask* create_compile_task(CompileQueue* queue,
237 int compile_id,
238 const methodHandle& method,
239 int osr_bci,
240 int comp_level,
241 const methodHandle& hot_method,
242 int hot_count,
243 CompileTask::CompileReason compile_reason,
244 bool blocking);
245 static void wait_for_completion(CompileTask* task);
246 #if INCLUDE_JVMCI
247 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
248 #endif
249
250 static void invoke_compiler_on_method(CompileTask* task);
251 static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
252 int compilable, const char* failure_reason);
253 static void update_compile_perf_data(CompilerThread *thread, const methodHandle& method, bool is_osr);
254
255 static void push_jni_handle_block();
256 static void pop_jni_handle_block();
257 static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task);
258
259 static void compile_method_base(const methodHandle& method,
260 int osr_bci,
261 int comp_level,
262 const methodHandle& hot_method,
263 int hot_count,
264 CompileTask::CompileReason compile_reason,
265 bool blocking,
266 Thread* thread);
267
268 static CompileQueue* compile_queue(int comp_level);
269 static bool init_compiler_runtime();
270 static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
271
272 public:
273
274 static DirectivesStack* dirstack();
361 // Ensures that warning is only printed once.
362 static bool should_print_compiler_warning() {
363 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0);
364 return old == 0;
365 }
366 // Return total compilation ticks
367 static jlong total_compilation_ticks() {
368 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
369 }
370
371 // Redefine Classes support
372 static void mark_on_stack();
373
374 #if INCLUDE_JVMCI
375 // Print curent compilation time stats for a given compiler
376 static void print_times(AbstractCompiler* comp);
377 #endif
378
379 // Print a detailed accounting of compilation time
380 static void print_times(bool per_compiler = true, bool aggregate = true);
381
382 // compiler name for debugging
383 static const char* compiler_name(int comp_level);
384
385 // Provide access to compiler thread Java objects
386 static jobject compiler1_object(int idx) {
387 assert(_compiler1_objects != NULL, "must be initialized");
388 assert(idx < _c1_count, "oob");
389 return _compiler1_objects[idx];
390 }
391
392 static jobject compiler2_object(int idx) {
393 assert(_compiler2_objects != NULL, "must be initialized");
394 assert(idx < _c2_count, "oob");
395 return _compiler2_objects[idx];
396 }
397
398 static CompileLog* get_log(CompilerThread* ct);
399
400 static int get_total_compile_count() { return _total_compile_count; }
|
156
157 // This flag can be used to stop compilation or turn it back on
158 static volatile jint _should_compile_new_jobs;
159
160 // The installed compiler(s)
161 static AbstractCompiler* _compilers[2];
162
163 // The maximum numbers of compiler threads to be determined during startup.
164 static int _c1_count, _c2_count;
165
166 // An array of compiler thread Java objects
167 static jobject *_compiler1_objects, *_compiler2_objects;
168
169 // An array of compiler logs
170 static CompileLog **_compiler1_logs, **_compiler2_logs;
171
172 // These counters are used for assigning id's to each compilation
173 static volatile jint _compilation_id;
174 static volatile jint _osr_compilation_id;
175
176 static int _last_compile_type;
177 static int _last_compile_level;
178 static char _last_method_compiled[name_buffer_length];
179
180 static CompileQueue* _c2_compile_queue;
181 static CompileQueue* _c1_compile_queue;
182
183 // performance counters
184 static PerfCounter* _perf_total_compilation;
185 static PerfCounter* _perf_native_compilation;
186 static PerfCounter* _perf_osr_compilation;
187 static PerfCounter* _perf_standard_compilation;
188
189 static PerfCounter* _perf_total_bailout_count;
190 static PerfCounter* _perf_total_invalidated_count;
191 static PerfCounter* _perf_total_compile_count;
192 static PerfCounter* _perf_total_native_compile_count;
193 static PerfCounter* _perf_total_osr_compile_count;
194 static PerfCounter* _perf_total_standard_compile_count;
195
196 static PerfCounter* _perf_sum_osr_bytes_compiled;
197 static PerfCounter* _perf_sum_standard_bytes_compiled;
198 static PerfCounter* _perf_sum_nmethod_size;
199 static PerfCounter* _perf_sum_nmethod_code_size;
237 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
238 static void preload_classes (const methodHandle& method, TRAPS);
239
240 static CompileTask* create_compile_task(CompileQueue* queue,
241 int compile_id,
242 const methodHandle& method,
243 int osr_bci,
244 int comp_level,
245 const methodHandle& hot_method,
246 int hot_count,
247 CompileTask::CompileReason compile_reason,
248 bool blocking);
249 static void wait_for_completion(CompileTask* task);
250 #if INCLUDE_JVMCI
251 static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
252 #endif
253
254 static void invoke_compiler_on_method(CompileTask* task);
255 static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
256 int compilable, const char* failure_reason);
257 static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level);
258 static void push_jni_handle_block();
259 static void pop_jni_handle_block();
260 static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task);
261
262 static void compile_method_base(const methodHandle& method,
263 int osr_bci,
264 int comp_level,
265 const methodHandle& hot_method,
266 int hot_count,
267 CompileTask::CompileReason compile_reason,
268 bool blocking,
269 Thread* thread);
270
271 static CompileQueue* compile_queue(int comp_level);
272 static bool init_compiler_runtime();
273 static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
274
275 public:
276
277 static DirectivesStack* dirstack();
364 // Ensures that warning is only printed once.
365 static bool should_print_compiler_warning() {
366 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0);
367 return old == 0;
368 }
369 // Return total compilation ticks
370 static jlong total_compilation_ticks() {
371 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
372 }
373
374 // Redefine Classes support
375 static void mark_on_stack();
376
377 #if INCLUDE_JVMCI
378 // Print curent compilation time stats for a given compiler
379 static void print_times(AbstractCompiler* comp);
380 #endif
381
382 // Print a detailed accounting of compilation time
383 static void print_times(bool per_compiler = true, bool aggregate = true);
384
385 // Debugging output for failure
386 static void print_last_compile();
387
388 // compiler name for debugging
389 static const char* compiler_name(int comp_level);
390
391 // Provide access to compiler thread Java objects
392 static jobject compiler1_object(int idx) {
393 assert(_compiler1_objects != NULL, "must be initialized");
394 assert(idx < _c1_count, "oob");
395 return _compiler1_objects[idx];
396 }
397
398 static jobject compiler2_object(int idx) {
399 assert(_compiler2_objects != NULL, "must be initialized");
400 assert(idx < _c2_count, "oob");
401 return _compiler2_objects[idx];
402 }
403
404 static CompileLog* get_log(CompilerThread* ct);
405
406 static int get_total_compile_count() { return _total_compile_count; }
|