< prev index next >
src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp
Print this page
@@ -40,11 +40,11 @@
bool ZPhysicalMemoryBacking::is_initialized() const {
return true;
}
-void ZPhysicalMemoryBacking::warn_commit_limits(size_t max) const {
+void ZPhysicalMemoryBacking::warn_commit_limits(size_t max_capacity) const {
// Does nothing
}
HANDLE ZPhysicalMemoryBacking::get_handle(uintptr_t offset) const {
HANDLE const handle = _handles.get(offset);
@@ -98,19 +98,27 @@
offset / M, (offset + length) / M, length / M);
return uncommit_from_paging_file(offset, length);
}
-void ZPhysicalMemoryBacking::map(uintptr_t addr, size_t size, size_t offset) const {
+bool ZPhysicalMemoryBacking::map(uintptr_t addr, size_t size, size_t offset) const {
assert(is_aligned(offset, ZGranuleSize), "Misaligned");
assert(is_aligned(addr, ZGranuleSize), "Misaligned");
assert(is_aligned(size, ZGranuleSize), "Misaligned");
for (size_t i = 0; i < size; i += ZGranuleSize) {
HANDLE const handle = get_handle(offset + i);
- ZMapper::map_view_replace_placeholder(handle, 0 /* offset */, addr + i, ZGranuleSize);
+ if (!ZMapper::map_view_replace_placeholder(handle, 0 /* offset */, addr + i, ZGranuleSize)) {
+ // Unmap any successfully mapped granules
+ if (i > 0) {
+ unmap(addr, i - ZGranuleSize);
+ }
+ return false;
+ }
}
+
+ return true;
}
void ZPhysicalMemoryBacking::unmap(uintptr_t addr, size_t size) const {
assert(is_aligned(addr, ZGranuleSize), "Misaligned");
assert(is_aligned(size, ZGranuleSize), "Misaligned");
< prev index next >