void CompiledIC::set_cached_oop(oop cache) { assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); assert (!is_optimized(), "an optimized virtual call does not have a cached oop"); assert (cache == NULL || cache != badOop, "invalid oop"); if (TraceCompiledIC) { tty->print(" "); print_compiled_ic(); tty->print_cr(" changing oop to " INTPTR_FORMAT, cache); } if (cache == NULL) cache = (oop)Universe::non_oop_word(); *_oop_addr = cache; // fix up the relocations RelocIterator iter = _oops; while (iter.next()) { if (iter.type() == relocInfo::oop_type) { oop_Relocation* r = iter.oop_reloc(); if (r->oop_addr() == _oop_addr) r->fix_oop_relocation(); } } return; }
void CompiledIC::internal_set_ic_destination(address entry_point, bool is_icstub, void* cache, bool is_icholder) { assert(entry_point != NULL, "must set legal entry point"); assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); assert (!is_optimized() || cache == NULL, "an optimized virtual call does not have a cached metadata"); assert (cache == NULL || cache != (Metadata*)badOopVal, "invalid metadata"); assert(!is_icholder || is_icholder_entry(entry_point), "must be"); // Don't use ic_destination for this test since that forwards // through ICBuffer instead of returning the actual current state of // the CompiledIC. if (is_icholder_entry(_ic_call->destination())) { // When patching for the ICStub case the cached value isn't // overwritten until the ICStub copied into the CompiledIC during // the next safepoint. Make sure that the CompiledICHolder* is // marked for release at this point since it won't be identifiable // once the entry point is overwritten. InlineCacheBuffer::queue_for_release((CompiledICHolder*)_value->data()); } if (TraceCompiledIC) { tty->print(" "); print_compiled_ic(); tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point)); if (!is_optimized()) { tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache)); } if (is_icstub) { tty->print(" (icstub)"); } tty->cr(); } { MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag); #ifdef ASSERT CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call); assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); #endif _ic_call->set_destination_mt_safe(entry_point); } if (is_optimized() || is_icstub) { // Optimized call sites don't have a cache value and ICStub call // sites only change the entry point. Changing the value in that // case could lead to MT safety issues. assert(cache == NULL, "must be null"); return; } if (cache == NULL) cache = (void*)Universe::non_oop_word(); _value->set_data((intptr_t)cache); }
void CompiledIC::set_ic_destination(address entry_point) { assert(entry_point != NULL, "must set legal entry point"); assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); if (TraceCompiledIC) { tty->print(" "); print_compiled_ic(); tty->print_cr(" changing destination to " INTPTR_FORMAT, entry_point); } MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); #ifdef ASSERT CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call); assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); #endif _ic_call->set_destination_mt_safe(entry_point); }
void CompiledIC::print() { print_compiled_ic(); tty->cr(); }