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 #include "precompiled.hpp"
25 #include "gc/shared/gcHeapSummary.hpp"
26 #include "gc/shared/suspendibleThreadSet.hpp"
27 #include "gc/z/zCollectedHeap.hpp"
28 #include "gc/z/zGlobals.hpp"
29 #include "gc/z/zHeap.inline.hpp"
30 #include "gc/z/zNMethod.hpp"
31 #include "gc/z/zObjArrayAllocator.hpp"
32 #include "gc/z/zOop.inline.hpp"
33 #include "gc/z/zServiceability.hpp"
34 #include "gc/z/zStat.hpp"
35 #include "gc/z/zUtils.inline.hpp"
36 #include "memory/iterator.hpp"
37 #include "memory/universe.hpp"
38 #include "runtime/mutexLocker.hpp"
39 #include "utilities/align.hpp"
40
41 ZCollectedHeap* ZCollectedHeap::heap() {
42 CollectedHeap* heap = Universe::heap();
43 assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
44 assert(heap->kind() == CollectedHeap::Z, "Invalid name");
45 return (ZCollectedHeap*)heap;
46 }
47
48 ZCollectedHeap::ZCollectedHeap() :
49 _soft_ref_policy(),
50 _barrier_set(),
51 _initialize(&_barrier_set),
52 _heap(),
53 _director(new ZDirector()),
54 _driver(new ZDriver()),
55 _uncommitter(new ZUncommitter()),
56 _stat(new ZStat()),
57 _runtime_workers() {}
58
59 CollectedHeap::Name ZCollectedHeap::kind() const {
60 return CollectedHeap::Z;
61 }
62
63 const char* ZCollectedHeap::name() const {
64 return ZName;
65 }
66
67 jint ZCollectedHeap::initialize() {
68 if (!_heap.is_initialized()) {
69 return JNI_ENOMEM;
70 }
71
72 Universe::calculate_verify_data((HeapWord*)0, (HeapWord*)UINTPTR_MAX);
73
74 return JNI_OK;
75 }
76
77 void ZCollectedHeap::initialize_serviceability() {
78 _heap.serviceability_initialize();
79 }
80
81 void ZCollectedHeap::stop() {
82 _director->stop();
83 _driver->stop();
84 _uncommitter->stop();
85 _stat->stop();
86 }
87
88 SoftRefPolicy* ZCollectedHeap::soft_ref_policy() {
89 return &_soft_ref_policy;
90 }
91
92 size_t ZCollectedHeap::max_capacity() const {
93 return _heap.max_capacity();
94 }
95
96 size_t ZCollectedHeap::capacity() const {
97 return _heap.capacity();
98 }
99
100 size_t ZCollectedHeap::used() const {
101 return _heap.used();
102 }
103
261
262 void ZCollectedHeap::flush_nmethod(nmethod* nm) {
263 ZNMethod::flush_nmethod(nm);
264 }
265
266 void ZCollectedHeap::verify_nmethod(nmethod* nm) {
267 // Does nothing
268 }
269
270 WorkGang* ZCollectedHeap::get_safepoint_workers() {
271 return _runtime_workers.workers();
272 }
273
274 jlong ZCollectedHeap::millis_since_last_gc() {
275 return ZStatCycle::time_since_last() / MILLIUNITS;
276 }
277
278 void ZCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
279 tc->do_thread(_director);
280 tc->do_thread(_driver);
281 tc->do_thread(_uncommitter);
282 tc->do_thread(_stat);
283 _heap.worker_threads_do(tc);
284 _runtime_workers.threads_do(tc);
285 }
286
287 VirtualSpaceSummary ZCollectedHeap::create_heap_space_summary() {
288 return VirtualSpaceSummary((HeapWord*)0, (HeapWord*)capacity(), (HeapWord*)max_capacity());
289 }
290
291 void ZCollectedHeap::safepoint_synchronize_begin() {
292 SuspendibleThreadSet::synchronize();
293 }
294
295 void ZCollectedHeap::safepoint_synchronize_end() {
296 SuspendibleThreadSet::desynchronize();
297 }
298
299 void ZCollectedHeap::prepare_for_verify() {
300 // Does nothing
312 st->print_cr( " GlobalSeqNum: %u", ZGlobalSeqNum);
313 st->print_cr( " Offset Max: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZAddressOffsetMax, ZAddressOffsetMax);
314 st->print_cr( " Page Size Small: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZPageSizeSmall, ZPageSizeSmall);
315 st->print_cr( " Page Size Medium: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZPageSizeMedium, ZPageSizeMedium);
316 st->print_cr( "Metadata Bits");
317 st->print_cr( " Good: " PTR_FORMAT, ZAddressGoodMask);
318 st->print_cr( " Bad: " PTR_FORMAT, ZAddressBadMask);
319 st->print_cr( " WeakBad: " PTR_FORMAT, ZAddressWeakBadMask);
320 st->print_cr( " Marked: " PTR_FORMAT, ZAddressMetadataMarked);
321 st->print_cr( " Remapped: " PTR_FORMAT, ZAddressMetadataRemapped);
322 }
323
324 void ZCollectedHeap::print_extended_on(outputStream* st) const {
325 _heap.print_extended_on(st);
326 }
327
328 void ZCollectedHeap::print_gc_threads_on(outputStream* st) const {
329 _director->print_on(st);
330 st->cr();
331 _driver->print_on(st);
332 st->cr();
333 _uncommitter->print_on(st);
334 st->cr();
335 _stat->print_on(st);
336 st->cr();
337 _heap.print_worker_threads_on(st);
338 _runtime_workers.print_threads_on(st);
339 }
340
341 void ZCollectedHeap::print_tracing_info() const {
342 // Does nothing
343 }
344
345 bool ZCollectedHeap::print_location(outputStream* st, void* addr) const {
346 return _heap.print_location(st, (uintptr_t)addr);
347 }
348
349 void ZCollectedHeap::verify(VerifyOption option /* ignored */) {
350 _heap.verify();
351 }
|
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 #include "precompiled.hpp"
25 #include "gc/shared/gcHeapSummary.hpp"
26 #include "gc/shared/suspendibleThreadSet.hpp"
27 #include "gc/z/zCollectedHeap.hpp"
28 #include "gc/z/zDirector.hpp"
29 #include "gc/z/zDriver.hpp"
30 #include "gc/z/zGlobals.hpp"
31 #include "gc/z/zHeap.inline.hpp"
32 #include "gc/z/zNMethod.hpp"
33 #include "gc/z/zObjArrayAllocator.hpp"
34 #include "gc/z/zOop.inline.hpp"
35 #include "gc/z/zServiceability.hpp"
36 #include "gc/z/zStat.hpp"
37 #include "gc/z/zUncommitter.hpp"
38 #include "gc/z/zUnmapper.hpp"
39 #include "gc/z/zUtils.inline.hpp"
40 #include "memory/iterator.hpp"
41 #include "memory/universe.hpp"
42 #include "runtime/mutexLocker.hpp"
43 #include "utilities/align.hpp"
44
45 ZCollectedHeap* ZCollectedHeap::heap() {
46 CollectedHeap* heap = Universe::heap();
47 assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
48 assert(heap->kind() == CollectedHeap::Z, "Invalid name");
49 return (ZCollectedHeap*)heap;
50 }
51
52 ZCollectedHeap::ZCollectedHeap() :
53 _soft_ref_policy(),
54 _barrier_set(),
55 _initialize(&_barrier_set),
56 _heap(),
57 _director(new ZDirector()),
58 _driver(new ZDriver()),
59 _unmapper(new ZUnmapper()),
60 _uncommitter(new ZUncommitter()),
61 _stat(new ZStat()),
62 _runtime_workers() {}
63
64 CollectedHeap::Name ZCollectedHeap::kind() const {
65 return CollectedHeap::Z;
66 }
67
68 const char* ZCollectedHeap::name() const {
69 return ZName;
70 }
71
72 jint ZCollectedHeap::initialize() {
73 if (!_heap.is_initialized()) {
74 return JNI_ENOMEM;
75 }
76
77 Universe::calculate_verify_data((HeapWord*)0, (HeapWord*)UINTPTR_MAX);
78
79 return JNI_OK;
80 }
81
82 void ZCollectedHeap::initialize_serviceability() {
83 _heap.serviceability_initialize();
84 }
85
86 void ZCollectedHeap::stop() {
87 _director->stop();
88 _driver->stop();
89 _unmapper->stop();
90 _uncommitter->stop();
91 _stat->stop();
92 }
93
94 SoftRefPolicy* ZCollectedHeap::soft_ref_policy() {
95 return &_soft_ref_policy;
96 }
97
98 size_t ZCollectedHeap::max_capacity() const {
99 return _heap.max_capacity();
100 }
101
102 size_t ZCollectedHeap::capacity() const {
103 return _heap.capacity();
104 }
105
106 size_t ZCollectedHeap::used() const {
107 return _heap.used();
108 }
109
267
268 void ZCollectedHeap::flush_nmethod(nmethod* nm) {
269 ZNMethod::flush_nmethod(nm);
270 }
271
272 void ZCollectedHeap::verify_nmethod(nmethod* nm) {
273 // Does nothing
274 }
275
276 WorkGang* ZCollectedHeap::get_safepoint_workers() {
277 return _runtime_workers.workers();
278 }
279
280 jlong ZCollectedHeap::millis_since_last_gc() {
281 return ZStatCycle::time_since_last() / MILLIUNITS;
282 }
283
284 void ZCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
285 tc->do_thread(_director);
286 tc->do_thread(_driver);
287 tc->do_thread(_unmapper);
288 tc->do_thread(_uncommitter);
289 tc->do_thread(_stat);
290 _heap.worker_threads_do(tc);
291 _runtime_workers.threads_do(tc);
292 }
293
294 VirtualSpaceSummary ZCollectedHeap::create_heap_space_summary() {
295 return VirtualSpaceSummary((HeapWord*)0, (HeapWord*)capacity(), (HeapWord*)max_capacity());
296 }
297
298 void ZCollectedHeap::safepoint_synchronize_begin() {
299 SuspendibleThreadSet::synchronize();
300 }
301
302 void ZCollectedHeap::safepoint_synchronize_end() {
303 SuspendibleThreadSet::desynchronize();
304 }
305
306 void ZCollectedHeap::prepare_for_verify() {
307 // Does nothing
319 st->print_cr( " GlobalSeqNum: %u", ZGlobalSeqNum);
320 st->print_cr( " Offset Max: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZAddressOffsetMax, ZAddressOffsetMax);
321 st->print_cr( " Page Size Small: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZPageSizeSmall, ZPageSizeSmall);
322 st->print_cr( " Page Size Medium: " SIZE_FORMAT_W(-15) " (" PTR_FORMAT ")", ZPageSizeMedium, ZPageSizeMedium);
323 st->print_cr( "Metadata Bits");
324 st->print_cr( " Good: " PTR_FORMAT, ZAddressGoodMask);
325 st->print_cr( " Bad: " PTR_FORMAT, ZAddressBadMask);
326 st->print_cr( " WeakBad: " PTR_FORMAT, ZAddressWeakBadMask);
327 st->print_cr( " Marked: " PTR_FORMAT, ZAddressMetadataMarked);
328 st->print_cr( " Remapped: " PTR_FORMAT, ZAddressMetadataRemapped);
329 }
330
331 void ZCollectedHeap::print_extended_on(outputStream* st) const {
332 _heap.print_extended_on(st);
333 }
334
335 void ZCollectedHeap::print_gc_threads_on(outputStream* st) const {
336 _director->print_on(st);
337 st->cr();
338 _driver->print_on(st);
339 st->cr();
340 _unmapper->print_on(st);
341 st->cr();
342 _uncommitter->print_on(st);
343 st->cr();
344 _stat->print_on(st);
345 st->cr();
346 _heap.print_worker_threads_on(st);
347 _runtime_workers.print_threads_on(st);
348 }
349
350 void ZCollectedHeap::print_tracing_info() const {
351 // Does nothing
352 }
353
354 bool ZCollectedHeap::print_location(outputStream* st, void* addr) const {
355 return _heap.print_location(st, (uintptr_t)addr);
356 }
357
358 void ZCollectedHeap::verify(VerifyOption option /* ignored */) {
359 _heap.verify();
360 }
|