/* * Copyright (c) 1997, 2022, 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. *
*/
// By default we get a single threaded default reference processor; // generations needing multi-threaded refs processing or discovery override this method. void Generation::ref_processor_init() {
assert(_ref_processor == NULL, "a reference processor already exists");
assert(!_reserved.is_empty(), "empty generation?");
_span_based_discoverer.set_span(_reserved);
_ref_processor = new ReferenceProcessor(&_span_based_discoverer); // a vanilla reference processor
}
size_t Generation::max_contiguous_available() const { // The largest number of contiguous free words in this or any higher generation.
size_t avail = contiguous_available();
size_t old_avail = 0; if (GenCollectedHeap::heap()->is_young_gen(this)) {
old_avail = GenCollectedHeap::heap()->old_gen()->contiguous_available();
} return MAX2(avail, old_avail);
}
// Allocate new object.
HeapWord* result = allocate(obj_size, false); if (result == NULL) { // Promotion of obj into gen failed. Try to expand and allocate.
result = expand_and_allocate(obj_size, false); if (result == NULL) { return NULL;
}
}
// Copy to new location.
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(obj), result, obj_size);
oop new_obj = cast_to_oop<HeapWord*>(result);
// Transform object if it is a stack chunk.
ContinuationGCSupport::transform_stack_chunk(new_obj);
void Generation::prepare_for_compaction(CompactPoint* cp) { // Generic implementation, can be specialized
CompactibleSpace* space = first_compaction_space(); while (space != NULL) {
space->prepare_for_compaction(cp);
space = space->next_compaction_space();
}
}
class AdjustPointersClosure: public SpaceClosure { public: void do_space(Space* sp) {
sp->adjust_pointers();
}
};
void Generation::adjust_pointers() { // Note that this is done over all spaces, not just the compactible // ones.
AdjustPointersClosure blk;
space_iterate(&blk, true);
}
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.