/* * Copyright (c) 2015, 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.
*/
virtualbool needs_inactive_gc_locker() const { // An inactive GC locker is needed in operations where we change the bad // mask or move objects. Changing the bad mask will invalidate all oops, // which makes it conceptually the same thing as moving all objects. returnfalse;
}
void ZDriver::collect(const ZDriverRequest& request) { switch (request.cause()) { case GCCause::_wb_young_gc: case GCCause::_wb_conc_mark: case GCCause::_wb_full_gc: case GCCause::_dcmd_gc_run: case GCCause::_java_lang_system_gc: case GCCause::_full_gc_alot: case GCCause::_scavenge_alot: case GCCause::_jvmti_force_gc: case GCCause::_metadata_GC_clear_soft_refs: case GCCause::_codecache_GC_aggressive: // Start synchronous GC
_gc_cycle_port.send_sync(request); break;
case GCCause::_z_timer: case GCCause::_z_warmup: case GCCause::_z_allocation_rate: case GCCause::_z_allocation_stall: case GCCause::_z_proactive: case GCCause::_z_high_usage: case GCCause::_codecache_GC_threshold: case GCCause::_metadata_GC_threshold: // Start asynchronous GC
_gc_cycle_port.send_async(request); break;
case GCCause::_gc_locker: // Restart VM operation previously blocked by the GC locker
_gc_locker_port.signal(); break;
case GCCause::_wb_breakpoint:
ZBreakpoint::start_gc();
_gc_cycle_port.send_async(request); break;
default: // Other causes not supported
fatal("Unsupported GC cause (%s)", GCCause::to_string(request.cause())); break;
}
}
template <typename T> bool ZDriver::pause() { for (;;) {
T op;
VMThread::execute(&op); if (op.gc_locked()) { // Wait for GC to become unlocked and restart the VM operation
ZStatTimer timer(ZCriticalPhaseGCLockerStall);
_gc_locker_port.wait(); continue;
}
// Notify VM operation completed
_gc_locker_port.ack();
// Boost number of worker threads if implied by the GC cause if (cause == GCCause::_wb_full_gc ||
cause == GCCause::_java_lang_system_gc ||
cause == GCCause::_metadata_GC_clear_soft_refs ||
cause == GCCause::_z_allocation_stall) { // Boost const uint boosted_nworkers = MAX2(nworkers, ParallelGCThreads); return boosted_nworkers;
}
// Use requested number of worker threads return nworkers;
}
// Update data used by soft reference policy
Universe::heap()->update_capacity_and_used_at_gc();
// Signal that we have completed a visit to all live objects
Universe::heap()->record_whole_heap_examined_timestamp();
}
};
// Macro to execute a termination check after a concurrent phase. Note // that it's important that the termination check comes after the call // to the function f, since we can't abort between pause_relocate_start() // and concurrent_relocate(). We need to let concurrent_relocate() call // abort_page() on the remaining entries in the relocation set. #define concurrent(f) \ do { \
concurrent_##f(); \ if (should_terminate()) { \ return; \
} \
} while (false)
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.