LLVM: include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H

15#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H

16

20

21#define DEBUG_TYPE "orc"

22

23namespace llvm {

24namespace orc {

25

26

29public:

30

39

40

41

44

45

46

48

56

58 unsigned SectionID,

60

63 bool IsReadOnly) override;

64

66 uintptr_t RODataSize, Align RODataAlign,

67 uintptr_t RWDataSize, Align RWDataAlign) override;

68

70

72

74

77

78 bool finalizeMemory(std::string *ErrMsg = nullptr) override;

79

80private:

81 struct SectionAlloc {

82 public:

86

89 std::unique_ptr<uint8_t[]> Contents;

91 };

92

93

94

95

96 struct SectionAllocGroup {

97 SectionAllocGroup() = default;

98 SectionAllocGroup(const SectionAllocGroup &) = delete;

99 SectionAllocGroup &operator=(const SectionAllocGroup &) = delete;

100 SectionAllocGroup(SectionAllocGroup &&) = default;

101 SectionAllocGroup &operator=(SectionAllocGroup &&) = default;

102

103 ExecutorAddrRange RemoteCode;

104 ExecutorAddrRange RemoteROData;

105 ExecutorAddrRange RemoteRWData;

106 std::vector UnfinalizedEHFrames;

107 std::vector CodeAllocs, RODataAllocs, RWDataAllocs;

108 };

109

110

111 void mapAllocsToRemoteAddrs(RuntimeDyld &Dyld,

112 std::vector &SecAllocs,

113 ExecutorAddr NextAddr);

114

115 ExecutorProcessControl &EPC;

116 SymbolAddrs SAs;

117

118 std::mutex M;

119 std::vector Unmapped;

120 std::vector Unfinalized;

121 std::vector FinalizedAllocs;

122 std::string ErrMsg;

123};

124

125}

126}

127

128#undef DEBUG_TYPE

129

130#endif

Tagged union holding either a T or a Error.

StringRef - Represent a constant reference to a string, i.e.

This class is the base class for all object file types.

uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) override

Allocate a memory block of (at least) the given size suitable for data.

bool finalizeMemory(std::string *ErrMsg=nullptr) override

This method is called when object loading is complete and section page permissions can be applied.

bool needsToReserveAllocationSpace() override

Override to return true to enable the reserveAllocationSpace callback.

static Expected< std::unique_ptr< EPCGenericRTDyldMemoryManager > > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)

Create an EPCGenericRTDyldMemoryManager using the given EPC, looking up the default symbol names in t...

EPCGenericRTDyldMemoryManager(ExecutorProcessControl &EPC, SymbolAddrs SAs)

Create an EPCGenericRTDyldMemoryManager using the given EPC and symbol addrs.

void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign, uintptr_t RODataSize, Align RODataAlign, uintptr_t RWDataSize, Align RWDataAlign) override

Inform the memory manager about the total amount of memory required to allocate all sections to be lo...

void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override

Register the EH frames with the runtime so that c++ exceptions work.

void notifyObjectLoaded(RuntimeDyld &Dyld, const object::ObjectFile &Obj) override

This method is called after an object has been loaded into memory but before relocations are applied ...

void deregisterEHFrames() override

EPCGenericRTDyldMemoryManager & operator=(EPCGenericRTDyldMemoryManager &&)=delete

uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) override

Allocate a memory block of (at least) the given size suitable for executable code.

EPCGenericRTDyldMemoryManager(const EPCGenericRTDyldMemoryManager &)=delete

EPCGenericRTDyldMemoryManager & operator=(const EPCGenericRTDyldMemoryManager &)=delete

EPCGenericRTDyldMemoryManager(EPCGenericRTDyldMemoryManager &&)=delete

Represents an address in the executor process.

ExecutorProcessControl supports interaction with a JIT target process.

This is an optimization pass for GlobalISel generic memory operations.

Implement std::hash so that hash_code can be used in STL containers.

This struct is a compact representation of a valid (non-zero power of two) alignment.

Symbol addresses for memory access.

Definition EPCGenericRTDyldMemoryManager.h:31

ExecutorAddr Instance

Definition EPCGenericRTDyldMemoryManager.h:32

ExecutorAddr Release

Definition EPCGenericRTDyldMemoryManager.h:35

ExecutorAddr DeregisterEHFrame

Definition EPCGenericRTDyldMemoryManager.h:37

ExecutorAddr Initialize

Definition EPCGenericRTDyldMemoryManager.h:34

ExecutorAddr RegisterEHFrame

Definition EPCGenericRTDyldMemoryManager.h:36

ExecutorAddr Reserve

Definition EPCGenericRTDyldMemoryManager.h:33