|
8 | 8 | // > My recommendation is to always start with one context per module, and only share contexts if you see memory
|
9 | 9 | // > consumption from the contexts becoming an issue.
|
10 | 10 |
|
| 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 |
11 | 39 | #include "orcv2jit.hpp"
|
12 | 40 |
|
13 | 41 | #include <llvm-c/Analysis.h>
|
@@ -344,7 +372,6 @@ struct orc_v2_jit_t {
|
344 | 372 | // why say_hello cannot be found?
|
345 | 373 | bind("say_hello", reinterpret_cast<uint64_t>(say_hello)); // NOLINT
|
346 | 374 | auto const dg_predicate = [](void* payload, LLVMOrcSymbolStringPoolEntryRef sym) {
|
347 |
| - std::cerr << "searching for `" << LLVMOrcSymbolStringPoolEntryStr(sym) << "`"; |
348 | 375 | auto* allow_list = static_cast<LLVMOrcSymbolStringPoolEntryRef*>(payload);
|
349 | 376 |
|
350 | 377 | for (auto* p = allow_list; *p != nullptr; ++p) {
|
@@ -425,7 +452,7 @@ struct tsm_t {
|
425 | 452 | LLVMOrcThreadSafeModuleWithModuleDo(
|
426 | 453 | m_tsm,
|
427 | 454 | [](void* ctx, LLVMModuleRef mod) -> LLVMErrorRef {
|
428 |
| - reinterpret_cast<w_t*>(ctx)->f(mod); // NOLINT |
| 455 | + static_cast<w_t*>(ctx)->f(mod); // NOLINT |
429 | 456 | return nullptr;
|
430 | 457 | },
|
431 | 458 | static_cast<void*>(&w));
|
|
0 commit comments