src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp

Fri, 29 Apr 2011 14:59:04 -0400

author
tonyp
date
Fri, 29 Apr 2011 14:59:04 -0400
changeset 2849
063382f9b575
parent 2314
f95d63e2154a
child 3463
d30fa85f9994
permissions
-rw-r--r--

7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
Summary: We should only undirty cards after we decide that they are not on a young region, not before. The fix also includes improvements to the verify_dirty_region() method which print out which cards were not found dirty.
Reviewed-by: johnc, brutisso

ysr@777 1 /*
stefank@2314 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
ysr@777 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@777 4 *
ysr@777 5 * This code is free software; you can redistribute it and/or modify it
ysr@777 6 * under the terms of the GNU General Public License version 2 only, as
ysr@777 7 * published by the Free Software Foundation.
ysr@777 8 *
ysr@777 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@777 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@777 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@777 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@777 13 * accompanied this code).
ysr@777 14 *
ysr@777 15 * You should have received a copy of the GNU General Public License version
ysr@777 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@777 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@777 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/shared/concurrentGCThread.hpp"
stefank@2314 29
ysr@777 30 // The Concurrent Mark GC Thread (could be several in the future).
ysr@777 31 // This is copied from the Concurrent Mark Sweep GC Thread
ysr@777 32 // Still under construction.
ysr@777 33
ysr@777 34 class ConcurrentMark;
ysr@777 35
ysr@777 36 class ConcurrentMarkThread: public ConcurrentGCThread {
ysr@777 37 friend class VMStructs;
ysr@777 38
ysr@777 39 double _vtime_start; // Initial virtual time.
ysr@777 40 double _vtime_accum; // Accumulated virtual time.
ysr@777 41
ysr@777 42 double _vtime_mark_accum;
ysr@777 43 double _vtime_count_accum;
ysr@777 44
ysr@777 45 public:
ysr@777 46 virtual void run();
ysr@777 47
ysr@777 48 private:
ysr@777 49 ConcurrentMark* _cm;
tonyp@1794 50 volatile bool _started;
tonyp@1794 51 volatile bool _in_progress;
ysr@777 52
ysr@777 53 void sleepBeforeNextCycle();
ysr@777 54
ysr@777 55 static SurrogateLockerThread* _slt;
ysr@777 56
ysr@777 57 public:
ysr@777 58 // Constructor
ysr@777 59 ConcurrentMarkThread(ConcurrentMark* cm);
ysr@777 60
ysr@777 61 static void makeSurrogateLockerThread(TRAPS);
ysr@777 62 static SurrogateLockerThread* slt() { return _slt; }
ysr@777 63
ysr@777 64 // Printing
tonyp@1454 65 void print_on(outputStream* st) const;
tonyp@1454 66 void print() const;
ysr@777 67
ysr@777 68 // Total virtual time so far.
ysr@777 69 double vtime_accum();
ysr@777 70 // Marking virtual time so far
ysr@777 71 double vtime_mark_accum();
ysr@777 72 // Counting virtual time so far.
ysr@777 73 double vtime_count_accum() { return _vtime_count_accum; }
ysr@777 74
tonyp@1794 75 ConcurrentMark* cm() { return _cm; }
ysr@777 76
johnc@2195 77 void set_started() { assert(!_in_progress, "cycle in progress"); _started = true; }
johnc@2195 78 void clear_started() { assert(_in_progress, "must be starting a cycle"); _started = false; }
tonyp@1794 79 bool started() { return _started; }
ysr@777 80
johnc@2195 81 void set_in_progress() { assert(_started, "must be starting a cycle"); _in_progress = true; }
johnc@2195 82 void clear_in_progress() { assert(!_started, "must not be starting a new cycle"); _in_progress = false; }
tonyp@1794 83 bool in_progress() { return _in_progress; }
tonyp@1794 84
tonyp@1794 85 // This flag returns true from the moment a marking cycle is
tonyp@1794 86 // initiated (during the initial-mark pause when started() is set)
tonyp@1794 87 // to the moment when the cycle completes (just after the next
tonyp@1794 88 // marking bitmap has been cleared and in_progress() is
tonyp@1794 89 // cleared). While this flag is true we will not start another cycle
tonyp@1794 90 // so that cycles do not overlap. We cannot use just in_progress()
tonyp@1794 91 // as the CM thread might take some time to wake up before noticing
tonyp@1794 92 // that started() is set and set in_progress().
tonyp@1794 93 bool during_cycle() { return started() || in_progress(); }
ysr@777 94
ysr@777 95 // Yield for GC
ysr@777 96 void yield();
ysr@777 97
ysr@777 98 // shutdown
iveresov@1229 99 void stop();
ysr@777 100 };
stefank@2314 101
stefank@2314 102 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARKTHREAD_HPP

mercurial