LLVM 24.0.0git
SimpleRemoteMemoryMapper.h
Go to the documentation of this file.
1//===- SimpleRemoteMemoryMapper.h - Remote memory mapper --------*- 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// A simple memory mapper that implements reserve, initialize, deinitialize and
10// release by driving an executor-side memory manager through Proxy objects.
11//
12// This header is protocol-agnostic. To build the bindings for the ORC runtime's
13// SPS controller interface, see SimpleMemoryMapSPS.h.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEMEMORYMAPPER_H
18#define LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEMEMORYMAPPER_H
19
22
23namespace llvm::orc {
24
25/// Manages remote memory by driving an executor-side memory manager.
27public:
28 /// Create a SimpleRemoteMemoryMapper from a given set of memory-manager
29 /// bindings.
31
34 return std::make_unique<SimpleRemoteMemoryMapper>(ES, std::move(B));
35 }
36
37 unsigned int getPageSize() override {
38 return ES.getExecutorProcessControl().getPageSize();
39 }
40
41 /// Reserves memory in the executor, returning the base address of the
42 /// reserved range on success.
43 void reserve(size_t NumBytes, OnReservedFunction OnReserved) override;
44
46 size_t ContentSize) override;
47
48 /// Initializes memory within a previously reserved region, applying
49 /// protections and running any finalization actions.
50 ///
51 /// On success, returns a key that can be used to deinitialize the region.
52 void initialize(AllocInfo &AI, OnInitializedFunction OnInitialized) override;
53
54 /// Given a series of keys from previous initialize calls, deinitialize
55 /// previously initialized memory regions: run their dealloc actions, reset
56 /// permissions, and decommit if possible.
57 void deinitialize(ArrayRef<ExecutorAddr> Allocations,
58 OnDeinitializedFunction OnDeInitialized) override;
59
60 /// Given a sequence of base addresses from previous reserve calls, release
61 /// the underlying ranges, deinitializing any remaining regions within them.
62 void release(ArrayRef<ExecutorAddr> Reservations,
63 OnReleasedFunction OnRelease) override;
64
65private:
68};
69
70} // namespace llvm::orc
71
72#endif // LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEMEMORYMAPPER_H
bbsections prepare
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
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, const llvm::StringTable &StandardNames, VectorLibrary VecLib)
Initialize the set of available library functions based on the specified target triple.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Tagged union holding either a T or a Error.
Definition Error.h:485
An ExecutionSession represents a running JIT program.
Definition Core.h:1111
Represents an address in the executor process.
Manages mapping, content transfer and protections for JIT memory.
static Expected< std::unique_ptr< SimpleRemoteMemoryMapper > > Create(ExecutionSession &ES, SimpleMemoryMapBindings B)
SimpleRemoteMemoryMapper(ExecutionSession &ES, SimpleMemoryMapBindings B)
Create a SimpleRemoteMemoryMapper from a given set of memory-manager bindings.
Summary of memprof metadata on allocations.
The resolved controller-side handle to an executor-side memory manager: the address of the manager in...