Path: blob/master/src/hotspot/share/gc/shenandoah/shenandoahBreakpoint.cpp
40957 views
/*1* Copyright (c) 2021, Red Hat, Inc. All rights reserved.2* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "gc/shared/concurrentGCBreakpoints.hpp"27#include "gc/shenandoah/shenandoahBreakpoint.hpp"28#include "runtime/mutexLocker.hpp"29#include "utilities/debug.hpp"3031bool ShenandoahBreakpoint::_start_gc = false;3233void ShenandoahBreakpoint::start_gc() {34MonitorLocker ml(ConcurrentGCBreakpoints::monitor());35assert(ConcurrentGCBreakpoints::is_controlled(), "Invalid state");36assert(!_start_gc, "Invalid state");37_start_gc = true;38ml.notify_all();39}4041void ShenandoahBreakpoint::at_before_gc() {42MonitorLocker ml(ConcurrentGCBreakpoints::monitor(), Mutex::_no_safepoint_check_flag);43while (ConcurrentGCBreakpoints::is_controlled() && !_start_gc) {44ml.wait();45}46_start_gc = false;47ConcurrentGCBreakpoints::notify_idle_to_active();48}4950void ShenandoahBreakpoint::at_after_gc() {51ConcurrentGCBreakpoints::notify_active_to_idle();52}5354void ShenandoahBreakpoint::at_after_marking_started() {55ConcurrentGCBreakpoints::at("AFTER MARKING STARTED");56}5758void ShenandoahBreakpoint::at_before_marking_completed() {59ConcurrentGCBreakpoints::at("BEFORE MARKING COMPLETED");60}6162void ShenandoahBreakpoint::at_after_reference_processing_started() {63ConcurrentGCBreakpoints::at("AFTER CONCURRENT REFERENCE PROCESSING STARTED");64}656667