#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/Support/WindowsError.h"
+#include <algorithm>
+
#if defined(LLVM_ON_UNIX) && !defined(__ANDROID__)
#include <fcntl.h>
#include <sys/mman.h>
void SharedMemoryMapper::initialize(MemoryMapper::AllocInfo &AI,
OnInitializedFunction OnInitialized) {
- auto Reservation = Reservations.find(AI.MappingBase);
- assert(Reservation != Reservations.end() &&
+ auto Reservation = std::lower_bound(
+ Reservations.rbegin(), Reservations.rend(), AI.MappingBase,
+ [](const auto &A, const auto &B) { return A.first > B; });
+ assert(Reservation != Reservations.rend() &&
"Attempt to initialize unreserved range");
tpctypes::SharedMemoryFinalizeRequest FR;
OnInitialized(std::move(Result));
},
- SAs.Instance, AI.MappingBase, std::move(FR));
+ SAs.Instance, Reservation->first, std::move(FR));
}
void SharedMemoryMapper::deinitialize(
UnmapViewOfFile(R.second.LocalAddr);
#endif
-
}
}