/* * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
ICRefillVerifier::~ICRefillVerifier() {
assert(!_refill_requested || _refill_remembered, "Forgot to refill IC stubs after failed IC transition");
Thread::current()->set_missed_ic_stub_refill_verifier(NULL);
}
void ICStub::set_stub(CompiledIC *ic, void* cached_val, address dest_addr) { // We cannot store a pointer to the 'ic' object, since it is resource allocated. Instead we // store the location of the inline cache. Then we have enough information recreate the CompiledIC // object when we need to remove the stub.
_ic_site = ic->instruction_address();
void InlineCacheBuffer::refill_ic_stubs() { #ifdef ASSERT
ICRefillVerifier* verifier = current_ic_refill_verifier();
verifier->request_remembered(); #endif // we ran out of inline cache buffer space; must enter safepoint. // We do this by forcing a safepoint
VM_ICBufferFull ibf;
VMThread::execute(&ibf);
}
void InlineCacheBuffer::update_inline_caches() { if (buffer()->number_of_stubs() > 0) { if (TraceICBuffer) {
tty->print_cr("[updating inline caches with %d stubs]", buffer()->number_of_stubs());
}
buffer()->remove_all();
}
release_pending_icholders();
}
bool InlineCacheBuffer::create_transition_stub(CompiledIC *ic, void* cached_value, address entry) {
assert(!SafepointSynchronize::is_at_safepoint(), "should not be called during a safepoint");
assert(CompiledICLocker::is_safe(ic->instruction_address()), "mt unsafe call"); if (TraceICBuffer) {
tty->print_cr(" create transition stub for " INTPTR_FORMAT " destination " INTPTR_FORMAT " cached value " INTPTR_FORMAT,
p2i(ic->instruction_address()), p2i(entry), p2i(cached_value));
}
// allocate and initialize new "out-of-line" inline-cache
ICStub* ic_stub = new_ic_stub(); if (ic_stub == NULL) { #ifdef ASSERT
ICRefillVerifier* verifier = current_ic_refill_verifier();
verifier->request_refill(); #endif returnfalse;
}
// If an transition stub is already associate with the inline cache, then we remove the association. if (ic->is_in_transition_state()) {
ICStub* old_stub = ICStub_from_destination_address(ic->stub_address());
old_stub->clear();
}
ic_stub->set_stub(ic, cached_value, entry);
// Update inline cache in nmethod to point to new "out-of-line" allocated inline cache
ic->set_ic_destination(ic_stub); returntrue;
}
// Free CompiledICHolder*s that are no longer in use void InlineCacheBuffer::release_pending_icholders() {
assert(SafepointSynchronize::is_at_safepoint(), "should only be called during a safepoint");
CompiledICHolder* holder = _pending_released;
_pending_released = NULL; while (holder != NULL) {
CompiledICHolder* next = holder->next(); delete holder;
holder = next;
_pending_count--;
}
assert(_pending_count == 0, "wrong count");
}
// Enqueue this icholder for release during the next safepoint. It's // not safe to free them until them since they might be visible to // another thread. void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
MutexLocker mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
icholder->set_next(_pending_released);
_pending_released = icholder;
_pending_count++; if (TraceICBuffer) {
tty->print_cr("enqueueing icholder " INTPTR_FORMAT " to be freed", p2i(icholder));
}
}
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.