LLVM 24.0.0git
EPCGenericJITLinkMemoryManager.h
Go to the documentation of this file.
1//===- EPCGenericJITLinkMemoryManager.h - EPC-based mem manager -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Implements JITLinkMemoryManager by calling executor-side wrapper functions
10// through rt::Proxy objects.
11//
12// This simplifies the implementaton of new ExecutorProcessControl instances,
13// as this implementation will always work (at the cost of some performance
14// overhead for the calls).
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICJITLINKMEMORYMANAGER_H
19#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICJITLINKMEMORYMANAGER_H
20
25
26namespace llvm {
27namespace orc {
28
31public:
32 /// The resolved controller-side handle to an executor-side memory manager:
33 /// the address of the allocator instance (passed as the first argument to
34 /// each call) plus the proxies for its functions. These are
35 /// protocol-agnostic: the Create methods populate them for the runtime's SPS
36 /// controller interface, but a client targeting a different protocol can
37 /// build its own Bindings and pass them to the constructor.
38 ///
39 /// Deinitialize is part of the interface but is not currently used by this
40 /// manager.
48
49 /// Create an EPCGenericJITLinkMemoryManager instance from a given set of
50 /// memory-manager bindings.
53
54 /// Create an EPCGenericJITLinkMemoryManager for the ORC runtime's
55 /// SimpleNativeMemoryMap interface, resolving its symbols in the given
56 /// JITDylib.
58 Create(JITDylib &JD);
59
60 /// Create an EPCGenericJITLinkMemoryManager for the ORC runtime's
61 /// SimpleNativeMemoryMap interface, resolving its symbols in the given
62 /// ExecutionSession's bootstrap JITDylib.
64 Create(ExecutionSession &ES);
65
66 void allocate(const jitlink::JITLinkDylib *JD, jitlink::LinkGraph &G,
67 OnAllocatedFunction OnAllocated) override;
68
69 // Use overloads from base class.
70 using JITLinkMemoryManager::allocate;
71
72 void deallocate(std::vector<FinalizedAlloc> Allocs,
73 OnDeallocatedFunction OnDeallocated) override;
74
75 // Use overloads from base class.
76 using JITLinkMemoryManager::deallocate;
77
78private:
79 class InFlightAlloc;
80
81 void completeAllocation(ExecutorAddr AllocAddr, jitlink::BasicLayout BL,
82 OnAllocatedFunction OnAllocated);
83
85 Bindings B;
86};
87
88} // end namespace orc
89} // end namespace llvm
90
91#endif // LLVM_EXECUTIONENGINE_ORC_EPCGENERICJITLINKMEMORYMANAGER_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
#define G(x, y, z)
Definition MD5.cpp:55
Tagged union holding either a T or a Error.
Definition Error.h:485
EPCGenericJITLinkMemoryManager(ExecutionSession &ES, Bindings B)
Create an EPCGenericJITLinkMemoryManager instance from a given set of memory-manager bindings.
An ExecutionSession represents a running JIT program.
Definition Core.h:1111
Represents an address in the executor process.
Represents a JIT'd dynamic library.
Definition Core.h:675
Proxy< Error(ExecutorAddr, ArrayRef< ExecutorAddr >)> MemMgrReleaseProxy
Release the allocations with the given base addresses.
Proxy< Error(ExecutorAddr, ArrayRef< ExecutorAddr >)> MemMgrDeinitializeProxy
Deinitialize the allocations with the given base addresses (running their deallocation actions) witho...
Proxy< Expected< ExecutorAddr >(ExecutorAddr, tpctypes::FinalizeRequest)> MemMgrInitializeProxy
Apply a finalize request; returns a key for the initialized allocation.
Proxy< Expected< ExecutorAddr >(ExecutorAddr, uint64_t)> MemMgrReserveProxy
Reserve an address range of the given size; returns its base.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1917
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
The resolved controller-side handle to an executor-side memory manager: the address of the allocator ...