0N/A/*
1879N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp"
1879N/A#include "runtime/java.hpp"
0N/A
0N/AAdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs,
0N/A size_t min_low_byte_size,
0N/A size_t min_high_byte_size,
0N/A size_t alignment) :
0N/A _reserved_space(rs), _min_low_byte_size(min_low_byte_size),
0N/A _min_high_byte_size(min_high_byte_size), _low(0), _high(0),
0N/A _alignment(alignment) {}
0N/A
0N/A// The maximum byte sizes are for the initial layout of the
0N/A// virtual spaces and are not the limit on the maximum bytes sizes.
0N/Avoid AdjoiningVirtualSpaces::initialize(size_t max_low_byte_size,
0N/A size_t init_low_byte_size,
0N/A size_t init_high_byte_size) {
0N/A
0N/A // The reserved spaces for the two parts of the virtual space.
0N/A ReservedSpace old_rs = _reserved_space.first_part(max_low_byte_size);
0N/A ReservedSpace young_rs = _reserved_space.last_part(max_low_byte_size);
0N/A
0N/A _low = new PSVirtualSpace(old_rs, alignment());
0N/A if (!_low->expand_by(init_low_byte_size)) {
0N/A vm_exit_during_initialization("Could not reserve enough space for "
0N/A "object heap");
0N/A }
0N/A
0N/A _high = new PSVirtualSpaceHighToLow(young_rs, alignment());
0N/A if (!_high->expand_by(init_high_byte_size)) {
0N/A vm_exit_during_initialization("Could not reserve enough space for "
0N/A "object heap");
0N/A }
0N/A}
0N/A
0N/Abool AdjoiningVirtualSpaces::adjust_boundary_up(size_t change_in_bytes) {
0N/A assert(UseAdaptiveSizePolicy && UseAdaptiveGCBoundary, "runtime check");
0N/A size_t actual_change = low()->expand_into(high(), change_in_bytes);
0N/A return actual_change != 0;
0N/A}
0N/A
0N/Abool AdjoiningVirtualSpaces::adjust_boundary_down(size_t change_in_bytes) {
0N/A assert(UseAdaptiveSizePolicy && UseAdaptiveGCBoundary, "runtime check");
0N/A size_t actual_change = high()->expand_into(low(), change_in_bytes);
0N/A return actual_change != 0;
0N/A}