1 /* 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. 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 * 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 25 #ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP 26 #define SHARE_VM_MEMORY_TENUREDGENERATION_HPP 27 28 #include "gc_implementation/shared/cSpaceCounters.hpp" 29 #include "gc_implementation/shared/gcStats.hpp" 30 #include "gc_implementation/shared/generationCounters.hpp" 31 #include "memory/generation.hpp" 32 #include "utilities/macros.hpp" 33 34 // TenuredGeneration models the heap containing old (promoted/tenured) objects. 35 36 class TenuredGeneration: public OneContigSpaceCardGeneration { 37 friend class VMStructs; 38 protected: 39 GenerationCounters* _gen_counters; 40 CSpaceCounters* _space_counters; 41 42 public: 43 TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level, 44 GenRemSet* remset); 45 46 Generation::Name kind() { return Generation::MarkSweepCompact; } 47 48 // Printing 49 const char* name() const { return "tenured generation"; } 50 const char* short_name() const { return "Tenured"; } 51 52 // Does a "full" (forced) collection invoked on this generation collect 53 // all younger generations as well? Note that this is a 54 // hack to allow the collection of the younger gen first if the flag is 55 // set. 56 virtual bool full_collects_younger_generations() const { 57 return !ScavengeBeforeFullGC; 58 } 59 60 virtual void gc_prologue(bool full); 61 bool should_collect(bool full, 62 size_t word_size, 63 bool is_tlab); 64 65 virtual void compute_new_size(); 66 67 // Performance Counter support 68 void update_counters(); 69 70 // Statistics 71 72 virtual void update_gc_stats(int level, bool full); 73 74 virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const; 75 }; 76 77 #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP