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/classLoaderData.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "code/codeCache.hpp"
30 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
31 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.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/gcTimer.hpp"
40 #include "gc_implementation/shared/gcTrace.hpp"
41 #include "gc_implementation/shared/gcTraceTime.hpp"
42 #include "gc_implementation/shared/isGCActiveMark.hpp"
43 #include "gc_interface/collectedHeap.inline.hpp"
44 #include "memory/allocation.hpp"
45 #include "memory/cardGeneration.inline.hpp"
46 #include "memory/cardTableRS.hpp"
47 #include "memory/collectorPolicy.hpp"
48 #include "memory/gcLocker.inline.hpp"
49 #include "memory/genCollectedHeap.hpp"
50 #include "memory/genMarkSweep.hpp"
51 #include "memory/genOopClosures.inline.hpp"
52 #include "memory/iterator.inline.hpp"
53 #include "memory/padded.hpp"
54 #include "memory/referencePolicy.hpp"
55 #include "memory/resourceArea.hpp"
56 #include "memory/strongRootsScope.hpp"
57 #include "memory/tenuredGeneration.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "prims/jvmtiExport.hpp"
60 #include "runtime/atomic.inline.hpp"
61 #include "runtime/globals_extension.hpp"
62 #include "runtime/handles.inline.hpp"
63 #include "runtime/java.hpp"
64 #include "runtime/orderAccess.inline.hpp"
65 #include "runtime/vmThread.hpp"
66 #include "services/memoryService.hpp"
67 #include "services/runtimeService.hpp"
68 #include "utilities/stack.inline.hpp"
69 #include "utilities/taskqueue.inline.hpp"
70
71 // statics
72 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
73 bool CMSCollector::_full_gc_requested = false;
74 GCCause::Cause CMSCollector::_full_gc_cause = GCCause::_no_gc;
75
76 //////////////////////////////////////////////////////////////////
77 // In support of CMS/VM thread synchronization
78 //////////////////////////////////////////////////////////////////
79 // We split use of the CGC_lock into 2 "levels".
80 // The low-level locking is of the usual CGC_lock monitor. We introduce
81 // a higher level "token" (hereafter "CMS token") built on top of the
82 // low level monitor (hereafter "CGC lock").
83 // The token-passing protocol gives priority to the VM thread. The
84 // CMS-lock doesn't provide any fairness guarantees, but clients
85 // should ensure that it is only held for very short, bounded
86 // durations.
87 //
88 // When either of the CMS thread or the VM thread is involved in
89 // collection operations during which it does not want the other
|
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/classLoaderData.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "code/codeCache.hpp"
30 #include "gc/cms/cmsCollectorPolicy.hpp"
31 #include "gc/cms/cmsOopClosures.inline.hpp"
32 #include "gc/cms/compactibleFreeListSpace.hpp"
33 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
34 #include "gc/cms/concurrentMarkSweepThread.hpp"
35 #include "gc/cms/parNewGeneration.hpp"
36 #include "gc/cms/vmCMSOperations.hpp"
37 #include "gc/serial/genMarkSweep.hpp"
38 #include "gc/serial/tenuredGeneration.hpp"
39 #include "gc/shared/adaptiveSizePolicy.hpp"
40 #include "gc/shared/cardGeneration.inline.hpp"
41 #include "gc/shared/cardTableRS.hpp"
42 #include "gc/shared/collectedHeap.inline.hpp"
43 #include "gc/shared/collectorCounters.hpp"
44 #include "gc/shared/collectorPolicy.hpp"
45 #include "gc/shared/gcLocker.inline.hpp"
46 #include "gc/shared/gcTimer.hpp"
47 #include "gc/shared/gcTrace.hpp"
48 #include "gc/shared/gcTraceTime.hpp"
49 #include "gc/shared/genCollectedHeap.hpp"
50 #include "gc/shared/genOopClosures.inline.hpp"
51 #include "gc/shared/isGCActiveMark.hpp"
52 #include "gc/shared/referencePolicy.hpp"
53 #include "gc/shared/strongRootsScope.hpp"
54 #include "gc/shared/taskqueue.inline.hpp"
55 #include "memory/allocation.hpp"
56 #include "memory/iterator.inline.hpp"
57 #include "memory/padded.hpp"
58 #include "memory/resourceArea.hpp"
59 #include "oops/oop.inline.hpp"
60 #include "prims/jvmtiExport.hpp"
61 #include "runtime/atomic.inline.hpp"
62 #include "runtime/globals_extension.hpp"
63 #include "runtime/handles.inline.hpp"
64 #include "runtime/java.hpp"
65 #include "runtime/orderAccess.inline.hpp"
66 #include "runtime/vmThread.hpp"
67 #include "services/memoryService.hpp"
68 #include "services/runtimeService.hpp"
69 #include "utilities/stack.inline.hpp"
70
71 // statics
72 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
73 bool CMSCollector::_full_gc_requested = false;
74 GCCause::Cause CMSCollector::_full_gc_cause = GCCause::_no_gc;
75
76 //////////////////////////////////////////////////////////////////
77 // In support of CMS/VM thread synchronization
78 //////////////////////////////////////////////////////////////////
79 // We split use of the CGC_lock into 2 "levels".
80 // The low-level locking is of the usual CGC_lock monitor. We introduce
81 // a higher level "token" (hereafter "CMS token") built on top of the
82 // low level monitor (hereafter "CGC lock").
83 // The token-passing protocol gives priority to the VM thread. The
84 // CMS-lock doesn't provide any fairness guarantees, but clients
85 // should ensure that it is only held for very short, bounded
86 // durations.
87 //
88 // When either of the CMS thread or the VM thread is involved in
89 // collection operations during which it does not want the other
|