annotate src/hotspot/share/gc/g1/g1ConcurrentMarkThread.hpp @ 54526:ee29b516a36a

revert changes
author jlaskey
date Wed, 23 Jan 2019 16:09:20 -0400
parents 8263950638ed
children 82c95d4b61f0
rev   line source
lkorinth@50154 1 /*
coleenp@54304 2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
lkorinth@50154 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
lkorinth@50154 4 *
lkorinth@50154 5 * This code is free software; you can redistribute it and/or modify it
lkorinth@50154 6 * under the terms of the GNU General Public License version 2 only, as
lkorinth@50154 7 * published by the Free Software Foundation.
lkorinth@50154 8 *
lkorinth@50154 9 * This code is distributed in the hope that it will be useful, but WITHOUT
lkorinth@50154 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
lkorinth@50154 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lkorinth@50154 12 * version 2 for more details (a copy is included in the LICENSE file that
lkorinth@50154 13 * accompanied this code).
lkorinth@50154 14 *
lkorinth@50154 15 * You should have received a copy of the GNU General Public License version
lkorinth@50154 16 * 2 along with this work; if not, write to the Free Software Foundation,
lkorinth@50154 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
lkorinth@50154 18 *
lkorinth@50154 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
lkorinth@50154 20 * or visit www.oracle.com if you need additional information or have any
lkorinth@50154 21 * questions.
lkorinth@50154 22 *
lkorinth@50154 23 */
lkorinth@50154 24
coleenp@54304 25 #ifndef SHARE_GC_G1_G1CONCURRENTMARKTHREAD_HPP
coleenp@54304 26 #define SHARE_GC_G1_G1CONCURRENTMARKTHREAD_HPP
lkorinth@50154 27
lkorinth@50154 28 #include "gc/shared/concurrentGCPhaseManager.hpp"
lkorinth@50154 29 #include "gc/shared/concurrentGCThread.hpp"
lkorinth@50154 30
lkorinth@50154 31 class G1ConcurrentMark;
lkorinth@50154 32 class G1Policy;
lkorinth@50154 33
lkorinth@50154 34 // The concurrent mark thread triggers the various steps of the concurrent marking
lkorinth@50154 35 // cycle, including various marking cleanup.
lkorinth@50154 36 class G1ConcurrentMarkThread: public ConcurrentGCThread {
lkorinth@50154 37 friend class VMStructs;
lkorinth@50154 38
lkorinth@50154 39 double _vtime_start; // Initial virtual time.
lkorinth@50154 40 double _vtime_accum; // Accumulated virtual time.
lkorinth@50154 41 double _vtime_mark_accum;
lkorinth@50154 42
lkorinth@50154 43 G1ConcurrentMark* _cm;
lkorinth@50154 44
lkorinth@50154 45 enum State {
lkorinth@50154 46 Idle,
lkorinth@50154 47 Started,
lkorinth@50154 48 InProgress
lkorinth@50154 49 };
lkorinth@50154 50
lkorinth@50154 51 volatile State _state;
lkorinth@50154 52
lkorinth@50154 53 // WhiteBox testing support.
lkorinth@50154 54 ConcurrentGCPhaseManager::Stack _phase_manager_stack;
lkorinth@50154 55
lkorinth@50154 56 void sleep_before_next_cycle();
lkorinth@50154 57 // Delay marking to meet MMU.
lkorinth@50154 58 void delay_to_keep_mmu(G1Policy* g1_policy, bool remark);
lkorinth@50154 59 double mmu_sleep_time(G1Policy* g1_policy, bool remark);
lkorinth@50154 60
lkorinth@50154 61 void run_service();
lkorinth@50154 62 void stop_service();
lkorinth@50154 63
lkorinth@50154 64 public:
lkorinth@50154 65 // Constructor
lkorinth@50154 66 G1ConcurrentMarkThread(G1ConcurrentMark* cm);
lkorinth@50154 67
lkorinth@50154 68 // Total virtual time so far for this thread and concurrent marking tasks.
lkorinth@50154 69 double vtime_accum();
lkorinth@50154 70 // Marking virtual time so far this thread and concurrent marking tasks.
lkorinth@50154 71 double vtime_mark_accum();
lkorinth@50154 72
lkorinth@50154 73 G1ConcurrentMark* cm() { return _cm; }
lkorinth@50154 74
lkorinth@50154 75 void set_idle() { assert(_state != Started, "must not be starting a new cycle"); _state = Idle; }
lkorinth@50154 76 bool idle() { return _state == Idle; }
lkorinth@50154 77 void set_started() { assert(_state == Idle, "cycle in progress"); _state = Started; }
lkorinth@50154 78 bool started() { return _state == Started; }
lkorinth@50154 79 void set_in_progress() { assert(_state == Started, "must be starting a cycle"); _state = InProgress; }
lkorinth@50154 80 bool in_progress() { return _state == InProgress; }
lkorinth@50154 81
lkorinth@50154 82 // Returns true from the moment a marking cycle is
lkorinth@50154 83 // initiated (during the initial-mark pause when started() is set)
lkorinth@50154 84 // to the moment when the cycle completes (just after the next
lkorinth@50154 85 // marking bitmap has been cleared and in_progress() is
lkorinth@50154 86 // cleared). While during_cycle() is true we will not start another cycle
lkorinth@50154 87 // so that cycles do not overlap. We cannot use just in_progress()
lkorinth@50154 88 // as the CM thread might take some time to wake up before noticing
lkorinth@50154 89 // that started() is set and set in_progress().
lkorinth@50154 90 bool during_cycle() { return !idle(); }
lkorinth@50154 91
lkorinth@50154 92 // WhiteBox testing support.
lkorinth@50154 93 const char* const* concurrent_phases() const;
lkorinth@50154 94 bool request_concurrent_phase(const char* phase);
lkorinth@50154 95
lkorinth@50154 96 ConcurrentGCPhaseManager::Stack* phase_manager_stack() {
lkorinth@50154 97 return &_phase_manager_stack;
lkorinth@50154 98 }
lkorinth@50154 99 };
lkorinth@50154 100
coleenp@54304 101 #endif // SHARE_GC_G1_G1CONCURRENTMARKTHREAD_HPP