Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp
38920 views
/*1* Copyright (c) 2003, 2010, 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_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp"26#include "memory/allocation.inline.hpp"27#include "runtime/java.hpp"2829AdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs,30size_t min_low_byte_size,31size_t min_high_byte_size,32size_t alignment) :33_reserved_space(rs), _min_low_byte_size(min_low_byte_size),34_min_high_byte_size(min_high_byte_size), _low(0), _high(0),35_alignment(alignment) {}3637// The maximum byte sizes are for the initial layout of the38// virtual spaces and are not the limit on the maximum bytes sizes.39void AdjoiningVirtualSpaces::initialize(size_t max_low_byte_size,40size_t init_low_byte_size,41size_t init_high_byte_size) {4243// The reserved spaces for the two parts of the virtual space.44ReservedSpace old_rs = _reserved_space.first_part(max_low_byte_size);45ReservedSpace young_rs = _reserved_space.last_part(max_low_byte_size);4647_low = new PSVirtualSpace(old_rs, alignment());48if (!_low->expand_by(init_low_byte_size)) {49vm_exit_during_initialization("Could not reserve enough space for "50"object heap");51}5253_high = new PSVirtualSpaceHighToLow(young_rs, alignment());54if (!_high->expand_by(init_high_byte_size)) {55vm_exit_during_initialization("Could not reserve enough space for "56"object heap");57}58}5960bool AdjoiningVirtualSpaces::adjust_boundary_up(size_t change_in_bytes) {61assert(UseAdaptiveSizePolicy && UseAdaptiveGCBoundary, "runtime check");62size_t actual_change = low()->expand_into(high(), change_in_bytes);63return actual_change != 0;64}6566bool AdjoiningVirtualSpaces::adjust_boundary_down(size_t change_in_bytes) {67assert(UseAdaptiveSizePolicy && UseAdaptiveGCBoundary, "runtime check");68size_t actual_change = high()->expand_into(low(), change_in_bytes);69return actual_change != 0;70}717273