< prev index next >

src/hotspot/share/gc/z/zPhysicalMemory.cpp

Print this page

        

*** 321,341 **** log_info(gc, init)("Uncommit Delay: " UINTX_FORMAT "s", ZUncommitDelay); return true; } ! void ZPhysicalMemoryManager::nmt_commit(const ZPhysicalMemory& pmem, uintptr_t offset) 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 { 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); } } --- 321,339 ---- log_info(gc, init)("Uncommit Delay: " UINTX_FORMAT "s", ZUncommitDelay); return true; } ! 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); MemTracker::record_virtual_memory_commit((void*)addr, size, CALLER_PC); } ! void ZPhysicalMemoryManager::nmt_uncommit(uintptr_t offset, size_t size) const { if (MemTracker::tracking_level() > NMT_minimal) { const uintptr_t addr = ZAddress::marked0(offset); Tracker tracker(Tracker::uncommit); tracker.record((address)addr, size); } }
*** 405,415 **** void ZPhysicalMemoryManager::pretouch_view(uintptr_t addr, size_t size) const { const size_t page_size = ZLargePages::is_explicit() ? ZGranuleSize : os::vm_page_size(); os::pretouch_memory((void*)addr, (void*)(addr + size), page_size); } ! bool ZPhysicalMemoryManager::map_view(const ZPhysicalMemory& pmem, uintptr_t addr) const { size_t size = 0; // Map segments for (uint32_t i = 0; i < pmem.nsegments(); i++) { const ZPhysicalMemorySegment& segment = pmem.segment(i); --- 403,413 ---- void ZPhysicalMemoryManager::pretouch_view(uintptr_t addr, size_t size) const { const size_t page_size = ZLargePages::is_explicit() ? ZGranuleSize : os::vm_page_size(); os::pretouch_memory((void*)addr, (void*)(addr + size), page_size); } ! bool ZPhysicalMemoryManager::map_view(uintptr_t addr, const ZPhysicalMemory& pmem) const { size_t size = 0; // Map segments for (uint32_t i = 0; i < pmem.nsegments(); i++) { const ZPhysicalMemorySegment& segment = pmem.segment(i);
*** 435,446 **** // Success return true; } ! void ZPhysicalMemoryManager::unmap_view(const ZPhysicalMemory& pmem, uintptr_t addr) const { ! _backing.unmap(addr, pmem.size()); } void ZPhysicalMemoryManager::pretouch(uintptr_t offset, size_t size) const { if (ZVerifyViews) { // Pre-touch good view --- 433,444 ---- // Success return true; } ! 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 { if (ZVerifyViews) { // Pre-touch good view
*** 451,510 **** pretouch_view(ZAddress::marked1(offset), size); pretouch_view(ZAddress::remapped(offset), size); } } ! bool ZPhysicalMemoryManager::map(const ZPhysicalMemory& pmem, uintptr_t offset) const { if (ZVerifyViews) { // Map good view ! if (!map_view(pmem, ZAddress::good(offset))) { fatal("Failed to map memory"); } } else { // Map all views ! if (!map_view(pmem, ZAddress::marked0(offset))) { return false; } ! if (!map_view(pmem, ZAddress::marked1(offset))) { ! unmap_view(pmem, ZAddress::marked0(offset)); return false; } ! if (!map_view(pmem, ZAddress::remapped(offset))) { ! unmap_view(pmem, ZAddress::marked1(offset)); ! unmap_view(pmem, ZAddress::marked0(offset)); return false; } } ! nmt_commit(pmem, offset); // Success return true; } ! void ZPhysicalMemoryManager::unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { ! nmt_uncommit(pmem, offset); if (ZVerifyViews) { // Unmap good view ! unmap_view(pmem, ZAddress::good(offset)); } else { // Unmap all views ! unmap_view(pmem, ZAddress::marked0(offset)); ! unmap_view(pmem, ZAddress::marked1(offset)); ! unmap_view(pmem, ZAddress::remapped(offset)); } } ! void ZPhysicalMemoryManager::debug_map(const ZPhysicalMemory& pmem, uintptr_t offset) const { // Map good view assert(ZVerifyViews, "Should be enabled"); ! if (!map_view(pmem, ZAddress::good(offset))) { fatal("Failed to map memory"); } } ! void ZPhysicalMemoryManager::debug_unmap(const ZPhysicalMemory& pmem, uintptr_t offset) const { // Unmap good view assert(ZVerifyViews, "Should be enabled"); ! unmap_view(pmem, ZAddress::good(offset)); } --- 449,510 ---- pretouch_view(ZAddress::marked1(offset), size); pretouch_view(ZAddress::remapped(offset), size); } } ! bool ZPhysicalMemoryManager::map(uintptr_t offset, const ZPhysicalMemory& pmem) const { ! const size_t size = pmem.size(); ! if (ZVerifyViews) { // Map good view ! if (!map_view(ZAddress::good(offset), pmem)) { fatal("Failed to map memory"); } } else { // Map all views ! if (!map_view(ZAddress::marked0(offset), pmem)) { return false; } ! if (!map_view(ZAddress::marked1(offset), pmem)) { ! unmap_view(ZAddress::marked0(offset), size); return false; } ! if (!map_view(ZAddress::remapped(offset), pmem)) { ! unmap_view(ZAddress::marked1(offset), size); ! unmap_view(ZAddress::marked0(offset), size); return false; } } ! nmt_commit(offset, size); // Success return true; } ! void ZPhysicalMemoryManager::unmap(uintptr_t offset, size_t size) const { ! nmt_uncommit(offset, size); if (ZVerifyViews) { // Unmap good view ! unmap_view(ZAddress::good(offset), size); } else { // Unmap all views ! unmap_view(ZAddress::marked0(offset), size); ! unmap_view(ZAddress::marked1(offset), size); ! unmap_view(ZAddress::remapped(offset), size); } } ! void ZPhysicalMemoryManager::debug_map(uintptr_t offset, const ZPhysicalMemory& pmem) const { // Map good view assert(ZVerifyViews, "Should be enabled"); ! if (!map_view(ZAddress::good(offset), pmem)) { fatal("Failed to map memory"); } } ! void ZPhysicalMemoryManager::debug_unmap(uintptr_t offset, size_t size) const { // Unmap good view assert(ZVerifyViews, "Should be enabled"); ! unmap_view(ZAddress::good(offset), size); }
< prev index next >