/* * Copyright (c) 1997, 2019, 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. *
*/
// Implementation of StubQueue // // Standard wrap-around queue implementation; the queue dimensions // are specified by the _queue_begin & _queue_end indices. The queue // can be in two states (transparent to the outside): // // a) contiguous state: all queue entries in one block (or empty) // // Queue: |...|XXXXXXX|...............| // ^0 ^begin ^end ^size = limit // |_______| // one block // // b) non-contiguous state: queue entries in two blocks // // Queue: |XXX|.......|XXXXXXX|.......| // ^0 ^end ^begin ^limit ^size // |___| |_______| // 1st block 2nd block // // In the non-contiguous state, the wrap-around point is // indicated via the _buffer_limit index since the last // queue entry may not fill up the queue completely in // which case we need to know where the 2nd block's end // is to do the proper wrap-around. When removing the // last entry of the 2nd block, _buffer_limit is reset // to _buffer_size. // // CAUTION: DO NOT MESS WITH THIS CODE IF YOU CANNOT PROVE // ITS CORRECTNESS! THIS CODE IS MORE SUBTLE THAN IT LOOKS!
StubQueue::~StubQueue() { // Note: Currently StubQueues are never destroyed so nothing needs to be done here. // If we want to implement the destructor, we need to release the BufferBlob // allocated in the constructor (i.e., we need to keep it around or look it // up via CodeCache::find_blob(...).
Unimplemented();
}
void StubQueue::deallocate_unused_tail() {
CodeBlob* blob = CodeCache::find_blob((void*)_stub_buffer);
CodeCache::free_unused_tail(blob, used_space()); // Update the limits to the new, trimmed CodeBlob size
_buffer_size = blob->content_size();
_buffer_limit = blob->content_size();
}
Stub* StubQueue::stub_containing(address pc) const { if (contains(pc)) { for (Stub* s = first(); s != NULL; s = next(s)) { if (stub_contains(s, pc)) return s;
}
} return NULL;
}
Stub* StubQueue::request_committed(int code_size) {
Stub* s = request(code_size); if (s != NULL) commit(code_size); return s;
}
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.