author | rkennke |
Thu, 30 Nov 2017 13:40:07 +0100 | |
changeset 48168 | cb5d2d4453d0 |
parent 47819 | ee36a8e36561 |
child 48961 | 120b61d50f85 |
permissions | -rw-r--r-- |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
1 |
/* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
4 |
* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
8 |
* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
13 |
* accompanied this code). |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
14 |
* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
18 |
* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
21 |
* questions. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
22 |
* |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
23 |
*/ |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
24 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_CMS_CMSHEAP_HPP |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
26 |
#define SHARE_VM_GC_CMS_CMSHEAP_HPP |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
27 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
28 |
#include "gc/cms/concurrentMarkSweepGeneration.hpp" |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
29 |
#include "gc/shared/collectedHeap.hpp" |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
30 |
#include "gc/shared/gcCause.hpp" |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
31 |
#include "gc/shared/genCollectedHeap.hpp" |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
32 |
#include "utilities/growableArray.hpp" |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
33 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
34 |
class CLDClosure; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
35 |
class GenCollectorPolicy; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
36 |
class GCMemoryManager; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
37 |
class MemoryPool; |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
38 |
class OopsInGenClosure; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
39 |
class outputStream; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
40 |
class StrongRootsScope; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
41 |
class ThreadClosure; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
42 |
class WorkGang; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
43 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
44 |
class CMSHeap : public GenCollectedHeap { |
47819
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47657
diff
changeset
|
45 |
|
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47657
diff
changeset
|
46 |
protected: |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47657
diff
changeset
|
47 |
virtual void check_gen_kinds(); |
ee36a8e36561
8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47657
diff
changeset
|
48 |
|
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
49 |
public: |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
50 |
CMSHeap(GenCollectorPolicy *policy); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
51 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
52 |
// Returns JNI_OK on success |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
53 |
virtual jint initialize(); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
54 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
55 |
// Convenience function to be used in situations where the heap type can be |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
56 |
// asserted to be this type. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
57 |
static CMSHeap* heap(); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
58 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
59 |
virtual Name kind() const { |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
60 |
return CollectedHeap::CMSHeap; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
61 |
} |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
62 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
63 |
virtual const char* name() const { |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
64 |
return "Concurrent Mark Sweep"; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
65 |
} |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
66 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
67 |
WorkGang* workers() const { return _workers; } |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
68 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
69 |
virtual void print_gc_threads_on(outputStream* st) const; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
70 |
virtual void gc_threads_do(ThreadClosure* tc) const; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
71 |
virtual void print_on_error(outputStream* st) const; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
72 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
73 |
// Perform a full collection of the heap; intended for use in implementing |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
74 |
// "System.gc". This implies as full a collection as the CollectedHeap |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
75 |
// supports. Caller does not hold the Heap_lock on entry. |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
76 |
void collect(GCCause::Cause cause); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
77 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
78 |
bool card_mark_must_follow_store() const { |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
79 |
return true; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
80 |
} |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
81 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
82 |
void stop(); |
47636
52d46d7e3454
8188919: Generalize GC thread suspend/resume at safepoints
eosterlund
parents:
47622
diff
changeset
|
83 |
void safepoint_synchronize_begin(); |
52d46d7e3454
8188919: Generalize GC thread suspend/resume at safepoints
eosterlund
parents:
47622
diff
changeset
|
84 |
void safepoint_synchronize_end(); |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
85 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
86 |
virtual GrowableArray<GCMemoryManager*> memory_managers(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
87 |
virtual GrowableArray<MemoryPool*> memory_pools(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
88 |
|
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
89 |
// If "young_gen_as_roots" is false, younger generations are |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
90 |
// not scanned as roots; in this case, the caller must be arranging to |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
91 |
// scan the younger generations itself. (For example, a generation might |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
92 |
// explicitly mark reachable objects in younger generations, to avoid |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
93 |
// excess storage retention.) |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
94 |
void cms_process_roots(StrongRootsScope* scope, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
95 |
bool young_gen_as_roots, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
96 |
ScanningOption so, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
97 |
bool only_strong_roots, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
98 |
OopsInGenClosure* root_closure, |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
99 |
CLDClosure* cld_closure); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
100 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
101 |
GCMemoryManager* old_manager() const { return _old_manager; } |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
102 |
|
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
103 |
private: |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
104 |
WorkGang* _workers; |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
105 |
MemoryPool* _eden_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
106 |
MemoryPool* _survivor_pool; |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
107 |
MemoryPool* _old_pool; |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
108 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
109 |
virtual void gc_prologue(bool full); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
110 |
virtual void gc_epilogue(bool full); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
111 |
|
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
112 |
virtual void initialize_serviceability(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
47819
diff
changeset
|
113 |
|
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
114 |
// Accessor for memory state verification support |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
115 |
NOT_PRODUCT( |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
116 |
virtual size_t skip_header_HeapWords() { return CMSCollector::skip_header_HeapWords(); } |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
117 |
) |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
118 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
119 |
// Returns success or failure. |
47657 | 120 |
bool create_cms_collector(); |
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
121 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
122 |
// In support of ExplicitGCInvokesConcurrent functionality |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
123 |
bool should_do_concurrent_full_gc(GCCause::Cause cause); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
124 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
125 |
void collect_mostly_concurrent(GCCause::Cause cause); |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
126 |
}; |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
127 |
|
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
diff
changeset
|
128 |
#endif // SHARE_VM_GC_CMS_CMSHEAP_HPP |