1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
33 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp" |
33 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp" |
34 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
34 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
35 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" |
35 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp" |
36 #include "gc_implementation/parallelScavenge/psScavenge.hpp" |
36 #include "gc_implementation/parallelScavenge/psScavenge.hpp" |
37 #include "gc_implementation/parallelScavenge/vmPSOperations.hpp" |
37 #include "gc_implementation/parallelScavenge/vmPSOperations.hpp" |
|
38 #include "gc_implementation/shared/gcHeapSummary.hpp" |
|
39 #include "gc_implementation/shared/gcWhen.hpp" |
38 #include "memory/gcLocker.inline.hpp" |
40 #include "memory/gcLocker.inline.hpp" |
39 #include "oops/oop.inline.hpp" |
41 #include "oops/oop.inline.hpp" |
40 #include "runtime/handles.inline.hpp" |
42 #include "runtime/handles.inline.hpp" |
41 #include "runtime/java.hpp" |
43 #include "runtime/java.hpp" |
42 #include "runtime/vmThread.hpp" |
44 #include "runtime/vmThread.hpp" |
640 |
642 |
641 void ParallelScavengeHeap::prepare_for_verify() { |
643 void ParallelScavengeHeap::prepare_for_verify() { |
642 ensure_parsability(false); // no need to retire TLABs for verification |
644 ensure_parsability(false); // no need to retire TLABs for verification |
643 } |
645 } |
644 |
646 |
|
647 PSHeapSummary ParallelScavengeHeap::create_ps_heap_summary() { |
|
648 PSOldGen* old = old_gen(); |
|
649 HeapWord* old_committed_end = (HeapWord*)old->virtual_space()->committed_high_addr(); |
|
650 VirtualSpaceSummary old_summary(old->reserved().start(), old_committed_end, old->reserved().end()); |
|
651 SpaceSummary old_space(old->reserved().start(), old_committed_end, old->used_in_bytes()); |
|
652 |
|
653 PSYoungGen* young = young_gen(); |
|
654 VirtualSpaceSummary young_summary(young->reserved().start(), |
|
655 (HeapWord*)young->virtual_space()->committed_high_addr(), young->reserved().end()); |
|
656 |
|
657 MutableSpace* eden = young_gen()->eden_space(); |
|
658 SpaceSummary eden_space(eden->bottom(), eden->end(), eden->used_in_bytes()); |
|
659 |
|
660 MutableSpace* from = young_gen()->from_space(); |
|
661 SpaceSummary from_space(from->bottom(), from->end(), from->used_in_bytes()); |
|
662 |
|
663 MutableSpace* to = young_gen()->to_space(); |
|
664 SpaceSummary to_space(to->bottom(), to->end(), to->used_in_bytes()); |
|
665 |
|
666 VirtualSpaceSummary heap_summary = create_heap_space_summary(); |
|
667 return PSHeapSummary(heap_summary, used(), old_summary, old_space, young_summary, eden_space, from_space, to_space); |
|
668 } |
|
669 |
645 void ParallelScavengeHeap::print_on(outputStream* st) const { |
670 void ParallelScavengeHeap::print_on(outputStream* st) const { |
646 young_gen()->print_on(st); |
671 young_gen()->print_on(st); |
647 old_gen()->print_on(st); |
672 old_gen()->print_on(st); |
648 MetaspaceAux::print_on(st); |
673 MetaspaceAux::print_on(st); |
649 } |
674 } |
704 "(" SIZE_FORMAT "K)", |
729 "(" SIZE_FORMAT "K)", |
705 prev_used / K, used() / K, capacity() / K); |
730 prev_used / K, used() / K, capacity() / K); |
706 } |
731 } |
707 } |
732 } |
708 |
733 |
|
734 void ParallelScavengeHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) { |
|
735 const PSHeapSummary& heap_summary = create_ps_heap_summary(); |
|
736 const MetaspaceSummary& metaspace_summary = create_metaspace_summary(); |
|
737 gc_tracer->report_gc_heap_summary(when, heap_summary, metaspace_summary); |
|
738 } |
|
739 |
709 ParallelScavengeHeap* ParallelScavengeHeap::heap() { |
740 ParallelScavengeHeap* ParallelScavengeHeap::heap() { |
710 assert(_psh != NULL, "Uninitialized access to ParallelScavengeHeap::heap()"); |
741 assert(_psh != NULL, "Uninitialized access to ParallelScavengeHeap::heap()"); |
711 assert(_psh->kind() == CollectedHeap::ParallelScavengeHeap, "not a parallel scavenge heap"); |
742 assert(_psh->kind() == CollectedHeap::ParallelScavengeHeap, "not a parallel scavenge heap"); |
712 return _psh; |
743 return _psh; |
713 } |
744 } |