LLVM
22.0.0git
include
llvm
ExecutionEngine
Orc
TargetProcess
ExecutorSharedMemoryMapperService.h
Go to the documentation of this file.
1
//===----------- ExecutorSharedMemoryMapperService.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
#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_EXECUTORSHAREDMEMORYMAPPERSERVICE_H
10
#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_EXECUTORSHAREDMEMORYMAPPERSERVICE_H
11
12
#include "
llvm/ADT/DenseMap.h
"
13
#include "llvm/Config/llvm-config.h"
// for LLVM_ON_UNIX
14
#include "
llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h
"
15
#include "
llvm/ExecutionEngine/Orc/TargetProcess/ExecutorBootstrapService.h
"
16
#include "
llvm/Support/Compiler.h
"
17
18
#include <atomic>
19
#include <mutex>
20
21
#if defined(_WIN32)
22
#include <windows.h>
23
#endif
24
25
namespace
llvm
{
26
namespace
orc
{
27
namespace
rt_bootstrap
{
28
29
class
LLVM_ABI
ExecutorSharedMemoryMapperService
final
30
:
public
ExecutorBootstrapService
{
31
public
:
32
~ExecutorSharedMemoryMapperService
(){};
33
34
Expected<std::pair<ExecutorAddr, std::string>
> reserve(
uint64_t
Size
);
35
Expected<ExecutorAddr>
initialize
(
ExecutorAddr
Reservation,
36
tpctypes::SharedMemoryFinalizeRequest
&FR);
37
38
Error
deinitialize(
const
std::vector<ExecutorAddr> &Bases);
39
Error
release
(
const
std::vector<ExecutorAddr> &Bases);
40
41
Error
shutdown()
override
;
42
void
addBootstrapSymbols(
StringMap<ExecutorAddr>
&M)
override
;
43
44
private
:
45
struct
Allocation {
46
std::vector<shared::WrapperFunctionCall> DeinitializationActions;
47
};
48
using
AllocationMap =
DenseMap<ExecutorAddr, Allocation>
;
49
50
struct
Reservation {
51
size_t
Size
;
52
std::vector<ExecutorAddr> Allocations;
53
#if defined(_WIN32)
54
HANDLE SharedMemoryFile;
55
#endif
56
};
57
using
ReservationMap =
DenseMap<void *, Reservation>
;
58
59
static
llvm::orc::shared::CWrapperFunctionResult
60
reserveWrapper(
const
char
*ArgData,
size_t
ArgSize);
61
62
static
llvm::orc::shared::CWrapperFunctionResult
63
initializeWrapper(
const
char
*ArgData,
size_t
ArgSize);
64
65
static
llvm::orc::shared::CWrapperFunctionResult
66
deinitializeWrapper(
const
char
*ArgData,
size_t
ArgSize);
67
68
static
llvm::orc::shared::CWrapperFunctionResult
69
releaseWrapper(
const
char
*ArgData,
size_t
ArgSize);
70
71
#if (defined(LLVM_ON_UNIX) && !defined(__ANDROID__)) || defined(_WIN32)
72
std::atomic<int> SharedMemoryCount{0};
73
#endif
74
75
std::mutex Mutex;
76
ReservationMap Reservations;
77
AllocationMap Allocations;
78
};
79
80
}
// namespace rt_bootstrap
81
}
// namespace orc
82
}
// namespace llvm
83
#endif
// LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_EXECUTORSHAREDMEMORYMAPPERSERVICE_H
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
DenseMap.h
This file defines the DenseMap class.
ExecutorBootstrapService.h
InlinePriorityMode::Size
@ Size
Definition
InlineOrder.cpp:25
initialize
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
Definition
TargetLibraryInfo.cpp:954
TargetProcessControlTypes.h
llvm::DenseMap
Definition
DenseMap.h:700
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition
Error.h:159
llvm::Expected
Tagged union holding either a T or a Error.
Definition
Error.h:485
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition
StringMap.h:133
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition
ExecutorAddress.h:34
llvm::orc::ExecutorBootstrapService
Definition
ExecutorBootstrapService.h:25
llvm::orc::rt_bootstrap::ExecutorSharedMemoryMapperService
Definition
ExecutorSharedMemoryMapperService.h:30
llvm::orc::rt_bootstrap::ExecutorSharedMemoryMapperService::~ExecutorSharedMemoryMapperService
~ExecutorSharedMemoryMapperService()
Definition
ExecutorSharedMemoryMapperService.h:32
uint64_t
llvm::orc::rt_bootstrap
Definition
ExecutorSharedMemoryMapperService.h:27
llvm::orc
Definition
AbsoluteSymbols.h:19
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::AtomicOrderingCABI::release
@ release
Definition
AtomicOrdering.h:32
llvm::orc::shared::CWrapperFunctionResult
Definition
WrapperFunctionUtils.h:33
llvm::orc::tpctypes::SharedMemoryFinalizeRequest
Definition
TargetProcessControlTypes.h:67
Generated on
for LLVM by
1.14.0