Path: blob/master/src/hotspot/os/windows/gc/z/zMapper_windows.hpp
40948 views
/*1* Copyright (c) 2019, 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*/2223#ifndef OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP24#define OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP2526#include "memory/allocation.hpp"27#include "utilities/globalDefinitions.hpp"2829#include <Windows.h>3031class ZMapper : public AllStatic {32private:33// Create paging file mapping34static HANDLE create_paging_file_mapping(size_t size);3536// Commit paging file mapping37static bool commit_paging_file_mapping(HANDLE file_handle, uintptr_t file_offset, size_t size);3839// Map a view anywhere without a placeholder40static uintptr_t map_view_no_placeholder(HANDLE file_handle, uintptr_t file_offset, size_t size);4142// Unmap a view without preserving a placeholder43static void unmap_view_no_placeholder(uintptr_t addr, size_t size);4445// Commit memory covering the given virtual address range46static uintptr_t commit(uintptr_t addr, size_t size);4748public:49// Reserve memory with a placeholder50static uintptr_t reserve(uintptr_t addr, size_t size);5152// Unreserve memory53static void unreserve(uintptr_t addr, size_t size);5455// Create and commit paging file mapping56static HANDLE create_and_commit_paging_file_mapping(size_t size);5758// Close paging file mapping59static void close_paging_file_mapping(HANDLE file_handle);6061// Create a shared AWE section62static HANDLE create_shared_awe_section();6364// Reserve memory attached to the shared AWE section65static uintptr_t reserve_for_shared_awe(HANDLE awe_section, uintptr_t addr, size_t size);6667// Unreserve memory attached to a shared AWE section68static void unreserve_for_shared_awe(uintptr_t addr, size_t size);6970// Split a placeholder71//72// A view can only replace an entire placeholder, so placeholders need to be73// split and coalesced to be the exact size of the new views.74// [addr, addr + size) needs to be a proper sub-placeholder of an existing75// placeholder.76static void split_placeholder(uintptr_t addr, size_t size);7778// Coalesce a placeholder79//80// [addr, addr + size) is the new placeholder. A sub-placeholder needs to81// exist within that range.82static void coalesce_placeholders(uintptr_t addr, size_t size);8384// Map a view of the file handle and replace the placeholder covering the85// given virtual address range86static void map_view_replace_placeholder(HANDLE file_handle, uintptr_t file_offset, uintptr_t addr, size_t size);8788// Unmap the view and reinstate a placeholder covering the given virtual89// address range90static void unmap_view_preserve_placeholder(uintptr_t addr, size_t size);91};9293#endif // OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP949596