orbis: vmem: merge direct regions

merge anonymous regions
This commit is contained in:
DH 2025-11-30 19:33:42 +03:00
parent 659ad9d045
commit 9cb9f4c21e

View file

@ -56,14 +56,24 @@ struct VirtualMemoryAllocation {
isRelated(const VirtualMemoryAllocation &other, rx::AddressRange selfRange,
[[maybe_unused]] rx::AddressRange rightRange) const {
if (flags != other.flags || flagsEx != other.flagsEx ||
prot != other.prot || type != other.type || device != other.device ||
name != other.name) {
prot != other.prot || type != other.type || device != other.device) {
return false;
}
if (!isAllocated()) {
return true;
}
bool isAnon = std::string_view(name).starts_with("anon:");
if (isAnon) {
if (!std::string_view(other.name).starts_with("anon:")) {
return false;
}
} else if (name != other.name) {
return false;
}
if (device == nullptr || flags == orbis::vmem::BlockFlags::PooledMemory) {
return true;
}
@ -450,8 +460,6 @@ std::pair<rx::AddressRange, orbis::ErrorCode> orbis::vmem::mapFile(
return {{}, ErrorCode::INVAL};
}
allocFlags |= AllocationFlags::NoMerge;
if (prot) {
blockFlags |= BlockFlags::Commited;
}