Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/ExecutionEngine/Orc/MemoryMapper.h
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | private: | ||||
}; | }; | ||||
using ReservationMap = DenseMap<void *, Reservation>; | using ReservationMap = DenseMap<void *, Reservation>; | ||||
std::mutex Mutex; | std::mutex Mutex; | ||||
ReservationMap Reservations; | ReservationMap Reservations; | ||||
AllocationMap Allocations; | AllocationMap Allocations; | ||||
}; | }; | ||||
class SharedMemoryMapper final : public MemoryMapper { | |||||
public: | |||||
struct SymbolAddrs { | |||||
ExecutorAddr Instance; | |||||
ExecutorAddr Reserve; | |||||
ExecutorAddr Initialize; | |||||
ExecutorAddr Deinitialize; | |||||
ExecutorAddr Release; | |||||
}; | |||||
SharedMemoryMapper(ExecutorProcessControl &EPC, SymbolAddrs SAs) | |||||
: EPC(EPC), SAs(SAs) {} | |||||
void reserve(size_t NumBytes, OnReservedFunction OnReserved) override; | |||||
char *prepare(ExecutorAddr Addr, size_t ContentSize) override; | |||||
void initialize(AllocInfo &AI, OnInitializedFunction OnInitialized) override; | |||||
void deinitialize(ArrayRef<ExecutorAddr> Allocations, | |||||
OnDeinitializedFunction OnDeInitialized) override; | |||||
void release(ArrayRef<ExecutorAddr> Reservations, | |||||
OnReleasedFunction OnRelease) override; | |||||
~SharedMemoryMapper() override; | |||||
private: | |||||
struct Reservation { | |||||
void *LocalAddr; | |||||
size_t Size; | |||||
}; | |||||
ExecutorProcessControl &EPC; | |||||
SymbolAddrs SAs; | |||||
std::mutex Mutex; | |||||
std::map<ExecutorAddr, Reservation> Reservations; | |||||
}; | |||||
} // namespace orc | } // namespace orc | ||||
} // end namespace llvm | } // end namespace llvm | ||||
#endif // LLVM_EXECUTIONENGINE_ORC_MEMORYMAPPER_H | #endif // LLVM_EXECUTIONENGINE_ORC_MEMORYMAPPER_H |