Skip to content

Commit f06d689

Browse files
committed
notes
1 parent 4ce9276 commit f06d689

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/orcv2jit.cpp

+29-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,34 @@
88
// > My recommendation is to always start with one context per module, and only share contexts if you see memory
99
// > consumption from the contexts becoming an issue.
1010

11+
// Notes from [ORCv2.rst](https://github.com/llvm/llvm-project/blob/main/llvm/docs/ORCv2.rst)
12+
//
13+
// Eager compilation: By default, symbols get compiled as soon as they are looked up in `ExecutionSession`
14+
// Lazy compilation: Only when they first called
15+
//
16+
// Custom compilers can be supplied for **each symbol**. Wrapper mechanism (`MaterializationUnit`) is used for custom
17+
// compilers. Materialization is the blanket term for **any actions** that are required to generate a symbol definition
18+
// that is safe to call or access.
19+
//
20+
// `ExecutionSession`: the JIT'd program and provides JITDylibs, error reporting mechanisms and dispatches the
21+
// materializers for the JIT
22+
//
23+
// `JITDylibs`: the symbol tables `IRCompileLayer`: compilation of IR
24+
//
25+
// _Layers_: wrappers around compikers and allow clients to add uncompiled program representations supported by those
26+
// compilers to JITDylibs
27+
//
28+
// `RTDyldObjectLinkingLayer`: linking of relocatable object files
29+
//
30+
// LLLazyJIT has `CompileOnDemandLayer` to enable lazy compilation of IR
31+
//
32+
// `ResourceTrackers`: to remove code
33+
//
34+
// Couldn't find corresponding `setNumCompileThreads` and `setLazyCompileFailureAddr` calls in llvm c api
35+
//
36+
// `absoluteSymbols` function is still useful for making **non-global** objects in your JIT visible to JIT'd code
37+
//
38+
// `LLVMOrcLazyReexports` define aliases across JITDylib boundaries, `symbolAliases` (missing in c api?) does not
1139
#include "orcv2jit.hpp"
1240

1341
#include <llvm-c/Analysis.h>
@@ -344,7 +372,6 @@ struct orc_v2_jit_t {
344372
// why say_hello cannot be found?
345373
bind("say_hello", reinterpret_cast<uint64_t>(say_hello)); // NOLINT
346374
auto const dg_predicate = [](void* payload, LLVMOrcSymbolStringPoolEntryRef sym) {
347-
std::cerr << "searching for `" << LLVMOrcSymbolStringPoolEntryStr(sym) << "`";
348375
auto* allow_list = static_cast<LLVMOrcSymbolStringPoolEntryRef*>(payload);
349376

350377
for (auto* p = allow_list; *p != nullptr; ++p) {
@@ -425,7 +452,7 @@ struct tsm_t {
425452
LLVMOrcThreadSafeModuleWithModuleDo(
426453
m_tsm,
427454
[](void* ctx, LLVMModuleRef mod) -> LLVMErrorRef {
428-
reinterpret_cast<w_t*>(ctx)->f(mod); // NOLINT
455+
static_cast<w_t*>(ctx)->f(mod); // NOLINT
429456
return nullptr;
430457
},
431458
static_cast<void*>(&w));

0 commit comments

Comments
 (0)