Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp
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#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP25#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP2627#include "gc_implementation/parallelScavenge/psVirtualspace.hpp"282930// Contains two virtual spaces that each can individually span31// most of the reserved region but committed parts of which32// cannot overlap.33//34// +-------+ <--- high_boundary for H35// | |36// | H |37// | |38// | |39// | |40// --------- <--- low for H41// | |42// ========= <--- low_boundary for H, high_boundary for L43// | |44// | |45// | |46// --------- <--- high for L47// | |48// | L |49// | |50// | |51// | |52// +-------+ <--- low_boundary for L53//54// Each virtual space in the AdjoiningVirtualSpaces grows and shrink55// within its reserved region (between the low_boundary and the56// boundary) independently. If L want to grow above its high_boundary,57// then the high_boundary of L and the low_boundary of H must be58// moved up consistently. AdjoiningVirtualSpaces provide the59// interfaces for moving the this boundary.6061class AdjoiningVirtualSpaces {62// space at the high end and the low end, respectively63PSVirtualSpace* _high;64PSVirtualSpace* _low;6566// The reserved space spanned by the two spaces.67ReservedSpace _reserved_space;6869// The minimum byte size for the low space. It will not70// be shrunk below this value.71size_t _min_low_byte_size;72// Same for the high space73size_t _min_high_byte_size;7475const size_t _alignment;7677public:78// Allocates two virtual spaces that will be located at the79// high and low ends. Does no initialization.80AdjoiningVirtualSpaces(ReservedSpace rs,81size_t min_low_byte_size,82size_t min_high_byte_size,83size_t alignment);8485// accessors86PSVirtualSpace* high() { return _high; }87PSVirtualSpace* low() { return _low; }88ReservedSpace reserved_space() { return _reserved_space; }89size_t min_low_byte_size() { return _min_low_byte_size; }90size_t min_high_byte_size() { return _min_high_byte_size; }91size_t alignment() const { return _alignment; }9293// move boundary between the two spaces up94bool adjust_boundary_up(size_t size_in_bytes);95// and down96bool adjust_boundary_down(size_t size_in_bytes);9798// Maximum byte size for the high space.99size_t high_byte_size_limit() {100return _reserved_space.size() - _min_low_byte_size;101}102// Maximum byte size for the low space.103size_t low_byte_size_limit() {104return _reserved_space.size() - _min_high_byte_size;105}106107// Sets the boundaries for the virtual spaces and commits and108// initial size;109void initialize(size_t max_low_byte_size,110size_t init_low_byte_size,111size_t init_high_byte_size);112};113114#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGVIRTUALSPACES_HPP115116117