author | shade |
Mon, 06 Nov 2017 18:53:38 +0100 | |
branch | epsilon-gc-branch |
changeset 55767 | 8e22715afabc |
parent 47622 | 817f2a7019e4 |
child 55778 | a977fcca316b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
35520
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
27 |
#include "classfile/vmSymbols.hpp" |
|
30764 | 28 |
#include "gc/parallel/mutableSpace.hpp" |
29 |
#include "gc/serial/defNewGeneration.hpp" |
|
30 |
#include "gc/serial/tenuredGeneration.hpp" |
|
31 |
#include "gc/shared/collectorPolicy.hpp" |
|
32 |
#include "gc/shared/genCollectedHeap.hpp" |
|
33 |
#include "gc/shared/generation.hpp" |
|
34 |
#include "gc/shared/generationSpec.hpp" |
|
35061 | 35 |
#include "logging/logConfiguration.hpp" |
7397 | 36 |
#include "memory/heap.hpp" |
37 |
#include "memory/memRegion.hpp" |
|
38 |
#include "oops/oop.inline.hpp" |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
39 |
#include "runtime/globals.hpp" |
7397 | 40 |
#include "runtime/javaCalls.hpp" |
41 |
#include "services/classLoadingService.hpp" |
|
42 |
#include "services/lowMemoryDetector.hpp" |
|
43 |
#include "services/management.hpp" |
|
44 |
#include "services/memoryManager.hpp" |
|
45 |
#include "services/memoryPool.hpp" |
|
46 |
#include "services/memoryService.hpp" |
|
47 |
#include "utilities/growableArray.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
48 |
#include "utilities/macros.hpp" |
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
49 |
#if INCLUDE_ALL_GCS |
30764 | 50 |
#include "gc/cms/concurrentMarkSweepGeneration.hpp" |
51 |
#include "gc/cms/parNewGeneration.hpp" |
|
52 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
|
53 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
|
54 |
#include "gc/parallel/psOldGen.hpp" |
|
55 |
#include "gc/parallel/psYoungGen.hpp" |
|
7397 | 56 |
#include "services/g1MemoryPool.hpp" |
57 |
#include "services/psMemoryPool.hpp" |
|
55767
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
58 |
#include "services/epsilonMemoryPool.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
59 |
#endif // INCLUDE_ALL_GCS |
1 | 60 |
|
61 |
GrowableArray<MemoryPool*>* MemoryService::_pools_list = |
|
13195 | 62 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); |
1 | 63 |
GrowableArray<MemoryManager*>* MemoryService::_managers_list = |
13195 | 64 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); |
1 | 65 |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
66 |
GCMemoryManager* MemoryService::_minor_gc_manager = NULL; |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
67 |
GCMemoryManager* MemoryService::_major_gc_manager = NULL; |
26796 | 68 |
MemoryManager* MemoryService::_code_cache_manager = NULL; |
69 |
GrowableArray<MemoryPool*>* MemoryService::_code_heap_pools = |
|
70 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_code_heap_pools_size, true); |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
71 |
MemoryPool* MemoryService::_metaspace_pool = NULL; |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
72 |
MemoryPool* MemoryService::_compressed_class_pool = NULL; |
1 | 73 |
|
74 |
class GcThreadCountClosure: public ThreadClosure { |
|
75 |
private: |
|
76 |
int _count; |
|
77 |
public: |
|
78 |
GcThreadCountClosure() : _count(0) {}; |
|
79 |
void do_thread(Thread* thread); |
|
80 |
int count() { return _count; } |
|
81 |
}; |
|
82 |
||
83 |
void GcThreadCountClosure::do_thread(Thread* thread) { |
|
84 |
_count++; |
|
85 |
} |
|
86 |
||
87 |
void MemoryService::set_universe_heap(CollectedHeap* heap) { |
|
88 |
CollectedHeap::Name kind = heap->kind(); |
|
89 |
switch (kind) { |
|
47622
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47216
diff
changeset
|
90 |
case CollectedHeap::GenCollectedHeap : |
817f2a7019e4
8179387: Factor out CMS specific code from GenCollectedHeap into its own subclass
rkennke
parents:
47216
diff
changeset
|
91 |
case CollectedHeap::CMSHeap : { |
1 | 92 |
add_gen_collected_heap_info(GenCollectedHeap::heap()); |
93 |
break; |
|
94 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
95 |
#if INCLUDE_ALL_GCS |
1 | 96 |
case CollectedHeap::ParallelScavengeHeap : { |
97 |
add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); |
|
98 |
break; |
|
99 |
} |
|
1374 | 100 |
case CollectedHeap::G1CollectedHeap : { |
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
101 |
add_g1_heap_info(G1CollectedHeap::heap()); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
102 |
break; |
1374 | 103 |
} |
55767
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
104 |
case CollectedHeap::EpsilonCollectedHeap : { |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
105 |
add_epsilon_heap_info(EpsilonCollectedHeap::heap()); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
106 |
break; |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
107 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
108 |
#endif // INCLUDE_ALL_GCS |
1 | 109 |
default: { |
1374 | 110 |
guarantee(false, "Unrecognized kind of heap"); |
1 | 111 |
} |
112 |
} |
|
113 |
||
114 |
// set the GC thread count |
|
115 |
GcThreadCountClosure gctcc; |
|
116 |
heap->gc_threads_do(&gctcc); |
|
117 |
int count = gctcc.count(); |
|
118 |
if (count > 0) { |
|
119 |
_minor_gc_manager->set_num_gc_threads(count); |
|
120 |
_major_gc_manager->set_num_gc_threads(count); |
|
121 |
} |
|
122 |
||
123 |
// All memory pools and memory managers are initialized. |
|
124 |
// |
|
125 |
_minor_gc_manager->initialize_gc_stat_info(); |
|
126 |
_major_gc_manager->initialize_gc_stat_info(); |
|
127 |
} |
|
128 |
||
129 |
// Add memory pools for GenCollectedHeap |
|
130 |
// This function currently only supports two generations collected heap. |
|
131 |
// The collector for GenCollectedHeap will have two memory managers. |
|
132 |
void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { |
|
133 |
CollectorPolicy* policy = heap->collector_policy(); |
|
134 |
||
24353
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
135 |
assert(policy->is_generation_policy(), "Only support two generations"); |
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
136 |
GenCollectorPolicy* gen_policy = policy->as_generation_policy(); |
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
137 |
if (gen_policy != NULL) { |
29794 | 138 |
Generation::Name kind = gen_policy->young_gen_spec()->name(); |
1 | 139 |
switch (kind) { |
140 |
case Generation::DefNew: |
|
141 |
_minor_gc_manager = MemoryManager::get_copy_memory_manager(); |
|
142 |
break; |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
143 |
#if INCLUDE_ALL_GCS |
1 | 144 |
case Generation::ParNew: |
145 |
_minor_gc_manager = MemoryManager::get_parnew_memory_manager(); |
|
146 |
break; |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
147 |
#endif // INCLUDE_ALL_GCS |
1 | 148 |
default: |
149 |
guarantee(false, "Unrecognized generation spec"); |
|
150 |
break; |
|
151 |
} |
|
152 |
if (policy->is_mark_sweep_policy()) { |
|
153 |
_major_gc_manager = MemoryManager::get_msc_memory_manager(); |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
154 |
#if INCLUDE_ALL_GCS |
1 | 155 |
} else if (policy->is_concurrent_mark_sweep_policy()) { |
156 |
_major_gc_manager = MemoryManager::get_cms_memory_manager(); |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
157 |
#endif // INCLUDE_ALL_GCS |
1 | 158 |
} else { |
159 |
guarantee(false, "Unknown two-gen policy"); |
|
160 |
} |
|
161 |
} else { |
|
162 |
guarantee(false, "Non two-gen policy"); |
|
163 |
} |
|
164 |
_managers_list->append(_minor_gc_manager); |
|
165 |
_managers_list->append(_major_gc_manager); |
|
166 |
||
29684
a36d90acae41
8057632: Remove auxiliary code used to handle the generations array
jwilhelm
parents:
26796
diff
changeset
|
167 |
add_generation_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); |
a36d90acae41
8057632: Remove auxiliary code used to handle the generations array
jwilhelm
parents:
26796
diff
changeset
|
168 |
add_generation_memory_pool(heap->old_gen(), _major_gc_manager); |
1 | 169 |
} |
170 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
171 |
#if INCLUDE_ALL_GCS |
1 | 172 |
// Add memory pools for ParallelScavengeHeap |
173 |
// This function currently only supports two generations collected heap. |
|
174 |
// The collector for ParallelScavengeHeap will have two memory managers. |
|
175 |
void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { |
|
176 |
// Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. |
|
177 |
_minor_gc_manager = MemoryManager::get_psScavenge_memory_manager(); |
|
178 |
_major_gc_manager = MemoryManager::get_psMarkSweep_memory_manager(); |
|
179 |
_managers_list->append(_minor_gc_manager); |
|
180 |
_managers_list->append(_major_gc_manager); |
|
181 |
||
182 |
add_psYoung_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); |
|
183 |
add_psOld_memory_pool(heap->old_gen(), _major_gc_manager); |
|
184 |
} |
|
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
185 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
186 |
void MemoryService::add_g1_heap_info(G1CollectedHeap* g1h) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
187 |
assert(UseG1GC, "sanity"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
188 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
189 |
_minor_gc_manager = MemoryManager::get_g1YoungGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
190 |
_major_gc_manager = MemoryManager::get_g1OldGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
191 |
_managers_list->append(_minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
192 |
_managers_list->append(_major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
193 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
194 |
add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
195 |
add_g1OldGen_memory_pool(g1h, _major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
196 |
} |
55767
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
197 |
|
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
198 |
void MemoryService::add_epsilon_heap_info(EpsilonCollectedHeap* eh) { |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
199 |
assert(UseEpsilonGC, "sanity"); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
200 |
|
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
201 |
_minor_gc_manager = MemoryManager::get_epsilon_memory_manager(); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
202 |
_major_gc_manager = MemoryManager::get_epsilon_memory_manager(); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
203 |
_managers_list->append(_minor_gc_manager); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
204 |
_managers_list->append(_major_gc_manager); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
205 |
|
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
206 |
EpsilonDummyMemoryPool* dummy = new EpsilonDummyMemoryPool(); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
207 |
_minor_gc_manager->add_pool(dummy); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
208 |
_pools_list->append(dummy); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
209 |
|
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
210 |
EpsilonMemoryPool* pool = new EpsilonMemoryPool(eh); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
211 |
_major_gc_manager->add_pool(pool); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
212 |
_pools_list->append(pool); |
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
213 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
214 |
#endif // INCLUDE_ALL_GCS |
1 | 215 |
|
216 |
MemoryPool* MemoryService::add_gen(Generation* gen, |
|
217 |
const char* name, |
|
218 |
bool is_heap, |
|
219 |
bool support_usage_threshold) { |
|
220 |
||
221 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
222 |
GenerationPool* pool = new GenerationPool(gen, name, type, support_usage_threshold); |
|
223 |
_pools_list->append(pool); |
|
224 |
return (MemoryPool*) pool; |
|
225 |
} |
|
226 |
||
227 |
MemoryPool* MemoryService::add_space(ContiguousSpace* space, |
|
228 |
const char* name, |
|
229 |
bool is_heap, |
|
230 |
size_t max_size, |
|
231 |
bool support_usage_threshold) { |
|
232 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
233 |
ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold); |
|
234 |
||
235 |
_pools_list->append(pool); |
|
236 |
return (MemoryPool*) pool; |
|
237 |
} |
|
238 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
239 |
MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* young_gen, |
1 | 240 |
const char* name, |
241 |
bool is_heap, |
|
242 |
size_t max_size, |
|
243 |
bool support_usage_threshold) { |
|
244 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
245 |
SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(young_gen, name, type, max_size, support_usage_threshold); |
1 | 246 |
|
247 |
_pools_list->append(pool); |
|
248 |
return (MemoryPool*) pool; |
|
249 |
} |
|
250 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
251 |
#if INCLUDE_ALL_GCS |
1 | 252 |
MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, |
253 |
const char* name, |
|
254 |
bool is_heap, |
|
255 |
size_t max_size, |
|
256 |
bool support_usage_threshold) { |
|
257 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
258 |
CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); |
|
259 |
_pools_list->append(pool); |
|
260 |
return (MemoryPool*) pool; |
|
261 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
262 |
#endif // INCLUDE_ALL_GCS |
1 | 263 |
|
264 |
// Add memory pool(s) for one generation |
|
265 |
void MemoryService::add_generation_memory_pool(Generation* gen, |
|
266 |
MemoryManager* major_mgr, |
|
267 |
MemoryManager* minor_mgr) { |
|
16362
7b5c4f403e90
8009156: [parfait] Null pointer deference in hotspot/src/share/vm/services/memoryService.cpp
morris
parents:
15482
diff
changeset
|
268 |
guarantee(gen != NULL, "No generation for memory pool"); |
1 | 269 |
Generation::Name kind = gen->kind(); |
270 |
int index = _pools_list->length(); |
|
271 |
||
272 |
switch (kind) { |
|
273 |
case Generation::DefNew: { |
|
274 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
275 |
DefNewGeneration* young_gen = (DefNewGeneration*) gen; |
|
276 |
// Add a memory pool for each space and young gen doesn't |
|
277 |
// support low memory detection as it is expected to get filled up. |
|
278 |
MemoryPool* eden = add_space(young_gen->eden(), |
|
279 |
"Eden Space", |
|
280 |
true, /* is_heap */ |
|
281 |
young_gen->max_eden_size(), |
|
282 |
false /* support_usage_threshold */); |
|
283 |
MemoryPool* survivor = add_survivor_spaces(young_gen, |
|
284 |
"Survivor Space", |
|
285 |
true, /* is_heap */ |
|
286 |
young_gen->max_survivor_size(), |
|
287 |
false /* support_usage_threshold */); |
|
288 |
break; |
|
289 |
} |
|
290 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
291 |
#if INCLUDE_ALL_GCS |
1 | 292 |
case Generation::ParNew: |
293 |
{ |
|
294 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
295 |
// Add a memory pool for each space and young gen doesn't |
|
296 |
// support low memory detection as it is expected to get filled up. |
|
297 |
ParNewGeneration* parnew_gen = (ParNewGeneration*) gen; |
|
298 |
MemoryPool* eden = add_space(parnew_gen->eden(), |
|
299 |
"Par Eden Space", |
|
300 |
true /* is_heap */, |
|
301 |
parnew_gen->max_eden_size(), |
|
302 |
false /* support_usage_threshold */); |
|
303 |
MemoryPool* survivor = add_survivor_spaces(parnew_gen, |
|
304 |
"Par Survivor Space", |
|
305 |
true, /* is_heap */ |
|
306 |
parnew_gen->max_survivor_size(), |
|
307 |
false /* support_usage_threshold */); |
|
308 |
||
309 |
break; |
|
310 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
311 |
#endif // INCLUDE_ALL_GCS |
1 | 312 |
|
313 |
case Generation::MarkSweepCompact: { |
|
314 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
315 |
add_gen(gen, |
|
316 |
"Tenured Gen", |
|
317 |
true, /* is_heap */ |
|
318 |
true /* support_usage_threshold */); |
|
319 |
break; |
|
320 |
} |
|
321 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
322 |
#if INCLUDE_ALL_GCS |
1 | 323 |
case Generation::ConcurrentMarkSweep: |
324 |
{ |
|
325 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
326 |
ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; |
|
327 |
MemoryPool* pool = add_cms_space(cms->cmsSpace(), |
|
328 |
"CMS Old Gen", |
|
329 |
true, /* is_heap */ |
|
330 |
cms->reserved().byte_size(), |
|
331 |
true /* support_usage_threshold */); |
|
332 |
break; |
|
333 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
334 |
#endif // INCLUDE_ALL_GCS |
1 | 335 |
|
336 |
default: |
|
337 |
assert(false, "should not reach here"); |
|
338 |
// no memory pool added for others |
|
339 |
break; |
|
340 |
} |
|
341 |
||
342 |
assert(major_mgr != NULL, "Should have at least one manager"); |
|
343 |
// Link managers and the memory pools together |
|
344 |
for (int i = index; i < _pools_list->length(); i++) { |
|
345 |
MemoryPool* pool = _pools_list->at(i); |
|
346 |
major_mgr->add_pool(pool); |
|
347 |
if (minor_mgr != NULL) { |
|
348 |
minor_mgr->add_pool(pool); |
|
349 |
} |
|
350 |
} |
|
351 |
} |
|
352 |
||
353 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
354 |
#if INCLUDE_ALL_GCS |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
355 |
void MemoryService::add_psYoung_memory_pool(PSYoungGen* young_gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { |
1 | 356 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
357 |
||
358 |
// Add a memory pool for each space and young gen doesn't |
|
359 |
// support low memory detection as it is expected to get filled up. |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
360 |
EdenMutableSpacePool* eden = new EdenMutableSpacePool(young_gen, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
361 |
young_gen->eden_space(), |
1 | 362 |
"PS Eden Space", |
363 |
MemoryPool::Heap, |
|
364 |
false /* support_usage_threshold */); |
|
365 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
366 |
SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(young_gen, |
1 | 367 |
"PS Survivor Space", |
368 |
MemoryPool::Heap, |
|
369 |
false /* support_usage_threshold */); |
|
370 |
||
371 |
major_mgr->add_pool(eden); |
|
372 |
major_mgr->add_pool(survivor); |
|
373 |
minor_mgr->add_pool(eden); |
|
374 |
minor_mgr->add_pool(survivor); |
|
375 |
_pools_list->append(eden); |
|
376 |
_pools_list->append(survivor); |
|
377 |
} |
|
378 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
379 |
void MemoryService::add_psOld_memory_pool(PSOldGen* old_gen, MemoryManager* mgr) { |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
380 |
PSGenerationPool* old_gen_pool = new PSGenerationPool(old_gen, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
381 |
"PS Old Gen", |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
382 |
MemoryPool::Heap, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
383 |
true /* support_usage_threshold */); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
384 |
mgr->add_pool(old_gen_pool); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
385 |
_pools_list->append(old_gen_pool); |
1 | 386 |
} |
387 |
||
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
388 |
void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
389 |
MemoryManager* major_mgr, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
390 |
MemoryManager* minor_mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
391 |
assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
392 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
393 |
G1EdenPool* eden = new G1EdenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
394 |
G1SurvivorPool* survivor = new G1SurvivorPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
395 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
396 |
major_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
397 |
major_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
398 |
minor_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
399 |
minor_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
400 |
_pools_list->append(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
401 |
_pools_list->append(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
402 |
} |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
403 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
404 |
void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
405 |
MemoryManager* mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
406 |
assert(mgr != NULL, "should have one manager"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
407 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
408 |
G1OldGenPool* old_gen = new G1OldGenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
409 |
mgr->add_pool(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
410 |
_pools_list->append(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
411 |
} |
55767
8e22715afabc
Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
47622
diff
changeset
|
412 |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
413 |
#endif // INCLUDE_ALL_GCS |
1 | 414 |
|
26796 | 415 |
void MemoryService::add_code_heap_memory_pool(CodeHeap* heap, const char* name) { |
416 |
// Create new memory pool for this heap |
|
417 |
MemoryPool* code_heap_pool = new CodeHeapPool(heap, name, true /* support_usage_threshold */); |
|
418 |
||
419 |
// Append to lists |
|
420 |
_code_heap_pools->append(code_heap_pool); |
|
421 |
_pools_list->append(code_heap_pool); |
|
1 | 422 |
|
26796 | 423 |
if (_code_cache_manager == NULL) { |
424 |
// Create CodeCache memory manager |
|
425 |
_code_cache_manager = MemoryManager::get_code_cache_memory_manager(); |
|
426 |
_managers_list->append(_code_cache_manager); |
|
427 |
} |
|
428 |
||
429 |
_code_cache_manager->add_pool(code_heap_pool); |
|
1 | 430 |
} |
431 |
||
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
432 |
void MemoryService::add_metaspace_memory_pools() { |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
433 |
MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
434 |
|
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
435 |
_metaspace_pool = new MetaspacePool(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
436 |
mgr->add_pool(_metaspace_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
437 |
_pools_list->append(_metaspace_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
438 |
|
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
18444
diff
changeset
|
439 |
if (UseCompressedClassPointers) { |
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
440 |
_compressed_class_pool = new CompressedKlassSpacePool(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
441 |
mgr->add_pool(_compressed_class_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
442 |
_pools_list->append(_compressed_class_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
443 |
} |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
444 |
|
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
445 |
_managers_list->append(mgr); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
446 |
} |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
447 |
|
1 | 448 |
MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { |
449 |
for (int i = 0; i < _managers_list->length(); i++) { |
|
450 |
MemoryManager* mgr = _managers_list->at(i); |
|
451 |
if (mgr->is_manager(mh)) { |
|
452 |
return mgr; |
|
453 |
} |
|
454 |
} |
|
455 |
return NULL; |
|
456 |
} |
|
457 |
||
458 |
MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { |
|
459 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
460 |
MemoryPool* pool = _pools_list->at(i); |
|
461 |
if (pool->is_pool(ph)) { |
|
462 |
return pool; |
|
463 |
} |
|
464 |
} |
|
465 |
return NULL; |
|
466 |
} |
|
467 |
||
468 |
void MemoryService::track_memory_usage() { |
|
469 |
// Track the peak memory usage |
|
470 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
471 |
MemoryPool* pool = _pools_list->at(i); |
|
472 |
pool->record_peak_memory_usage(); |
|
473 |
} |
|
474 |
||
475 |
// Detect low memory |
|
476 |
LowMemoryDetector::detect_low_memory(); |
|
477 |
} |
|
478 |
||
479 |
void MemoryService::track_memory_pool_usage(MemoryPool* pool) { |
|
480 |
// Track the peak memory usage |
|
481 |
pool->record_peak_memory_usage(); |
|
482 |
||
483 |
// Detect low memory |
|
484 |
if (LowMemoryDetector::is_enabled(pool)) { |
|
485 |
LowMemoryDetector::detect_low_memory(pool); |
|
486 |
} |
|
487 |
} |
|
488 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
489 |
void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
490 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
491 |
bool recordPreGCUsage, bool recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
492 |
|
1 | 493 |
GCMemoryManager* mgr; |
494 |
if (fullGC) { |
|
495 |
mgr = _major_gc_manager; |
|
496 |
} else { |
|
497 |
mgr = _minor_gc_manager; |
|
498 |
} |
|
499 |
assert(mgr->is_gc_memory_manager(), "Sanity check"); |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
500 |
mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime); |
1 | 501 |
|
502 |
// Track the peak memory usage when GC begins |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
503 |
if (recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
504 |
for (int i = 0; i < _pools_list->length(); i++) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
505 |
MemoryPool* pool = _pools_list->at(i); |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
506 |
pool->record_peak_memory_usage(); |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
507 |
} |
1 | 508 |
} |
509 |
} |
|
510 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
511 |
void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
512 |
bool recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
513 |
bool recordGCEndTime, bool countCollection, |
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
514 |
GCCause::Cause cause) { |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
515 |
|
1 | 516 |
GCMemoryManager* mgr; |
517 |
if (fullGC) { |
|
518 |
mgr = (GCMemoryManager*) _major_gc_manager; |
|
519 |
} else { |
|
520 |
mgr = (GCMemoryManager*) _minor_gc_manager; |
|
521 |
} |
|
522 |
assert(mgr->is_gc_memory_manager(), "Sanity check"); |
|
523 |
||
524 |
// register the GC end statistics and memory usage |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
525 |
mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
526 |
countCollection, cause); |
1 | 527 |
} |
528 |
||
529 |
void MemoryService::oops_do(OopClosure* f) { |
|
530 |
int i; |
|
531 |
||
532 |
for (i = 0; i < _pools_list->length(); i++) { |
|
533 |
MemoryPool* pool = _pools_list->at(i); |
|
534 |
pool->oops_do(f); |
|
535 |
} |
|
536 |
for (i = 0; i < _managers_list->length(); i++) { |
|
537 |
MemoryManager* mgr = _managers_list->at(i); |
|
538 |
mgr->oops_do(f); |
|
539 |
} |
|
540 |
} |
|
541 |
||
542 |
bool MemoryService::set_verbose(bool verbose) { |
|
543 |
MutexLocker m(Management_lock); |
|
544 |
// verbose will be set to the previous value |
|
35061 | 545 |
if (verbose) { |
35520
0efb779f41a5
8147464: Use LogConfiguration::configure_stdout() instead of parse_log_arguments
brutisso
parents:
35228
diff
changeset
|
546 |
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); |
35061 | 547 |
} else { |
35520
0efb779f41a5
8147464: Use LogConfiguration::configure_stdout() instead of parse_log_arguments
brutisso
parents:
35228
diff
changeset
|
548 |
LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(gc)); |
35061 | 549 |
} |
1 | 550 |
ClassLoadingService::reset_trace_class_unloading(); |
551 |
||
552 |
return verbose; |
|
553 |
} |
|
554 |
||
555 |
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
35520
diff
changeset
|
556 |
InstanceKlass* ik = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); |
1 | 557 |
|
558 |
instanceHandle obj = ik->allocate_instance_handle(CHECK_NH); |
|
559 |
||
560 |
JavaValue result(T_VOID); |
|
561 |
JavaCallArguments args(10); |
|
562 |
args.push_oop(obj); // receiver |
|
563 |
args.push_long(usage.init_size_as_jlong()); // Argument 1 |
|
564 |
args.push_long(usage.used_as_jlong()); // Argument 2 |
|
565 |
args.push_long(usage.committed_as_jlong()); // Argument 3 |
|
566 |
args.push_long(usage.max_size_as_jlong()); // Argument 4 |
|
567 |
||
568 |
JavaCalls::call_special(&result, |
|
569 |
ik, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
570 |
vmSymbols::object_initializer_name(), |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
571 |
vmSymbols::long_long_long_long_void_signature(), |
1 | 572 |
&args, |
573 |
CHECK_NH); |
|
574 |
return obj; |
|
575 |
} |
|
33794 | 576 |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
577 |
// GC manager type depends on the type of Generation. Depending on the space |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
578 |
// availability and vm options the gc uses major gc manager or minor gc |
1 | 579 |
// manager or both. The type of gc manager depends on the generation kind. |
25485
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
580 |
// For DefNew and ParNew generation doing scavenge gc uses minor gc manager (so |
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
581 |
// _fullGC is set to false ) and for other generation kinds doing |
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
582 |
// mark-sweep-compact uses major gc manager (so _fullGC is set to true). |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
583 |
TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { |
1 | 584 |
switch (kind) { |
585 |
case Generation::DefNew: |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
586 |
#if INCLUDE_ALL_GCS |
1 | 587 |
case Generation::ParNew: |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
588 |
#endif // INCLUDE_ALL_GCS |
33794 | 589 |
_fullGC = false; |
1 | 590 |
break; |
591 |
case Generation::MarkSweepCompact: |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
592 |
#if INCLUDE_ALL_GCS |
1 | 593 |
case Generation::ConcurrentMarkSweep: |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
594 |
#endif // INCLUDE_ALL_GCS |
33794 | 595 |
_fullGC = true; |
1 | 596 |
break; |
597 |
default: |
|
33794 | 598 |
_fullGC = false; |
1 | 599 |
assert(false, "Unrecognized gc generation kind."); |
600 |
} |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
601 |
// this has to be called in a stop the world pause and represent |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
602 |
// an entire gc pause, start to finish: |
33794 | 603 |
initialize(_fullGC, cause, true, true, true, true, true, true, true); |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
604 |
} |
33794 | 605 |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
606 |
TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
607 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
608 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
609 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
610 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
611 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
612 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
613 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
614 |
bool countCollection) { |
33794 | 615 |
initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
616 |
recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
617 |
countCollection); |
1 | 618 |
} |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
619 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
620 |
// for a subclass to create then initialize an instance before invoking |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
621 |
// the MemoryService |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
622 |
void TraceMemoryManagerStats::initialize(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
623 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
624 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
625 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
626 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
627 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
628 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
629 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
630 |
bool countCollection) { |
1 | 631 |
_fullGC = fullGC; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
632 |
_recordGCBeginTime = recordGCBeginTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
633 |
_recordPreGCUsage = recordPreGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
634 |
_recordPeakUsage = recordPeakUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
635 |
_recordPostGCUsage = recordPostGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
636 |
_recordAccumulatedGCTime = recordAccumulatedGCTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
637 |
_recordGCEndTime = recordGCEndTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
638 |
_countCollection = countCollection; |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
639 |
_cause = cause; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
640 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
641 |
MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
642 |
_recordPreGCUsage, _recordPeakUsage); |
1 | 643 |
} |
644 |
||
645 |
TraceMemoryManagerStats::~TraceMemoryManagerStats() { |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
646 |
MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
647 |
_recordGCEndTime, _countCollection, _cause); |
1 | 648 |
} |