1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/memory/tenuredGeneration.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,109 @@ 1.4 +/* 1.5 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_MEMORY_TENUREDGENERATION_HPP 1.29 +#define SHARE_VM_MEMORY_TENUREDGENERATION_HPP 1.30 + 1.31 +#include "gc_implementation/shared/cSpaceCounters.hpp" 1.32 +#include "gc_implementation/shared/gcStats.hpp" 1.33 +#include "gc_implementation/shared/generationCounters.hpp" 1.34 +#include "memory/generation.hpp" 1.35 +#include "utilities/macros.hpp" 1.36 + 1.37 +// TenuredGeneration models the heap containing old (promoted/tenured) objects. 1.38 + 1.39 +class ParGCAllocBufferWithBOT; 1.40 + 1.41 +class TenuredGeneration: public OneContigSpaceCardGeneration { 1.42 + friend class VMStructs; 1.43 + protected: 1.44 + 1.45 +#if INCLUDE_ALL_GCS 1.46 + // To support parallel promotion: an array of parallel allocation 1.47 + // buffers, one per thread, initially NULL. 1.48 + ParGCAllocBufferWithBOT** _alloc_buffers; 1.49 +#endif // INCLUDE_ALL_GCS 1.50 + 1.51 + // Retire all alloc buffers before a full GC, so that they will be 1.52 + // re-allocated at the start of the next young GC. 1.53 + void retire_alloc_buffers_before_full_gc(); 1.54 + 1.55 + GenerationCounters* _gen_counters; 1.56 + CSpaceCounters* _space_counters; 1.57 + 1.58 + public: 1.59 + TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level, 1.60 + GenRemSet* remset); 1.61 + 1.62 + Generation::Name kind() { return Generation::MarkSweepCompact; } 1.63 + 1.64 + // Printing 1.65 + const char* name() const; 1.66 + const char* short_name() const { return "Tenured"; } 1.67 + bool must_be_youngest() const { return false; } 1.68 + bool must_be_oldest() const { return true; } 1.69 + 1.70 + // Does a "full" (forced) collection invoked on this generation collect 1.71 + // all younger generations as well? Note that this is a 1.72 + // hack to allow the collection of the younger gen first if the flag is 1.73 + // set. This is better than using th policy's should_collect_gen0_first() 1.74 + // since that causes us to do an extra unnecessary pair of restart-&-stop-world. 1.75 + virtual bool full_collects_younger_generations() const { 1.76 + return !CollectGen0First; 1.77 + } 1.78 + 1.79 + virtual void gc_prologue(bool full); 1.80 + virtual void gc_epilogue(bool full); 1.81 + bool should_collect(bool full, 1.82 + size_t word_size, 1.83 + bool is_tlab); 1.84 + 1.85 + virtual void collect(bool full, 1.86 + bool clear_all_soft_refs, 1.87 + size_t size, 1.88 + bool is_tlab); 1.89 + virtual void compute_new_size(); 1.90 + 1.91 +#if INCLUDE_ALL_GCS 1.92 + // Overrides. 1.93 + virtual oop par_promote(int thread_num, 1.94 + oop obj, markOop m, size_t word_sz); 1.95 + virtual void par_promote_alloc_undo(int thread_num, 1.96 + HeapWord* obj, size_t word_sz); 1.97 + virtual void par_promote_alloc_done(int thread_num); 1.98 +#endif // INCLUDE_ALL_GCS 1.99 + 1.100 + // Performance Counter support 1.101 + void update_counters(); 1.102 + 1.103 + // Statistics 1.104 + 1.105 + virtual void update_gc_stats(int level, bool full); 1.106 + 1.107 + virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const; 1.108 + 1.109 + void verify_alloc_buffers_clean(); 1.110 +}; 1.111 + 1.112 +#endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP