1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp Thu Jun 05 15:57:56 2008 -0700 1.3 @@ -0,0 +1,84 @@ 1.4 +/* 1.5 + * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// The Concurrent Mark GC Thread (could be several in the future). 1.29 +// This is copied from the Concurrent Mark Sweep GC Thread 1.30 +// Still under construction. 1.31 + 1.32 +class ConcurrentMark; 1.33 + 1.34 +class ConcurrentMarkThread: public ConcurrentGCThread { 1.35 + friend class VMStructs; 1.36 + 1.37 + double _vtime_start; // Initial virtual time. 1.38 + double _vtime_accum; // Accumulated virtual time. 1.39 + 1.40 + double _vtime_mark_accum; 1.41 + double _vtime_count_accum; 1.42 + 1.43 + public: 1.44 + virtual void run(); 1.45 + 1.46 + private: 1.47 + ConcurrentMark* _cm; 1.48 + bool _started; 1.49 + bool _in_progress; 1.50 + 1.51 + void sleepBeforeNextCycle(); 1.52 + 1.53 + static SurrogateLockerThread* _slt; 1.54 + 1.55 + public: 1.56 + // Constructor 1.57 + ConcurrentMarkThread(ConcurrentMark* cm); 1.58 + 1.59 + static void makeSurrogateLockerThread(TRAPS); 1.60 + static SurrogateLockerThread* slt() { return _slt; } 1.61 + 1.62 + // Printing 1.63 + void print(); 1.64 + 1.65 + // Total virtual time so far. 1.66 + double vtime_accum(); 1.67 + // Marking virtual time so far 1.68 + double vtime_mark_accum(); 1.69 + // Counting virtual time so far. 1.70 + double vtime_count_accum() { return _vtime_count_accum; } 1.71 + 1.72 + ConcurrentMark* cm() { return _cm; } 1.73 + 1.74 + void set_started() { _started = true; } 1.75 + void clear_started() { _started = false; } 1.76 + bool started() { return _started; } 1.77 + 1.78 + void set_in_progress() { _in_progress = true; } 1.79 + void clear_in_progress() { _in_progress = false; } 1.80 + bool in_progress() { return _in_progress; } 1.81 + 1.82 + // Yield for GC 1.83 + void yield(); 1.84 + 1.85 + // shutdown 1.86 + static void stop(); 1.87 +};