219 assert(ret == true, "relocInfo must exist at this address");
220 assert(iter.addr() == ic_call, "must find ic_call");
221
222 initialize_from_iter(&iter);
223 }
224
225 CompiledIC::CompiledIC(RelocIterator* iter)
226 : _method(iter->code())
227 {
228 _call = _method->call_wrapper_at(iter->addr());
229 address ic_call = _call->instruction_address();
230
231 CompiledMethod* nm = iter->code();
232 assert(ic_call != NULL, "ic_call address must be set");
233 assert(nm != NULL, "must pass compiled method");
234 assert(nm->contains(ic_call), "must be in compiled method");
235
236 initialize_from_iter(iter);
237 }
238
239 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
240 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
241 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
242 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
243
244 address entry;
245 if (call_info->call_kind() == CallInfo::itable_call) {
246 assert(bytecode == Bytecodes::_invokeinterface, "");
247 int itable_index = call_info->itable_index();
248 entry = VtableStubs::find_itable_stub(itable_index);
249 if (entry == NULL) {
250 return false;
251 }
252 #ifdef ASSERT
253 int index = call_info->resolved_method()->itable_index();
254 assert(index == itable_index, "CallInfo pre-computes this");
255 InstanceKlass* k = call_info->resolved_method()->method_holder();
256 assert(k->verify_itable_index(itable_index), "sanity check");
257 #endif //ASSERT
258 CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(),
259 call_info->resolved_klass(), false);
260 holder->claim();
261 InlineCacheBuffer::create_transition_stub(this, holder, entry);
262 } else {
263 assert(call_info->call_kind() == CallInfo::vtable_call, "either itable or vtable");
264 // Can be different than selected_method->vtable_index(), due to package-private etc.
265 int vtable_index = call_info->vtable_index();
266 assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check");
267 entry = VtableStubs::find_vtable_stub(vtable_index);
268 if (entry == NULL) {
269 return false;
270 }
271 InlineCacheBuffer::create_transition_stub(this, NULL, entry);
272 }
273
274 if (TraceICs) {
275 ResourceMark rm;
276 assert(!call_info->selected_method().is_null(), "Unexpected null selected method");
277 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT,
278 p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry));
279 }
280
281 // We can't check this anymore. With lazy deopt we could have already
282 // cleaned this IC entry before we even return. This is possible if
283 // we ran out of space in the inline cache buffer trying to do the
284 // set_next and we safepointed to free up space. This is a benign
285 // race because the IC entry was complete when we safepointed so
286 // cleaning it immediately is harmless.
287 // assert(is_megamorphic(), "sanity check");
288 return true;
289 }
290
|
219 assert(ret == true, "relocInfo must exist at this address");
220 assert(iter.addr() == ic_call, "must find ic_call");
221
222 initialize_from_iter(&iter);
223 }
224
225 CompiledIC::CompiledIC(RelocIterator* iter)
226 : _method(iter->code())
227 {
228 _call = _method->call_wrapper_at(iter->addr());
229 address ic_call = _call->instruction_address();
230
231 CompiledMethod* nm = iter->code();
232 assert(ic_call != NULL, "ic_call address must be set");
233 assert(nm != NULL, "must pass compiled method");
234 assert(nm->contains(ic_call), "must be in compiled method");
235
236 initialize_from_iter(iter);
237 }
238
239 // This function may fail for two reasons: either due to running out of vtable
240 // stubs, or due to running out of IC stubs in an attempted transition to a
241 // transitional state. The needs_ic_stub_refill value will be set if the failure
242 // was due to running out of IC stubs, in which case the caller will refill IC
243 // stubs and retry.
244 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode,
245 bool& needs_ic_stub_refill, TRAPS) {
246 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
247 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
248 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
249
250 address entry;
251 if (call_info->call_kind() == CallInfo::itable_call) {
252 assert(bytecode == Bytecodes::_invokeinterface, "");
253 int itable_index = call_info->itable_index();
254 entry = VtableStubs::find_itable_stub(itable_index);
255 if (entry == NULL) {
256 return false;
257 }
258 #ifdef ASSERT
259 int index = call_info->resolved_method()->itable_index();
260 assert(index == itable_index, "CallInfo pre-computes this");
261 InstanceKlass* k = call_info->resolved_method()->method_holder();
262 assert(k->verify_itable_index(itable_index), "sanity check");
263 #endif //ASSERT
264 CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(),
265 call_info->resolved_klass(), false);
266 holder->claim();
267 if (!InlineCacheBuffer::create_transition_stub(this, holder, entry)) {
268 delete holder;
269 needs_ic_stub_refill = true;
270 return false;
271 }
272 } else {
273 assert(call_info->call_kind() == CallInfo::vtable_call, "either itable or vtable");
274 // Can be different than selected_method->vtable_index(), due to package-private etc.
275 int vtable_index = call_info->vtable_index();
276 assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check");
277 entry = VtableStubs::find_vtable_stub(vtable_index);
278 if (entry == NULL) {
279 return false;
280 }
281 if (!InlineCacheBuffer::create_transition_stub(this, NULL, entry)) {
282 needs_ic_stub_refill = true;
283 return false;
284 }
285 }
286
287 if (TraceICs) {
288 ResourceMark rm;
289 assert(!call_info->selected_method().is_null(), "Unexpected null selected method");
290 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT,
291 p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry));
292 }
293
294 // We can't check this anymore. With lazy deopt we could have already
295 // cleaned this IC entry before we even return. This is possible if
296 // we ran out of space in the inline cache buffer trying to do the
297 // set_next and we safepointed to free up space. This is a benign
298 // race because the IC entry was complete when we safepointed so
299 // cleaning it immediately is harmless.
300 // assert(is_megamorphic(), "sanity check");
301 return true;
302 }
303
|
332 if (!is_optimized()) {
333 // must use unsafe because the destination can be a zombie (and we're cleaning)
334 // and the print_compiled_ic code wants to know if site (in the non-zombie)
335 // is to the interpreter.
336 CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
337 is_call_to_interpreted = (cb != NULL && cb->is_adapter_blob());
338 assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check");
339 } else {
340 // Check if we are calling into our own codeblob (i.e., to a stub)
341 address dest = ic_destination();
342 #ifdef ASSERT
343 {
344 _call->verify_resolve_call(dest);
345 }
346 #endif /* ASSERT */
347 is_call_to_interpreted = _call->is_call_to_interpreted(dest);
348 }
349 return is_call_to_interpreted;
350 }
351
352 void CompiledIC::set_to_clean(bool in_use) {
353 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
354 if (TraceInlineCacheClearing || TraceICs) {
355 tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
356 print();
357 }
358
359 address entry = _call->get_resolve_call_stub(is_optimized());
360
361 // A zombie transition will always be safe, since the metadata has already been set to NULL, so
362 // we only need to patch the destination
363 bool safe_transition = _call->is_safe_for_patching() || !in_use || is_optimized() || CompiledICLocker::is_safe(_method);
364
365 if (safe_transition) {
366 // Kill any leftover stub we might have too
367 clear_ic_stub();
368 if (is_optimized()) {
369 set_ic_destination(entry);
370 } else {
371 set_ic_destination_and_value(entry, (void*)NULL);
372 }
373 } else {
374 // Unsafe transition - create stub.
375 InlineCacheBuffer::create_transition_stub(this, NULL, entry);
376 }
377 // We can't check this anymore. With lazy deopt we could have already
378 // cleaned this IC entry before we even return. This is possible if
379 // we ran out of space in the inline cache buffer trying to do the
380 // set_next and we safepointed to free up space. This is a benign
381 // race because the IC entry was complete when we safepointed so
382 // cleaning it immediately is harmless.
383 // assert(is_clean(), "sanity check");
384 }
385
386 bool CompiledIC::is_clean() const {
387 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
388 bool is_clean = false;
389 address dest = ic_destination();
390 is_clean = dest == _call->get_resolve_call_stub(is_optimized());
391 assert(!is_clean || is_optimized() || cached_value() == NULL, "sanity check");
392 return is_clean;
393 }
394
395 void CompiledIC::set_to_monomorphic(CompiledICInfo& info) {
396 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
397 // Updating a cache to the wrong entry can cause bugs that are very hard
398 // to track down - if cache entry gets invalid - we just clean it. In
399 // this way it is always the same code path that is responsible for
400 // updating and resolving an inline cache
401 //
402 // The above is no longer true. SharedRuntime::fixup_callers_callsite will change optimized
403 // callsites. In addition ic_miss code will update a site to monomorphic if it determines
404 // that an monomorphic call to the interpreter can now be monomorphic to compiled code.
405 //
406 // In both of these cases the only thing being modifed is the jump/call target and these
407 // transitions are mt_safe
408
409 Thread *thread = Thread::current();
410 if (info.to_interpreter() || info.to_aot()) {
411 // Call to interpreter
412 if (info.is_optimized() && is_optimized()) {
413 assert(is_clean(), "unsafe IC path");
414 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
415 // the call analysis (callee structure) specifies that the call is optimized
416 // (either because of CHA or the static target is final)
417 // At code generation time, this call has been emitted as static call
418 // Call via stub
419 assert(info.cached_metadata() != NULL && info.cached_metadata()->is_method(), "sanity check");
420 methodHandle method (thread, (Method*)info.cached_metadata());
421 _call->set_to_interpreted(method, info);
422
423 if (TraceICs) {
424 ResourceMark rm(thread);
425 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to %s: %s",
426 p2i(instruction_address()),
427 (info.to_aot() ? "aot" : "interpreter"),
428 method->print_value_string());
429 }
430 } else {
431 // Call via method-klass-holder
432 InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry());
433 if (TraceICs) {
434 ResourceMark rm(thread);
435 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address()));
436 }
437 }
438 } else {
439 // Call to compiled code
440 bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL);
441 #ifdef ASSERT
442 CodeBlob* cb = CodeCache::find_blob_unsafe(info.entry());
443 assert (cb != NULL && cb->is_compiled(), "must be compiled!");
444 #endif /* ASSERT */
445
446 // This is MT safe if we come from a clean-cache and go through a
447 // non-verified entry point
448 bool safe = SafepointSynchronize::is_at_safepoint() ||
449 (!is_in_transition_state() && (info.is_optimized() || static_bound || is_clean()));
450
451 if (!safe) {
452 InlineCacheBuffer::create_transition_stub(this, info.cached_metadata(), info.entry());
453 } else {
454 if (is_optimized()) {
455 set_ic_destination(info.entry());
456 } else {
457 set_ic_destination_and_value(info.entry(), info.cached_metadata());
458 }
459 }
460
461 if (TraceICs) {
462 ResourceMark rm(thread);
463 assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be");
464 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s",
465 p2i(instruction_address()),
466 ((Klass*)info.cached_metadata())->print_value_string(),
467 (safe) ? "" : "via stub");
468 }
469 }
470 // We can't check this anymore. With lazy deopt we could have already
471 // cleaned this IC entry before we even return. This is possible if
472 // we ran out of space in the inline cache buffer trying to do the
473 // set_next and we safepointed to free up space. This is a benign
474 // race because the IC entry was complete when we safepointed so
475 // cleaning it immediately is harmless.
476 // assert(is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
477 }
478
479
480 // is_optimized: Compiler has generated an optimized call (i.e. fixed, no inline cache)
481 // static_bound: The call can be static bound. If it isn't also optimized, the property
482 // wasn't provable at time of compilation. An optimized call will have any necessary
483 // null check, while a static_bound won't. A static_bound (but not optimized) must
484 // therefore use the unverified entry point.
485 void CompiledIC::compute_monomorphic_entry(const methodHandle& method,
486 Klass* receiver_klass,
487 bool is_optimized,
488 bool static_bound,
489 bool caller_is_nmethod,
490 CompiledICInfo& info,
491 TRAPS) {
492 CompiledMethod* method_code = method->code();
493
494 address entry = NULL;
495 if (method_code != NULL && method_code->is_in_use()) {
|
345 if (!is_optimized()) {
346 // must use unsafe because the destination can be a zombie (and we're cleaning)
347 // and the print_compiled_ic code wants to know if site (in the non-zombie)
348 // is to the interpreter.
349 CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
350 is_call_to_interpreted = (cb != NULL && cb->is_adapter_blob());
351 assert(!is_call_to_interpreted || (is_icholder_call() && cached_icholder() != NULL), "sanity check");
352 } else {
353 // Check if we are calling into our own codeblob (i.e., to a stub)
354 address dest = ic_destination();
355 #ifdef ASSERT
356 {
357 _call->verify_resolve_call(dest);
358 }
359 #endif /* ASSERT */
360 is_call_to_interpreted = _call->is_call_to_interpreted(dest);
361 }
362 return is_call_to_interpreted;
363 }
364
365 bool CompiledIC::set_to_clean(bool in_use) {
366 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
367 if (TraceInlineCacheClearing || TraceICs) {
368 tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
369 print();
370 }
371
372 address entry = _call->get_resolve_call_stub(is_optimized());
373
374 // A zombie transition will always be safe, since the metadata has already been set to NULL, so
375 // we only need to patch the destination
376 bool safe_transition = _call->is_safe_for_patching() || !in_use || is_optimized() || CompiledICLocker::is_safe(_method);
377
378 if (safe_transition) {
379 // Kill any leftover stub we might have too
380 clear_ic_stub();
381 if (is_optimized()) {
382 set_ic_destination(entry);
383 } else {
384 set_ic_destination_and_value(entry, (void*)NULL);
385 }
386 } else {
387 // Unsafe transition - create stub.
388 if (!InlineCacheBuffer::create_transition_stub(this, NULL, entry)) {
389 return false;
390 }
391 }
392 // We can't check this anymore. With lazy deopt we could have already
393 // cleaned this IC entry before we even return. This is possible if
394 // we ran out of space in the inline cache buffer trying to do the
395 // set_next and we safepointed to free up space. This is a benign
396 // race because the IC entry was complete when we safepointed so
397 // cleaning it immediately is harmless.
398 // assert(is_clean(), "sanity check");
399 return true;
400 }
401
402 bool CompiledIC::is_clean() const {
403 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
404 bool is_clean = false;
405 address dest = ic_destination();
406 is_clean = dest == _call->get_resolve_call_stub(is_optimized());
407 assert(!is_clean || is_optimized() || cached_value() == NULL, "sanity check");
408 return is_clean;
409 }
410
411 bool CompiledIC::set_to_monomorphic(CompiledICInfo& info) {
412 assert(CompiledICLocker::is_safe(_method), "mt unsafe call");
413 // Updating a cache to the wrong entry can cause bugs that are very hard
414 // to track down - if cache entry gets invalid - we just clean it. In
415 // this way it is always the same code path that is responsible for
416 // updating and resolving an inline cache
417 //
418 // The above is no longer true. SharedRuntime::fixup_callers_callsite will change optimized
419 // callsites. In addition ic_miss code will update a site to monomorphic if it determines
420 // that an monomorphic call to the interpreter can now be monomorphic to compiled code.
421 //
422 // In both of these cases the only thing being modifed is the jump/call target and these
423 // transitions are mt_safe
424
425 Thread *thread = Thread::current();
426 if (info.to_interpreter() || info.to_aot()) {
427 // Call to interpreter
428 if (info.is_optimized() && is_optimized()) {
429 assert(is_clean(), "unsafe IC path");
430 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
431 // the call analysis (callee structure) specifies that the call is optimized
432 // (either because of CHA or the static target is final)
433 // At code generation time, this call has been emitted as static call
434 // Call via stub
435 assert(info.cached_metadata() != NULL && info.cached_metadata()->is_method(), "sanity check");
436 methodHandle method (thread, (Method*)info.cached_metadata());
437 _call->set_to_interpreted(method, info);
438
439 if (TraceICs) {
440 ResourceMark rm(thread);
441 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to %s: %s",
442 p2i(instruction_address()),
443 (info.to_aot() ? "aot" : "interpreter"),
444 method->print_value_string());
445 }
446 } else {
447 // Call via method-klass-holder
448 CompiledICHolder* holder = info.claim_cached_icholder();
449 if (!InlineCacheBuffer::create_transition_stub(this, holder, info.entry())) {
450 delete holder;
451 return false;
452 }
453 if (TraceICs) {
454 ResourceMark rm(thread);
455 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address()));
456 }
457 }
458 } else {
459 // Call to compiled code
460 bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL);
461 #ifdef ASSERT
462 CodeBlob* cb = CodeCache::find_blob_unsafe(info.entry());
463 assert (cb != NULL && cb->is_compiled(), "must be compiled!");
464 #endif /* ASSERT */
465
466 // This is MT safe if we come from a clean-cache and go through a
467 // non-verified entry point
468 bool safe = SafepointSynchronize::is_at_safepoint() ||
469 (!is_in_transition_state() && (info.is_optimized() || static_bound || is_clean()));
470
471 if (!safe) {
472 if (!InlineCacheBuffer::create_transition_stub(this, info.cached_metadata(), info.entry())) {
473 return false;
474 }
475 } else {
476 if (is_optimized()) {
477 set_ic_destination(info.entry());
478 } else {
479 set_ic_destination_and_value(info.entry(), info.cached_metadata());
480 }
481 }
482
483 if (TraceICs) {
484 ResourceMark rm(thread);
485 assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be");
486 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s",
487 p2i(instruction_address()),
488 ((Klass*)info.cached_metadata())->print_value_string(),
489 (safe) ? "" : "via stub");
490 }
491 }
492 // We can't check this anymore. With lazy deopt we could have already
493 // cleaned this IC entry before we even return. This is possible if
494 // we ran out of space in the inline cache buffer trying to do the
495 // set_next and we safepointed to free up space. This is a benign
496 // race because the IC entry was complete when we safepointed so
497 // cleaning it immediately is harmless.
498 // assert(is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
499 return true;
500 }
501
502
503 // is_optimized: Compiler has generated an optimized call (i.e. fixed, no inline cache)
504 // static_bound: The call can be static bound. If it isn't also optimized, the property
505 // wasn't provable at time of compilation. An optimized call will have any necessary
506 // null check, while a static_bound won't. A static_bound (but not optimized) must
507 // therefore use the unverified entry point.
508 void CompiledIC::compute_monomorphic_entry(const methodHandle& method,
509 Klass* receiver_klass,
510 bool is_optimized,
511 bool static_bound,
512 bool caller_is_nmethod,
513 CompiledICInfo& info,
514 TRAPS) {
515 CompiledMethod* method_code = method->code();
516
517 address entry = NULL;
518 if (method_code != NULL && method_code->is_in_use()) {
|
557
558 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm) {
559 // This call site might have become stale so inspect it carefully.
560 address dest = cm->call_wrapper_at(call_site->addr())->destination();
561 return is_icholder_entry(dest);
562 }
563
564 // Release the CompiledICHolder* associated with this call site is there is one.
565 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm) {
566 assert(cm->is_nmethod(), "must be nmethod");
567 // This call site might have become stale so inspect it carefully.
568 NativeCall* call = nativeCall_at(call_site->addr());
569 if (is_icholder_entry(call->destination())) {
570 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
571 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
572 }
573 }
574
575 // ----------------------------------------------------------------------------
576
577 void CompiledStaticCall::set_to_clean(bool in_use) {
578 // in_use is unused but needed to match template function in CompiledMethod
579 assert(CompiledICLocker::is_safe(instruction_address()), "mt unsafe call");
580 // Reset call site
581 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
582 set_destination_mt_safe(resolve_call_stub());
583
584 // Do not reset stub here: It is too expensive to call find_stub.
585 // Instead, rely on caller (nmethod::clear_inline_caches) to clear
586 // both the call and its stub.
587 }
588
589 bool CompiledStaticCall::is_clean() const {
590 return destination() == resolve_call_stub();
591 }
592
593 bool CompiledStaticCall::is_call_to_compiled() const {
594 return CodeCache::contains(destination());
595 }
596
597 bool CompiledDirectStaticCall::is_call_to_interpreted() const {
598 // It is a call to interpreted, if it calls to a stub. Hence, the destination
599 // must be in the stub part of the nmethod that contains the call
600 CompiledMethod* cm = CodeCache::find_compiled(instruction_address());
601 return cm->stub_contains(destination());
602 }
603
604 bool CompiledDirectStaticCall::is_call_to_far() const {
605 // It is a call to aot method, if it calls to a stub. Hence, the destination
|
580
581 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm) {
582 // This call site might have become stale so inspect it carefully.
583 address dest = cm->call_wrapper_at(call_site->addr())->destination();
584 return is_icholder_entry(dest);
585 }
586
587 // Release the CompiledICHolder* associated with this call site is there is one.
588 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm) {
589 assert(cm->is_nmethod(), "must be nmethod");
590 // This call site might have become stale so inspect it carefully.
591 NativeCall* call = nativeCall_at(call_site->addr());
592 if (is_icholder_entry(call->destination())) {
593 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
594 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
595 }
596 }
597
598 // ----------------------------------------------------------------------------
599
600 bool CompiledStaticCall::set_to_clean(bool in_use) {
601 // in_use is unused but needed to match template function in CompiledMethod
602 assert(CompiledICLocker::is_safe(instruction_address()), "mt unsafe call");
603 // Reset call site
604 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
605 set_destination_mt_safe(resolve_call_stub());
606
607 // Do not reset stub here: It is too expensive to call find_stub.
608 // Instead, rely on caller (nmethod::clear_inline_caches) to clear
609 // both the call and its stub.
610 return true;
611 }
612
613 bool CompiledStaticCall::is_clean() const {
614 return destination() == resolve_call_stub();
615 }
616
617 bool CompiledStaticCall::is_call_to_compiled() const {
618 return CodeCache::contains(destination());
619 }
620
621 bool CompiledDirectStaticCall::is_call_to_interpreted() const {
622 // It is a call to interpreted, if it calls to a stub. Hence, the destination
623 // must be in the stub part of the nmethod that contains the call
624 CompiledMethod* cm = CodeCache::find_compiled(instruction_address());
625 return cm->stub_contains(destination());
626 }
627
628 bool CompiledDirectStaticCall::is_call_to_far() const {
629 // It is a call to aot method, if it calls to a stub. Hence, the destination
|