/* * Copyright (c) 2021, 2022, Red Hat, Inc. 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. *
*/
void ShenandoahMark::start_mark() { if (!CodeCache::is_gc_marking_cycle_active()) {
CodeCache::on_gc_marking_cycle_start();
}
}
void ShenandoahMark::end_mark() { // Unlike other GCs, we do not arm the nmethods // when marking terminates.
CodeCache::on_gc_marking_cycle_finish();
}
// TODO: We can clean up this if we figure out how to do templated oop closures that // play nice with specialized_oop_iterators. if (heap->has_forwarded_objects()) { using Closure = ShenandoahMarkUpdateRefsClosure;
Closure cl(q, rp);
mark_loop_work<Closure, CANCELLABLE, STRING_DEDUP>(&cl, ld, w, t, req);
} else { using Closure = ShenandoahMarkRefsClosure;
Closure cl(q, rp);
mark_loop_work<Closure, CANCELLABLE, STRING_DEDUP>(&cl, ld, w, t, req);
}
/* * Process outstanding queues, if any. * * There can be more queues than workers. To deal with the imbalance, we claim * extra queues first. Since marking can push new tasks into the queue associated * with this worker id, we come back to process this queue in the normal loop.
*/
assert(queues->get_reserved() == heap->workers()->active_workers(), "Need to reserve proper number of queues: reserved: %u, active: %u", queues->get_reserved(), heap->workers()->active_workers());
q = queues->claim_next(); while (q != NULL) { if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) { return;
}
for (uint i = 0; i < stride; i++) { if (q->pop(t)) {
do_task<T, STRING_DEDUP>(q, cl, live_data, req, &t);
} else {
assert(q->is_empty(), "Must be empty");
q = queues->claim_next(); break;
}
}
}
q = get_queue(worker_id);
/* * Normal marking loop:
*/ while (true) { if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) { return;
}
while (satb_mq_set.completed_buffers_num() > 0) {
satb_mq_set.apply_closure_to_completed_buffer(&drain_satb);
}
uint work = 0; for (uint i = 0; i < stride; i++) { if (q->pop(t) ||
queues->steal(worker_id, t)) {
do_task<T, STRING_DEDUP>(q, cl, live_data, req, &t);
work++;
} else { break;
}
}
if (work == 0) { // No work encountered in current stride, try to terminate. // Need to leave the STS here otherwise it might block safepoints.
ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers);
ShenandoahTerminatorTerminator tt(heap); if (terminator->offer_termination(&tt)) return;
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.19 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 und die Messung sind noch experimentell.