Wed, 26 Jun 2013 16:58:37 +0200
8013590: NPG: Add a memory pool MXBean for Metaspace
Reviewed-by: jmasa, mgerdin
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP |
stefank@2314 | 26 | #define SHARE_VM_MEMORY_TENUREDGENERATION_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "gc_implementation/shared/cSpaceCounters.hpp" |
stefank@2314 | 29 | #include "gc_implementation/shared/gcStats.hpp" |
stefank@2314 | 30 | #include "gc_implementation/shared/generationCounters.hpp" |
stefank@2314 | 31 | #include "memory/generation.hpp" |
jprovino@4542 | 32 | #include "utilities/macros.hpp" |
stefank@2314 | 33 | |
duke@435 | 34 | // TenuredGeneration models the heap containing old (promoted/tenured) objects. |
duke@435 | 35 | |
duke@435 | 36 | class ParGCAllocBufferWithBOT; |
duke@435 | 37 | |
duke@435 | 38 | class TenuredGeneration: public OneContigSpaceCardGeneration { |
duke@435 | 39 | friend class VMStructs; |
duke@435 | 40 | protected: |
duke@435 | 41 | |
jprovino@4542 | 42 | #if INCLUDE_ALL_GCS |
duke@435 | 43 | // To support parallel promotion: an array of parallel allocation |
duke@435 | 44 | // buffers, one per thread, initially NULL. |
duke@435 | 45 | ParGCAllocBufferWithBOT** _alloc_buffers; |
jprovino@4542 | 46 | #endif // INCLUDE_ALL_GCS |
duke@435 | 47 | |
duke@435 | 48 | // Retire all alloc buffers before a full GC, so that they will be |
duke@435 | 49 | // re-allocated at the start of the next young GC. |
duke@435 | 50 | void retire_alloc_buffers_before_full_gc(); |
duke@435 | 51 | |
duke@435 | 52 | GenerationCounters* _gen_counters; |
duke@435 | 53 | CSpaceCounters* _space_counters; |
duke@435 | 54 | |
duke@435 | 55 | public: |
duke@435 | 56 | TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level, |
duke@435 | 57 | GenRemSet* remset); |
duke@435 | 58 | |
duke@435 | 59 | Generation::Name kind() { return Generation::MarkSweepCompact; } |
duke@435 | 60 | |
duke@435 | 61 | // Printing |
duke@435 | 62 | const char* name() const; |
duke@435 | 63 | const char* short_name() const { return "Tenured"; } |
duke@435 | 64 | bool must_be_youngest() const { return false; } |
duke@435 | 65 | bool must_be_oldest() const { return true; } |
duke@435 | 66 | |
duke@435 | 67 | // Does a "full" (forced) collection invoked on this generation collect |
duke@435 | 68 | // all younger generations as well? Note that this is a |
duke@435 | 69 | // hack to allow the collection of the younger gen first if the flag is |
duke@435 | 70 | // set. This is better than using th policy's should_collect_gen0_first() |
duke@435 | 71 | // since that causes us to do an extra unnecessary pair of restart-&-stop-world. |
duke@435 | 72 | virtual bool full_collects_younger_generations() const { |
duke@435 | 73 | return !CollectGen0First; |
duke@435 | 74 | } |
duke@435 | 75 | |
duke@435 | 76 | virtual void gc_prologue(bool full); |
duke@435 | 77 | virtual void gc_epilogue(bool full); |
duke@435 | 78 | bool should_collect(bool full, |
duke@435 | 79 | size_t word_size, |
duke@435 | 80 | bool is_tlab); |
duke@435 | 81 | |
duke@435 | 82 | virtual void collect(bool full, |
duke@435 | 83 | bool clear_all_soft_refs, |
duke@435 | 84 | size_t size, |
duke@435 | 85 | bool is_tlab); |
jmasa@4900 | 86 | virtual void compute_new_size(); |
duke@435 | 87 | |
jprovino@4542 | 88 | #if INCLUDE_ALL_GCS |
duke@435 | 89 | // Overrides. |
duke@435 | 90 | virtual oop par_promote(int thread_num, |
duke@435 | 91 | oop obj, markOop m, size_t word_sz); |
duke@435 | 92 | virtual void par_promote_alloc_undo(int thread_num, |
duke@435 | 93 | HeapWord* obj, size_t word_sz); |
duke@435 | 94 | virtual void par_promote_alloc_done(int thread_num); |
jprovino@4542 | 95 | #endif // INCLUDE_ALL_GCS |
duke@435 | 96 | |
duke@435 | 97 | // Performance Counter support |
duke@435 | 98 | void update_counters(); |
duke@435 | 99 | |
duke@435 | 100 | // Statistics |
duke@435 | 101 | |
duke@435 | 102 | virtual void update_gc_stats(int level, bool full); |
duke@435 | 103 | |
ysr@2243 | 104 | virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const; |
duke@435 | 105 | |
duke@435 | 106 | void verify_alloc_buffers_clean(); |
duke@435 | 107 | }; |
stefank@2314 | 108 | |
stefank@2314 | 109 | #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP |