267 methodHandle hot_method, |
267 methodHandle hot_method, |
268 int hot_count, |
268 int hot_count, |
269 const char* comment, |
269 const char* comment, |
270 bool is_blocking) { |
270 bool is_blocking) { |
271 assert(!_lock->is_locked(), "bad locking"); |
271 assert(!_lock->is_locked(), "bad locking"); |
|
272 InstanceKlass* holder = method->method_holder(); |
272 |
273 |
273 _compile_id = compile_id; |
274 _compile_id = compile_id; |
274 _method = method(); |
275 _method = method(); |
275 _method_loader = JNIHandles::make_global(_method->method_holder()->class_loader()); |
276 _method_holder = JNIHandles::make_global( |
|
277 holder->is_anonymous() ? holder->java_mirror(): holder->class_loader()); |
276 _osr_bci = osr_bci; |
278 _osr_bci = osr_bci; |
277 _is_blocking = is_blocking; |
279 _is_blocking = is_blocking; |
278 _comp_level = comp_level; |
280 _comp_level = comp_level; |
279 _num_inlined_bytecodes = 0; |
281 _num_inlined_bytecodes = 0; |
280 |
282 |
281 _is_complete = false; |
283 _is_complete = false; |
282 _is_success = false; |
284 _is_success = false; |
283 _code_handle = NULL; |
285 _code_handle = NULL; |
284 |
286 |
285 _hot_method = NULL; |
287 _hot_method = NULL; |
286 _hot_method_loader = NULL; |
288 _hot_method_holder = NULL; |
287 _hot_count = hot_count; |
289 _hot_count = hot_count; |
288 _time_queued = 0; // tidy |
290 _time_queued = 0; // tidy |
289 _comment = comment; |
291 _comment = comment; |
290 |
292 |
291 if (LogCompilation) { |
293 if (LogCompilation) { |
293 if (hot_method.not_null()) { |
295 if (hot_method.not_null()) { |
294 if (hot_method == method) { |
296 if (hot_method == method) { |
295 _hot_method = _method; |
297 _hot_method = _method; |
296 } else { |
298 } else { |
297 _hot_method = hot_method(); |
299 _hot_method = hot_method(); |
|
300 // only add loader or mirror if different from _method_holder |
|
301 InstanceKlass* hot_holder = hot_method->method_holder(); |
|
302 _hot_method_holder = JNIHandles::make_global( |
|
303 hot_holder->is_anonymous() ? hot_holder->java_mirror() : |
|
304 hot_holder->class_loader()); |
298 } |
305 } |
299 _hot_method_loader = JNIHandles::make_global(_hot_method->method_holder()->class_loader()); |
|
300 } |
306 } |
301 } |
307 } |
302 |
308 |
303 _next = NULL; |
309 _next = NULL; |
304 } |
310 } |
319 // ------------------------------------------------------------------ |
325 // ------------------------------------------------------------------ |
320 // CompileTask::free |
326 // CompileTask::free |
321 void CompileTask::free() { |
327 void CompileTask::free() { |
322 set_code(NULL); |
328 set_code(NULL); |
323 assert(!_lock->is_locked(), "Should not be locked when freed"); |
329 assert(!_lock->is_locked(), "Should not be locked when freed"); |
324 JNIHandles::destroy_global(_method_loader); |
330 JNIHandles::destroy_global(_method_holder); |
325 JNIHandles::destroy_global(_hot_method_loader); |
331 JNIHandles::destroy_global(_hot_method_holder); |
326 } |
332 } |
327 |
333 |
328 |
334 |
329 void CompileTask::mark_on_stack() { |
335 void CompileTask::mark_on_stack() { |
330 // Mark these methods as something redefine classes cannot remove. |
336 // Mark these methods as something redefine classes cannot remove. |