Path: blob/master/src/hotspot/share/gc/parallel/psMemoryPool.cpp
41149 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#include "precompiled.hpp"25#include "gc/parallel/psMemoryPool.hpp"2627PSGenerationPool::PSGenerationPool(PSOldGen* old_gen,28const char* name,29bool support_usage_threshold) :30CollectedMemoryPool(name, old_gen->capacity_in_bytes(),31old_gen->reserved().byte_size(), support_usage_threshold), _old_gen(old_gen) {32}3334MemoryUsage PSGenerationPool::get_memory_usage() {35size_t maxSize = (available_for_allocation() ? max_size() : 0);36size_t used = used_in_bytes();37size_t committed = _old_gen->capacity_in_bytes();3839return MemoryUsage(initial_size(), used, committed, maxSize);40}4142// The max size of EdenMutableSpacePool =43// max size of the PSYoungGen - capacity of two survivor spaces44//45// Max size of PS eden space is changing due to ergonomic.46// PSYoungGen, PSOldGen, Eden, Survivor spaces are all resizable.47//48EdenMutableSpacePool::EdenMutableSpacePool(PSYoungGen* young_gen,49MutableSpace* space,50const char* name,51bool support_usage_threshold) :52CollectedMemoryPool(name, space->capacity_in_bytes(),53(young_gen->max_gen_size() -54young_gen->from_space()->capacity_in_bytes() -55young_gen->to_space()->capacity_in_bytes()),56support_usage_threshold),57_young_gen(young_gen),58_space(space) {59}6061MemoryUsage EdenMutableSpacePool::get_memory_usage() {62size_t maxSize = (available_for_allocation() ? max_size() : 0);63size_t used = used_in_bytes();64size_t committed = _space->capacity_in_bytes();6566return MemoryUsage(initial_size(), used, committed, maxSize);67}6869// The max size of SurvivorMutableSpacePool =70// current capacity of the from-space71//72// PS from and to survivor spaces could have different sizes.73//74SurvivorMutableSpacePool::SurvivorMutableSpacePool(PSYoungGen* young_gen,75const char* name,76bool support_usage_threshold) :77CollectedMemoryPool(name, young_gen->from_space()->capacity_in_bytes(),78young_gen->from_space()->capacity_in_bytes(),79support_usage_threshold), _young_gen(young_gen) {80}8182MemoryUsage SurvivorMutableSpacePool::get_memory_usage() {83size_t maxSize = (available_for_allocation() ? max_size() : 0);84size_t used = used_in_bytes();85size_t committed = committed_in_bytes();86return MemoryUsage(initial_size(), used, committed, maxSize);87}888990