/* * Copyright (c) 2002, 2018, 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. *
*/
// This is the shared initialization code. It sets up the basic pointers, // and allows enough extra space for a filler object. We call a virtual // method, "lab_is_valid()" to handle the different asserts the old/young // labs require. void PSPromotionLAB::initialize(MemRegion lab) {
assert(lab_is_valid(lab), "Sanity");
HeapWord* bottom = lab.start();
HeapWord* end = lab.end();
// We can be initialized to a zero size! if (free() > 0) { if (ZapUnusedHeapArea) {
debug_only(Copy::fill_to_words(top(), free()/HeapWordSize, badHeapWord));
}
// NOTE! We need to allow space for a filler object.
assert(lab.word_size() >= CollectedHeap::min_dummy_object_size(), "lab is too small");
end = end - CollectedHeap::min_dummy_object_size();
set_end(end);
assert(this->top() <= this->end(), "pointers out of order");
}
// Fill all remaining lab space with an unreachable object. // The goal is to leave a contiguous parseable span of objects. void PSPromotionLAB::flush() {
assert(_state != flushed, "Attempt to flush PLAB twice");
assert(top() <= end(), "pointers out of order");
// If we were initialized to a zero sized lab, there is // nothing to flush if (_state == zero_size) return;
// PLAB's never allocate the last aligned_header_size // so they can always fill with an array.
HeapWord* tlab_end = end() + CollectedHeap::min_dummy_object_size();
CollectedHeap::fill_with_object(top(), tlab_end, trueInDebug);
// If the object is inside this LAB, we just bump-down the `top` pointer. // Otherwise, we overwrite it with a filler object. if (contains(obj)) {
HeapWord* object_end = obj + obj_size;
assert(object_end == top(), "Not matching last allocation");
// Fill all remaining lab space with an unreachable object. // The goal is to leave a contiguous parseable span of objects. void PSOldPromotionLAB::flush() {
assert(_state != flushed, "Attempt to flush PLAB twice");
assert(top() <= end(), "pointers out of order");
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.