5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_concurrentMarkSweepGeneration.cpp.incl" 27 28 // statics 29 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; 30 bool CMSCollector::_full_gc_requested = false; 31 32 ////////////////////////////////////////////////////////////////// 33 // In support of CMS/VM thread synchronization 34 ////////////////////////////////////////////////////////////////// 35 // We split use of the CGC_lock into 2 "levels". 36 // The low-level locking is of the usual CGC_lock monitor. We introduce 37 // a higher level "token" (hereafter "CMS token") built on top of the 38 // low level monitor (hereafter "CGC lock"). 39 // The token-passing protocol gives priority to the VM thread. The 40 // CMS-lock doesn't provide any fairness guarantees, but clients 41 // should ensure that it is only held for very short, bounded 42 // durations. 43 // 44 // When either of the CMS thread or the VM thread is involved in 45 // collection operations during which it does not want the other 46 // thread to interfere, it obtains the CMS token. | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/symbolTable.hpp" 27 #include "classfile/systemDictionary.hpp" 28 #include "code/codeCache.hpp" 29 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" 30 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp" 31 #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp" 32 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp" 33 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" 34 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp" 35 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" 36 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp" 37 #include "gc_implementation/parNew/parNewGeneration.hpp" 38 #include "gc_implementation/shared/collectorCounters.hpp" 39 #include "gc_implementation/shared/isGCActiveMark.hpp" 40 #include "gc_interface/collectedHeap.inline.hpp" 41 #include "memory/cardTableRS.hpp" 42 #include "memory/collectorPolicy.hpp" 43 #include "memory/gcLocker.inline.hpp" 44 #include "memory/genCollectedHeap.hpp" 45 #include "memory/genMarkSweep.hpp" 46 #include "memory/genOopClosures.inline.hpp" 47 #include "memory/iterator.hpp" 48 #include "memory/referencePolicy.hpp" 49 #include "memory/resourceArea.hpp" 50 #include "oops/oop.inline.hpp" 51 #include "prims/jvmtiExport.hpp" 52 #include "runtime/globals_extension.hpp" 53 #include "runtime/handles.inline.hpp" 54 #include "runtime/java.hpp" 55 #include "runtime/vmThread.hpp" 56 #include "services/memoryService.hpp" 57 #include "services/runtimeService.hpp" 58 59 // statics 60 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; 61 bool CMSCollector::_full_gc_requested = false; 62 63 ////////////////////////////////////////////////////////////////// 64 // In support of CMS/VM thread synchronization 65 ////////////////////////////////////////////////////////////////// 66 // We split use of the CGC_lock into 2 "levels". 67 // The low-level locking is of the usual CGC_lock monitor. We introduce 68 // a higher level "token" (hereafter "CMS token") built on top of the 69 // low level monitor (hereafter "CGC lock"). 70 // The token-passing protocol gives priority to the VM thread. The 71 // CMS-lock doesn't provide any fairness guarantees, but clients 72 // should ensure that it is only held for very short, bounded 73 // durations. 74 // 75 // When either of the CMS thread or the VM thread is involved in 76 // collection operations during which it does not want the other 77 // thread to interfere, it obtains the CMS token. |