Path: blob/master/src/hotspot/share/gc/parallel/psMemoryPool.hpp
41152 views
/*1* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_GC_PARALLEL_PSMEMORYPOOL_HPP25#define SHARE_GC_PARALLEL_PSMEMORYPOOL_HPP2627#include "gc/parallel/mutableSpace.hpp"28#include "gc/parallel/psOldGen.hpp"29#include "gc/parallel/psYoungGen.hpp"30#include "services/memoryPool.hpp"31#include "services/memoryUsage.hpp"3233class PSGenerationPool : public CollectedMemoryPool {34private:35PSOldGen* _old_gen;3637public:38PSGenerationPool(PSOldGen* pool, const char* name, bool support_usage_threshold);3940MemoryUsage get_memory_usage();41size_t used_in_bytes() { return _old_gen->used_in_bytes(); }42size_t max_size() const { return _old_gen->reserved().byte_size(); }43};4445class EdenMutableSpacePool : public CollectedMemoryPool {46private:47PSYoungGen* _young_gen;48MutableSpace* _space;4950public:51EdenMutableSpacePool(PSYoungGen* young_gen,52MutableSpace* space,53const char* name,54bool support_usage_threshold);5556MutableSpace* space() { return _space; }57MemoryUsage get_memory_usage();58size_t used_in_bytes() { return space()->used_in_bytes(); }59size_t max_size() const {60// Eden's max_size = max_size of Young Gen - the current committed size of survivor spaces61return _young_gen->max_gen_size() -62_young_gen->from_space()->capacity_in_bytes() -63_young_gen->to_space()->capacity_in_bytes();64}65};6667class SurvivorMutableSpacePool : public CollectedMemoryPool {68private:69PSYoungGen* _young_gen;7071public:72SurvivorMutableSpacePool(PSYoungGen* young_gen,73const char* name,74bool support_usage_threshold);7576MemoryUsage get_memory_usage();7778size_t used_in_bytes() {79return _young_gen->from_space()->used_in_bytes();80}81size_t committed_in_bytes() {82return _young_gen->from_space()->capacity_in_bytes();83}84size_t max_size() const {85// Return current committed size of the from-space86return _young_gen->from_space()->capacity_in_bytes();87}88};8990#endif // SHARE_GC_PARALLEL_PSMEMORYPOOL_HPP919293