--- old/src/hotspot/share/gc/z/zPhysicalMemory.cpp 2020-06-01 07:12:30.461977542 +0200 +++ new/src/hotspot/share/gc/z/zPhysicalMemory.cpp 2020-06-01 07:12:30.191968841 +0200 @@ -323,17 +323,15 @@ return true; } -void ZPhysicalMemoryManager::nmt_commit(const ZPhysicalMemory& pmem, uintptr_t offset) const { +void ZPhysicalMemoryManager::nmt_commit(uintptr_t offset, size_t size) const { // From an NMT point of view we treat the first heap view (marked0) as committed const uintptr_t addr = ZAddress::marked0(offset); - const size_t size = pmem.size(); MemTracker::record_virtual_memory_commit((void*)addr, size, CALLER_PC); } -void ZPhysicalMemoryManager::nmt_uncommit(const ZPhysicalMemory& pmem, uintptr_t offset) const { +void ZPhysicalMemoryManager::nmt_uncommit(uintptr_t offset, size_t size) const { if (MemTracker::tracking_level() > NMT_minimal) { const uintptr_t addr = ZAddress::marked0(offset); - const size_t size = pmem.size(); Tracker tracker(Tracker::uncommit); tracker.record((address)addr, size); } @@ -407,7 +405,7 @@ os::pretouch_memory((void*)addr, (void*)(addr + size), page_size); } -bool ZPhysicalMemoryManager::map_view(const ZPhysicalMemory& pmem, uintptr_t addr) const { +bool ZPhysicalMemoryManager::map_view(uintptr_t addr, const ZPhysicalMemory& pmem) const { size_t size = 0; // Map segments @@ -437,8 +435,8 @@ return true; } -void ZPhysicalMemoryManager::unmap_view(const ZPhysicalMemory& pmem, uintptr_t addr) const { - _backing.unmap(addr, pmem.size()); +void ZPhysicalMemoryManager::unmap_view(uintptr_t addr, size_t size) const { + _backing.unmap(addr, size); } void ZPhysicalMemoryManager::pretouch(uintptr_t offset, size_t size) const { @@ -453,58 +451,60 @@ } } -bool ZPhysicalMemoryManager::map(const ZPhysicalMemory& pmem, uintptr_t offset) const { +bool ZPhysicalMemoryManager::map(uintptr_t offset, const ZPhysicalMemory& pmem) const { + const size_t size = pmem.size(); + if (ZVerifyViews) { // Map good view - if (!map_view(pmem, ZAddress::good(offset))) { + if (!map_view(ZAddress::good(offset), pmem)) { fatal("Failed to map memory"); } } else { // Map all views - if (!map_view(pmem, ZAddress::marked0(offset))) { + if (!map_view(ZAddress::marked0(offset), pmem)) { return false; } - if (!map_view(pmem, ZAddress::marked1(offset))) { - unmap_view(pmem, ZAddress::marked0(offset)); + if (!map_view(ZAddress::marked1(offset), pmem)) { + unmap_view(ZAddress::marked0(offset), size); return false; } - if (!map_view(pmem, ZAddress::remapped(offset))) { - unmap_view(pmem, ZAddress::marked1(offset)); - unmap_view(pmem, ZAddress::marked0(offset)); + if (!map_view(ZAddress::remapped(offset), pmem)) { + unmap_view(ZAddress::marked1(offset), size); + unmap_view(ZAddress::marked0(offset), size); return false; } } - nmt_commit(pmem, offset); + nmt_commit(offset, size); // Success return true; } -void ZPhysicalMemoryManager::unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { - nmt_uncommit(pmem, offset); +void ZPhysicalMemoryManager::unmap(uintptr_t offset, size_t size) const { + nmt_uncommit(offset, size); if (ZVerifyViews) { // Unmap good view - unmap_view(pmem, ZAddress::good(offset)); + unmap_view(ZAddress::good(offset), size); } else { // Unmap all views - unmap_view(pmem, ZAddress::marked0(offset)); - unmap_view(pmem, ZAddress::marked1(offset)); - unmap_view(pmem, ZAddress::remapped(offset)); + unmap_view(ZAddress::marked0(offset), size); + unmap_view(ZAddress::marked1(offset), size); + unmap_view(ZAddress::remapped(offset), size); } } -void ZPhysicalMemoryManager::debug_map(const ZPhysicalMemory& pmem, uintptr_t offset) const { +void ZPhysicalMemoryManager::debug_map(uintptr_t offset, const ZPhysicalMemory& pmem) const { // Map good view assert(ZVerifyViews, "Should be enabled"); - if (!map_view(pmem, ZAddress::good(offset))) { + if (!map_view(ZAddress::good(offset), pmem)) { fatal("Failed to map memory"); } } -void ZPhysicalMemoryManager::debug_unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { +void ZPhysicalMemoryManager::debug_unmap(uintptr_t offset, size_t size) const { // Unmap good view assert(ZVerifyViews, "Should be enabled"); - unmap_view(pmem, ZAddress::good(offset)); + unmap_view(ZAddress::good(offset), size); }