/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/allocation.hpp"
// ReservedSpace is a data structure for reserving a contiguous address range.
friend class VMStructs;
private:
char* _base;
// The base and size prior to any alignment done by this class; used only on
// systems that cannot release part of a region.
char* _raw_base;
bool _special;
bool _executable;
// ReservedSpace
bool executable);
char* requested_address,
const size_t noaccess_prefix,
bool executable);
// Release virtual address space. If alignment was done, use the saved
// address and size when releasing.
// Release parts of an already-reserved memory region [addr, addr + len) to
// get a new region that has "compound alignment." Return the start of the
// resulting region, or NULL on failure.
//
// The region is logically divided into a prefix and a suffix. The prefix
// starts at the result address, which is aligned to prefix_align. The suffix
// starts at result address + prefix_size, which is aligned to suffix_align.
// The total size of the result region is size prefix_size + suffix_size.
const size_t prefix_size,
const size_t prefix_align,
const size_t suffix_size,
const size_t suffix_align);
// Reserve memory, call align_reserved_region() to alignment it and return the
// result.
const size_t prefix_size,
const size_t prefix_align,
const size_t suffix_size,
const size_t suffix_align);
protected:
// Create protection page at the beginning of the space.
public:
// Constructor
char* requested_address = NULL,
const size_t noaccess_prefix = 0);
char* requested_address,
const size_t noaccess_prefix = 0);
// Accessors
void release();
// Splitting
// These simply call the above using the default alignment.
// Alignment
};
{
}
{
}
// Class encapsulating behavior specific of memory space reserved for Java heap
public:
// Constructor
bool large, char* requested_address);
char* requested_address);
};
// Class encapsulating behavior specific memory space for Code
public:
// Constructor
};
// VirtualSpace is data structure for committing a previously reserved address range in smaller chunks.
friend class VMStructs;
private:
// Reserved area
char* _low_boundary;
char* _high_boundary;
// Committed area
char* _low;
char* _high;
// The entire space has been committed and pinned in memory, no
// os::commit_memory() or os::uncommit_memory().
bool _special;
// Need to know if commit should be executable.
bool _executable;
// MPSS Support
// Each virtualspace region has a lower, middle, and upper region.
// Each region has an end boundary and a high pointer which is the
// high water mark for the last allocated byte.
// The lower and upper unaligned to LargePageSizeInBytes uses default page.
// size. The middle region uses large page size.
char* _lower_high;
char* _middle_high;
char* _upper_high;
char* _lower_high_boundary;
char* _middle_high_boundary;
char* _upper_high_boundary;
// MPSS Accessors
public:
// Committed area
// Reserved area
public:
// Initialization
VirtualSpace();
// Destruction
~VirtualSpace();
// Testers (all sizes are byte sizes)
size_t committed_size() const;
size_t reserved_size() const;
size_t uncommitted_size() const;
bool contains(const void* p) const;
// Operations
// returns true on success, false otherwise
void release();
// Debugging
};
#endif // SHARE_VM_RUNTIME_VIRTUALSPACE_HPP