142 name_buffer_length = 100 |
142 name_buffer_length = 100 |
143 }; |
143 }; |
144 |
144 |
145 // Compile type Information for print_last_compile() and CompilerCounters |
145 // Compile type Information for print_last_compile() and CompilerCounters |
146 enum { no_compile, normal_compile, osr_compile, native_compile }; |
146 enum { no_compile, normal_compile, osr_compile, native_compile }; |
147 static int assign_compile_id (methodHandle method, int osr_bci); |
147 static int assign_compile_id (const methodHandle& method, int osr_bci); |
148 |
148 |
149 |
149 |
150 private: |
150 private: |
151 static bool _initialized; |
151 static bool _initialized; |
152 static volatile bool _should_block; |
152 static volatile bool _should_block; |
215 |
215 |
216 static volatile jint _print_compilation_warning; |
216 static volatile jint _print_compilation_warning; |
217 |
217 |
218 static JavaThread* make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, bool compiler_thread, TRAPS); |
218 static JavaThread* make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, bool compiler_thread, TRAPS); |
219 static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count); |
219 static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count); |
220 static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level); |
220 static bool compilation_is_complete (const methodHandle& method, int osr_bci, int comp_level); |
221 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level); |
221 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level); |
222 static bool is_compile_blocking(); |
222 static bool is_compile_blocking(); |
223 static void preload_classes (methodHandle method, TRAPS); |
223 static void preload_classes (const methodHandle& method, TRAPS); |
224 |
224 |
225 static CompileTask* create_compile_task(CompileQueue* queue, |
225 static CompileTask* create_compile_task(CompileQueue* queue, |
226 int compile_id, |
226 int compile_id, |
227 methodHandle method, |
227 const methodHandle& method, |
228 int osr_bci, |
228 int osr_bci, |
229 int comp_level, |
229 int comp_level, |
230 methodHandle hot_method, |
230 const methodHandle& hot_method, |
231 int hot_count, |
231 int hot_count, |
232 const char* comment, |
232 const char* comment, |
233 bool blocking); |
233 bool blocking); |
234 static void wait_for_completion(CompileTask* task); |
234 static void wait_for_completion(CompileTask* task); |
235 |
235 |
236 static void invoke_compiler_on_method(CompileTask* task); |
236 static void invoke_compiler_on_method(CompileTask* task); |
237 static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env); |
237 static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env); |
238 static void set_last_compile(CompilerThread *thread, methodHandle method, bool is_osr, int comp_level); |
238 static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level); |
239 static void push_jni_handle_block(); |
239 static void push_jni_handle_block(); |
240 static void pop_jni_handle_block(); |
240 static void pop_jni_handle_block(); |
241 static bool check_break_at(methodHandle method, int compile_id, bool is_osr); |
241 static bool check_break_at(const methodHandle& method, int compile_id, bool is_osr); |
242 static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task); |
242 static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task); |
243 |
243 |
244 static void compile_method_base(methodHandle method, |
244 static void compile_method_base(const methodHandle& method, |
245 int osr_bci, |
245 int osr_bci, |
246 int comp_level, |
246 int comp_level, |
247 methodHandle hot_method, |
247 const methodHandle& hot_method, |
248 int hot_count, |
248 int hot_count, |
249 const char* comment, |
249 const char* comment, |
250 Thread* thread); |
250 Thread* thread); |
251 |
251 |
252 static CompileQueue* compile_queue(int comp_level); |
252 static CompileQueue* compile_queue(int comp_level); |
263 if (is_c2_compile(comp_level)) return _compilers[1]; // C2 |
263 if (is_c2_compile(comp_level)) return _compilers[1]; // C2 |
264 if (is_c1_compile(comp_level)) return _compilers[0]; // C1 |
264 if (is_c1_compile(comp_level)) return _compilers[0]; // C1 |
265 return NULL; |
265 return NULL; |
266 } |
266 } |
267 |
267 |
268 static bool compilation_is_in_queue(methodHandle method); |
268 static bool compilation_is_in_queue(const methodHandle& method); |
269 static void print_compile_queues(outputStream* st); |
269 static void print_compile_queues(outputStream* st); |
270 static int queue_size(int comp_level) { |
270 static int queue_size(int comp_level) { |
271 CompileQueue *q = compile_queue(comp_level); |
271 CompileQueue *q = compile_queue(comp_level); |
272 return q != NULL ? q->size() : 0; |
272 return q != NULL ? q->size() : 0; |
273 } |
273 } |
274 static void compilation_init(); |
274 static void compilation_init(); |
275 static void init_compiler_thread_log(); |
275 static void init_compiler_thread_log(); |
276 static nmethod* compile_method(methodHandle method, |
276 static nmethod* compile_method(const methodHandle& method, |
277 int osr_bci, |
277 int osr_bci, |
278 int comp_level, |
278 int comp_level, |
279 methodHandle hot_method, |
279 const methodHandle& hot_method, |
280 int hot_count, |
280 int hot_count, |
281 const char* comment, Thread* thread); |
281 const char* comment, Thread* thread); |
282 |
282 |
283 // Acquire any needed locks and assign a compile id |
283 // Acquire any needed locks and assign a compile id |
284 static uint assign_compile_id_unlocked(Thread* thread, methodHandle method, int osr_bci); |
284 static uint assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci); |
285 |
285 |
286 static void compiler_thread_loop(); |
286 static void compiler_thread_loop(); |
287 static uint get_compilation_id() { return _compilation_id; } |
287 static uint get_compilation_id() { return _compilation_id; } |
288 |
288 |
289 // Set _should_block. |
289 // Set _should_block. |