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#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP
1879N/A#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP
1879N/A
1879N/A#include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
1879N/A
0N/A
0N/A// Contains two virtual spaces that each can individually span
0N/A// most of the reserved region but committed parts of which
0N/A// cannot overlap.
0N/A//
0N/A// +-------+ <--- high_boundary for H
0N/A// | |
0N/A// | H |
0N/A// | |
0N/A// | |
0N/A// | |
0N/A// --------- <--- low for H
0N/A// | |
0N/A// ========= <--- low_boundary for H, high_boundary for L
0N/A// | |
0N/A// | |
0N/A// | |
0N/A// --------- <--- high for L
0N/A// | |
0N/A// | L |
0N/A// | |
0N/A// | |
0N/A// | |
0N/A// +-------+ <--- low_boundary for L
0N/A//
0N/A// Each virtual space in the AdjoiningVirtualSpaces grows and shrink
0N/A// within its reserved region (between the low_boundary and the
0N/A// boundary) independently. If L want to grow above its high_boundary,
0N/A// then the high_boundary of L and the low_boundary of H must be
0N/A// moved up consistently. AdjoiningVirtualSpaces provide the
0N/A// interfaces for moving the this boundary.
0N/A
0N/Aclass AdjoiningVirtualSpaces {
0N/A // space at the high end and the low end, respectively
0N/A PSVirtualSpace* _high;
0N/A PSVirtualSpace* _low;
0N/A
0N/A // The reserved space spanned by the two spaces.
0N/A ReservedSpace _reserved_space;
0N/A
0N/A // The minimum byte size for the low space. It will not
0N/A // be shrunk below this value.
0N/A size_t _min_low_byte_size;
0N/A // Same for the high space
0N/A size_t _min_high_byte_size;
0N/A
0N/A const size_t _alignment;
0N/A
0N/A public:
0N/A // Allocates two virtual spaces that will be located at the
0N/A // high and low ends. Does no initialization.
0N/A 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
0N/A // accessors
0N/A PSVirtualSpace* high() { return _high; }
0N/A PSVirtualSpace* low() { return _low; }
0N/A ReservedSpace reserved_space() { return _reserved_space; }
0N/A size_t min_low_byte_size() { return _min_low_byte_size; }
0N/A size_t min_high_byte_size() { return _min_high_byte_size; }
0N/A size_t alignment() const { return _alignment; }
0N/A
0N/A // move boundary between the two spaces up
0N/A bool adjust_boundary_up(size_t size_in_bytes);
0N/A // and down
0N/A bool adjust_boundary_down(size_t size_in_bytes);
0N/A
0N/A // Maximum byte size for the high space.
0N/A size_t high_byte_size_limit() {
0N/A return _reserved_space.size() - _min_low_byte_size;
0N/A }
0N/A // Maximum byte size for the low space.
0N/A size_t low_byte_size_limit() {
0N/A return _reserved_space.size() - _min_high_byte_size;
0N/A }
0N/A
0N/A // Sets the boundaries for the virtual spaces and commits and
0N/A // initial size;
0N/A void 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};
1879N/A
1879N/A#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP