void opt_virtual_call_Relocation::clear_inline_cache() { #ifndef CORE // No stubs for ICs // Clean IC ResourceMark rm; CompiledIC* icache = CompiledIC_at(this); icache->set_to_clean(); #endif // !CORE }
void ICStub::finalize() { if (!is_empty()) { ResourceMark rm; CompiledIC *ic = CompiledIC_at(CodeCache::find_nmethod(ic_site()), ic_site()); assert(CodeCache::find_nmethod(ic->instruction_address()) != NULL, "inline cache in non-nmethod?"); assert(this == ICStub_from_destination_address(ic->stub_address()), "wrong owner of ic buffer"); ic->set_ic_destination_and_value(destination(), cached_value()); } }
void AOTCompiledMethod::clear_inline_caches() { assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint"); if (is_zombie()) { return; } RelocIterator iter(this); while (iter.next()) { iter.reloc()->clear_inline_cache(); if (iter.type() == relocInfo::opt_virtual_call_type) { CompiledIC* cic = CompiledIC_at(&iter); assert(cic->is_clean(), "!"); nativePltCall_at(iter.addr())->set_stub_to_clean(); } } }
// Iterate over metadata calling this function. Used by RedefineClasses // Copied from nmethod::metadata_do void AOTCompiledMethod::metadata_do(void f(Metadata*)) { address low_boundary = verified_entry_point(); { // Visit all immediate references that are embedded in the instruction stream. RelocIterator iter(this, low_boundary); while (iter.next()) { if (iter.type() == relocInfo::metadata_type ) { metadata_Relocation* r = iter.metadata_reloc(); // In this metadata, we must only follow those metadatas directly embedded in // the code. Other metadatas (oop_index>0) are seen as part of // the metadata section below. assert(1 == (r->metadata_is_immediate()) + (r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()), "metadata must be found in exactly one place"); if (r->metadata_is_immediate() && r->metadata_value() != NULL) { Metadata* md = r->metadata_value(); if (md != _method) f(md); } } else if (iter.type() == relocInfo::virtual_call_type) { // Check compiledIC holders associated with this nmethod CompiledIC *ic = CompiledIC_at(&iter); if (ic->is_icholder_call()) { CompiledICHolder* cichk = ic->cached_icholder(); f(cichk->holder_method()); f(cichk->holder_klass()); } else { // Get Klass* or NULL (if value is -1) from GOT cell of virtual call PLT stub. Metadata* ic_oop = ic->cached_metadata(); if (ic_oop != NULL) { f(ic_oop); } } } else if (iter.type() == relocInfo::static_call_type || iter.type() == relocInfo::opt_virtual_call_type){ // Check Method* in AOT c2i stub for other calls. Metadata* meta = (Metadata*)nativeLoadGot_at(nativePltCall_at(iter.addr())->plt_c2i_stub())->data(); if (meta != NULL) { f(meta); } } } } // Visit the metadata section for (Metadata** p = metadata_begin(); p < metadata_end(); p++) { Metadata* m = *p; intptr_t meta = (intptr_t)m; if ((meta & 1) == 1) { // already resolved m = (Metadata*)(meta & ~1); } else { continue; } assert(Metaspace::contains(m), ""); f(m); } // Visit metadata not embedded in the other places. if (_method != NULL) f(_method); }