/* * Copyright (c) 2017, 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. *
*/
inlinebool G1FullGCMarker::mark_object(oop obj) { if (_collector->is_skip_marking(obj)) { returnfalse;
}
// Try to mark. if (!_bitmap->par_mark(obj)) { // Lost mark race. returnfalse;
}
// Marked by us, preserve if needed. if (_collector->is_compacting(obj)) { // It is not necessary to preserve marks for objects in regions we do not // compact because we do not change their headers (i.e. forward them).
preserved_stack()->push_if_necessary(obj, obj->mark());
}
// Check if deduplicatable string. if (StringDedup::is_enabled() &&
java_lang_String::is_instance(obj) &&
G1StringDedup::is_candidate_from_mark(obj)) {
_string_dedup_requests.add(obj);
}
// Collect live words.
_mark_stats_cache.add_live_words(obj);
returntrue;
}
template <class T> inlinevoid G1FullGCMarker::mark_and_push(T* p) {
T heap_oop = RawAccess<>::oop_load(p); if (!CompressedOops::is_null(heap_oop)) {
oop obj = CompressedOops::decode_not_null(heap_oop); if (mark_object(obj)) {
_oop_stack.push(obj);
assert(_bitmap->is_marked(obj), "Must be marked now - map self");
} else {
assert(_bitmap->is_marked(obj) || _collector->is_skip_marking(obj), "Must be marked by other or object in skip marking region");
}
}
}
void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) { constint len = array->length(); constint beg_index = index;
assert(beg_index < len || len == 0, "index too large");
if (VerifyDuringGC) {
_verify_closure.set_containing_obj(array);
array->oop_iterate_range(&_verify_closure, beg_index, end_index); if (_verify_closure.failures()) {
assert(false, "Failed");
}
}
}
inlinevoid G1FullGCMarker::follow_object(oop obj) {
assert(_bitmap->is_marked(obj), "should be marked"); if (obj->is_objArray()) { // Handle object arrays explicitly to allow them to // be split into chunks if needed.
follow_array((objArrayOop)obj);
} else {
obj->oop_iterate(mark_closure()); if (VerifyDuringGC) { if (obj->is_instanceRef()) { return;
}
_verify_closure.set_containing_obj(obj);
obj->oop_iterate(&_verify_closure); if (_verify_closure.failures()) {
log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
assert(false, "Failed");
}
}
}
}
inlinevoid G1FullGCMarker::publish_and_drain_oop_tasks() {
oop obj; while (_oop_stack.pop_overflow(obj)) { if (!_oop_stack.try_push_to_taskqueue(obj)) {
assert(_bitmap->is_marked(obj), "must be marked");
follow_object(obj);
}
} while (_oop_stack.pop_local(obj)) {
assert(_bitmap->is_marked(obj), "must be marked");
follow_object(obj);
}
}
inlinebool G1FullGCMarker::publish_or_pop_objarray_tasks(ObjArrayTask& task) { // It is desirable to move as much as possible work from the overflow queue to // the shared queue as quickly as possible. while (_objarray_stack.pop_overflow(task)) { if (!_objarray_stack.try_push_to_taskqueue(task)) { returntrue;
}
} returnfalse;
}
// Then process ObjArrays one at a time to avoid marking stack bloat.
ObjArrayTask task; if (publish_or_pop_objarray_tasks(task) ||
_objarray_stack.pop_local(task)) {
follow_array_chunk(objArrayOop(task.obj()), task.index());
}
} while (!is_empty());
}
inlinevoid G1FullGCMarker::follow_klass(Klass* k) {
oop op = k->class_loader_data()->holder_no_keepalive();
mark_and_push(&op);
}
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 und die Messung sind noch experimentell.