Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp
38920 views
/*1* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP25#define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP2627#include "gc_implementation/shared/concurrentGCThread.hpp"2829// The Concurrent Mark GC Thread (could be several in the future).30// This is copied from the Concurrent Mark Sweep GC Thread31// Still under construction.3233class ConcurrentMark;3435class ConcurrentMarkThread: public ConcurrentGCThread {36friend class VMStructs;3738double _vtime_start; // Initial virtual time.39double _vtime_accum; // Accumulated virtual time.4041double _vtime_mark_accum;4243public:44virtual void run();4546private:47ConcurrentMark* _cm;4849enum State {50Idle,51Started,52InProgress53};5455volatile State _state;5657void sleepBeforeNextCycle();5859static SurrogateLockerThread* _slt;6061public:62// Constructor63ConcurrentMarkThread(ConcurrentMark* cm);6465static void makeSurrogateLockerThread(TRAPS);66static SurrogateLockerThread* slt() { return _slt; }6768// Printing69void print_on(outputStream* st) const;70void print() const;7172// Total virtual time so far.73double vtime_accum();74// Marking virtual time so far75double vtime_mark_accum();7677ConcurrentMark* cm() { return _cm; }7879void set_idle() { assert(_state != Started, "must not be starting a new cycle"); _state = Idle; }80bool idle() { return _state == Idle; }81void set_started() { assert(_state == Idle, "cycle in progress"); _state = Started; }82bool started() { return _state == Started; }83void set_in_progress() { assert(_state == Started, "must be starting a cycle"); _state = InProgress; }84bool in_progress() { return _state == InProgress; }8586// Returns true from the moment a marking cycle is87// initiated (during the initial-mark pause when started() is set)88// to the moment when the cycle completes (just after the next89// marking bitmap has been cleared and in_progress() is90// cleared). While during_cycle() is true we will not start another cycle91// so that cycles do not overlap. We cannot use just in_progress()92// as the CM thread might take some time to wake up before noticing93// that started() is set and set in_progress().94bool during_cycle() { return !idle(); }9596// shutdown97void stop();98};99100#endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP101102103