< prev index next >

src/hotspot/os/windows/gc/z/zMapper_windows.cpp

Print this page




 206     MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER // dwFreeType
 207     );
 208 
 209   if (!res) {
 210     fatal_error("Failed to split placeholder", addr, size);
 211   }
 212 }
 213 
 214 void ZMapper::coalesce_placeholders(uintptr_t addr, size_t size) {
 215   const bool res = VirtualFree(
 216     (void*)addr,                            // lpAddress
 217     size,                                   // dwSize
 218     MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS // dwFreeType
 219     );
 220 
 221   if (!res) {
 222     fatal_error("Failed to coalesce placeholders", addr, size);
 223   }
 224 }
 225 
 226 void ZMapper::map_view_replace_placeholder(HANDLE file_handle, uintptr_t file_offset, uintptr_t addr, size_t size) {
 227   void* const res = ZSyscall::MapViewOfFile3(
 228     file_handle,             // FileMapping
 229     GetCurrentProcess(),     // ProcessHandle
 230     (void*)addr,             // BaseAddress
 231     file_offset,             // Offset
 232     size,                    // ViewSize
 233     MEM_REPLACE_PLACEHOLDER, // AllocationType
 234     PAGE_READWRITE,          // PageProtection
 235     NULL,                    // ExtendedParameters
 236     0                        // ParameterCount
 237     );
 238 
 239   if (res == NULL) {
 240     fatal_error("Failed to map memory", addr, size);

 241   }


 242 }
 243 
 244 void ZMapper::unmap_view_preserve_placeholder(uintptr_t addr, size_t size) {
 245   const bool res = ZSyscall::UnmapViewOfFile2(
 246     GetCurrentProcess(),     // ProcessHandle
 247     (void*)addr,             // BaseAddress
 248     MEM_PRESERVE_PLACEHOLDER // UnmapFlags
 249     );
 250 
 251   if (!res) {
 252     fatal_error("Failed to unmap memory", addr, size);
 253   }
 254 }


 206     MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER // dwFreeType
 207     );
 208 
 209   if (!res) {
 210     fatal_error("Failed to split placeholder", addr, size);
 211   }
 212 }
 213 
 214 void ZMapper::coalesce_placeholders(uintptr_t addr, size_t size) {
 215   const bool res = VirtualFree(
 216     (void*)addr,                            // lpAddress
 217     size,                                   // dwSize
 218     MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS // dwFreeType
 219     );
 220 
 221   if (!res) {
 222     fatal_error("Failed to coalesce placeholders", addr, size);
 223   }
 224 }
 225 
 226 bool ZMapper::map_view_replace_placeholder(HANDLE file_handle, uintptr_t file_offset, uintptr_t addr, size_t size) {
 227   void* const res = ZSyscall::MapViewOfFile3(
 228     file_handle,             // FileMapping
 229     GetCurrentProcess(),     // ProcessHandle
 230     (void*)addr,             // BaseAddress
 231     file_offset,             // Offset
 232     size,                    // ViewSize
 233     MEM_REPLACE_PLACEHOLDER, // AllocationType
 234     PAGE_READWRITE,          // PageProtection
 235     NULL,                    // ExtendedParameters
 236     0                        // ParameterCount
 237     );
 238 
 239   if (res == NULL) {
 240     log_error(gc)("Failed to map memory (%d)", GetLastError());
 241     return false;
 242   }
 243 
 244   return true;
 245 }
 246 
 247 void ZMapper::unmap_view_preserve_placeholder(uintptr_t addr, size_t size) {
 248   const bool res = ZSyscall::UnmapViewOfFile2(
 249     GetCurrentProcess(),     // ProcessHandle
 250     (void*)addr,             // BaseAddress
 251     MEM_PRESERVE_PLACEHOLDER // UnmapFlags
 252     );
 253 
 254   if (!res) {
 255     log_error(gc)("Failed to unmap memory (%d)", GetLastError());
 256   }
 257 }
< prev index next >