concurrentMarkSweepThread.hpp revision 0
0N/A * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A// The Concurrent Mark Sweep GC Thread (could be several in the future). 0N/A // CMS thread should yield for a young gen collection, direct allocation, 0N/A // and iCMS activity. 0N/A static char _pad_1[
64 -
sizeof(
jint)];
// prevent cache-line sharing 0N/A static char _pad_2[
64 -
sizeof(
jint)];
// prevent cache-line sharing 0N/A // Tracing messages, enabled by CMSTraceThreadState. 0N/A // Returns the CMS Thread 0N/A // Create and start the CMS Thread, or stop it on shutdown 0N/A // Synchronization using CMS token 0N/A // Wait on CMS lock until the next synchronous GC 0N/A // or given timeout, whichever is earlier. 0N/A // The CMS thread will yield during the work portion of it's cycle 0N/A // only when requested to. Both synchronous and asychronous requests 0N/A // are provided. A synchronous request is used for young gen 0N/A // collections and direct allocations. The requesting thread increments 0N/A // pending_yields at the beginning of an operation, and decrements it when 0N/A // the operation is completed. The CMS thread yields when pending_yields 0N/A // is positive. An asynchronous request is used by iCMS in the stop_icms() 0N/A // operation. A single yield satisfies the outstanding asynch yield requests. 0N/A // The requesting thread increments both pending_yields and pending_decrements. 0N/A // After yielding, the CMS thread decrements both by the amount in 0N/A // pending_decrements. 0N/A // Note that, while "_pending_yields >= _pending_decrements" is an invariant, 0N/A // we cannot easily test that invariant, since the counters are manipulated via 0N/A // atomic instructions without explicit locking and we cannot read 0N/A // the two counters atomically together: one suggestion is to 0N/A // use (for example) 16-bit counters so as to be able to read the 0N/A // two counters atomically even on 32-bit platforms. Notice that 0N/A // the second assert in acknowledge_yield_request() does indeed 0N/A // check a form of the above invariant, albeit indirectly. 0N/A // Order important to preserve: _pending_yields >= _pending_decrements 0N/A // CMS incremental mode. 0N/A static void start_icms();
// notify thread to start a quantum of work 0N/A void icms_wait();
// if asked to stop, wait until notified to start 0N/A // Incremental mode is enabled globally by the flag CMSIncrementalMode. It 0N/A// Used to emit a warning in case of unexpectedly excessive 0N/A// looping (in "apparently endless loops") in CMS code.