Revert "[heap_tracker] Use ankerl map instead of rb tree (#249)" (#382)

This reverts commit c9a3baab5d.

this commit caused issues in ender magnolia or something, need to make
sure I didn't mess up the revert

Reviewed-on: #382
Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@outlook.com>
This commit is contained in:
crueter 2025-09-04 16:04:42 +02:00
parent 0f625fc93c
commit b4b361e5e9
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
11 changed files with 306 additions and 93 deletions

View file

@ -61,7 +61,8 @@ struct Memory::Impl {
}
#ifdef __linux__
buffer.emplace(system.DeviceMemory().buffer);
heap_tracker.emplace(system.DeviceMemory().buffer);
buffer = std::addressof(*heap_tracker);
#else
buffer = std::addressof(system.DeviceMemory().buffer);
#endif
@ -1023,8 +1024,9 @@ struct Memory::Impl {
std::span<Core::GPUDirtyMemoryManager> gpu_dirty_managers;
std::mutex sys_core_guard;
std::optional<Common::HeapTracker> heap_tracker;
#ifdef __linux__
std::optional<Common::HeapTracker> buffer;
Common::HeapTracker* buffer{};
#else
Common::HostMemory* buffer{};
#endif
@ -1228,7 +1230,22 @@ bool Memory::InvalidateNCE(Common::ProcessAddress vaddr, size_t size) {
if (rasterizer) {
impl->InvalidateGPUMemory(ptr, size);
}
#ifdef __linux__
if (!rasterizer && mapped) {
impl->buffer->DeferredMapSeparateHeap(GetInteger(vaddr));
}
#endif
return mapped && ptr != nullptr;
}
bool Memory::InvalidateSeparateHeap(void* fault_address) {
#ifdef __linux__
return impl->buffer->DeferredMapSeparateHeap(static_cast<u8*>(fault_address));
#else
return false;
#endif
}
} // namespace Core::Memory