LLVM 22.0.0git
SimpleExecutorMemoryManager.h
Go to the documentation of this file.
1//===---------------- SimpleExecutorMemoryManager.h -------------*- 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 allocator class suitable for basic remote-JIT use.
10//
11// FIXME: The functionality in this file should be moved to the ORC runtime.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
16#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
17
18#include "llvm/ADT/DenseMap.h"
24#include "llvm/Support/Error.h"
25
26#include <mutex>
27
28namespace llvm {
29namespace orc {
30namespace rt_bootstrap {
31
32/// Simple page-based allocator.
34public:
36
39 Error deallocate(const std::vector<ExecutorAddr> &Bases);
40
41 Error shutdown() override;
43
44private:
45 struct Allocation {
46 size_t Size = 0;
47 std::vector<shared::WrapperFunctionCall> DeallocationActions;
48 };
49
50 using AllocationsMap = DenseMap<void *, Allocation>;
51
52 Error deallocateImpl(void *Base, Allocation &A);
53
55 reserveWrapper(const char *ArgData, size_t ArgSize);
56
58 finalizeWrapper(const char *ArgData, size_t ArgSize);
59
61 deallocateWrapper(const char *ArgData, size_t ArgSize);
62
63 std::mutex M;
64 AllocationsMap Allocations;
65};
66
67} // end namespace rt_bootstrap
68} // end namespace orc
69} // end namespace llvm
70
71#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
arc branch finalize
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_ABI
Definition Compiler.h:213
This file defines the DenseMap class.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:133
Error deallocate(const std::vector< ExecutorAddr > &Bases)
void addBootstrapSymbols(StringMap< ExecutorAddr > &M) override
This is an optimization pass for GlobalISel generic memory operations.