Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/services/psMemoryPool.cpp
32285 views
/*1* Copyright (c) 2007, 2012, 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#include "precompiled.hpp"25#include "classfile/systemDictionary.hpp"26#include "classfile/vmSymbols.hpp"27#include "oops/oop.inline.hpp"28#include "runtime/handles.inline.hpp"29#include "runtime/javaCalls.hpp"30#include "services/lowMemoryDetector.hpp"31#include "services/management.hpp"32#include "services/memoryManager.hpp"33#include "services/psMemoryPool.hpp"3435PSGenerationPool::PSGenerationPool(PSOldGen* gen,36const char* name,37PoolType type,38bool support_usage_threshold) :39CollectedMemoryPool(name, type, gen->capacity_in_bytes(),40gen->reserved().byte_size(), support_usage_threshold), _gen(gen) {41}4243MemoryUsage PSGenerationPool::get_memory_usage() {44size_t maxSize = (available_for_allocation() ? max_size() : 0);45size_t used = used_in_bytes();46size_t committed = _gen->capacity_in_bytes();4748return MemoryUsage(initial_size(), used, committed, maxSize);49}5051// The max size of EdenMutableSpacePool =52// max size of the PSYoungGen - capacity of two survivor spaces53//54// Max size of PS eden space is changing due to ergonomic.55// PSYoungGen, PSOldGen, Eden, Survivor spaces are all resizable.56//57EdenMutableSpacePool::EdenMutableSpacePool(PSYoungGen* gen,58MutableSpace* space,59const char* name,60PoolType type,61bool support_usage_threshold) :62CollectedMemoryPool(name, type, space->capacity_in_bytes(),63(gen->max_size() - gen->from_space()->capacity_in_bytes() - gen->to_space()->capacity_in_bytes()),64support_usage_threshold),65_gen(gen), _space(space) {66}6768MemoryUsage EdenMutableSpacePool::get_memory_usage() {69size_t maxSize = (available_for_allocation() ? max_size() : 0);70size_t used = used_in_bytes();71size_t committed = _space->capacity_in_bytes();7273return MemoryUsage(initial_size(), used, committed, maxSize);74}7576// The max size of SurvivorMutableSpacePool =77// current capacity of the from-space78//79// PS from and to survivor spaces could have different sizes.80//81SurvivorMutableSpacePool::SurvivorMutableSpacePool(PSYoungGen* gen,82const char* name,83PoolType type,84bool support_usage_threshold) :85CollectedMemoryPool(name, type, gen->from_space()->capacity_in_bytes(),86gen->from_space()->capacity_in_bytes(),87support_usage_threshold), _gen(gen) {88}8990MemoryUsage SurvivorMutableSpacePool::get_memory_usage() {91size_t maxSize = (available_for_allocation() ? max_size() : 0);92size_t used = used_in_bytes();93size_t committed = committed_in_bytes();94return MemoryUsage(initial_size(), used, committed, maxSize);95}969798