LLVM 24.0.0git
SimpleMemoryMapSPS.cpp
Go to the documentation of this file.
1//===- SimpleMemoryMapSPS.cpp - SPS memory-map bindings -------------------===//
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
10
13
14namespace llvm::orc::sps {
15
19
20 // The instance -- the executor-side manager object passed as the first
21 // argument to each call -- is either created on demand via Create, or (for
22 // executors that do not provide Create) published as a data symbol. Both are
23 // looked up weakly; whichever is available is used below. The operation
24 // proxies resolve to the specs' default (SimpleNativeMemoryMap) names.
25 if (auto Err = lookupAndApply(
26 JD,
35 return std::move(Err);
36
37 if (Create) {
38 auto Instance = Create(JD.getExecutionSession());
39 if (!Instance)
40 return Instance.takeError();
41 B.Instance = *Instance;
42 } else if (!B.Instance)
44 "Executor provides neither " + MemMgrCreateProxySpec::Name.getName() +
46 ": cannot bind a SimpleNativeMemoryMap instance",
48
49 return std::move(B);
50}
51
56
57} // namespace llvm::orc::sps
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static StringRef getName(Value *V)
Tagged union holding either a T or a Error.
Definition Error.h:485
An ExecutionSession represents a running JIT program.
Definition Core.h:1096
JITDylib & getBootstrapJITDylib()
Returns a reference to the bootstrap JITDylib.
Definition Core.h:1184
Represents a JIT'd dynamic library.
Definition Core.h:668
ExecutionSession & getExecutionSession() const
Get a reference to the ExecutionSession for this JITDylib.
Definition Core.h:687
constexpr SymbolNameSpec SimpleNativeMemoryMapInstanceName
A pre-created executor-side memory-manager instance.
LLVM_ABI Expected< SimpleMemoryMapBindings > createSimpleMemoryMapBindings(JITDylib &JD)
Build bindings over the SPS controller interface, resolving the operations in the given JITDylib unde...
LookupPrepareFn recordProxy(Proxy< FnT > *P, typename Proxy< FnT >::DispatchFn Dispatch, SymbolNameSpec Name, SymbolLookupFlags LF=SymbolLookupFlags::RequiredSymbol)
Builds P over the symbol with the given name, dispatching through Dispatch.
Definition RecordProxy.h:32
LLVM_ABI void lookupAndApply(unique_function< void(Error)> OnApplied, LookupKind K, const JITDylibSearchOrder &SearchOrder, ArrayRef< LookupPrepareFn > PrepareFns)
Resolve the symbols contributed by every prepare function with a single lookup, then let each of thei...
LookupPrepareFn recordAddr(SymbolNameSpec Name, ExecutorAddr *A, SymbolLookupFlags LF=SymbolLookupFlags::RequiredSymbol)
Records the address of the symbol with the given name.
static std::unique_ptr< UnwindInfoManager > Instance
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition Error.cpp:94
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
The resolved controller-side handle to an executor-side memory manager: the address of the manager in...