1 =======================================================================
2 Building a JIT: Extreme Laziness - Using LazyReexports to JIT from ASTs
3 =======================================================================
8 **This tutorial is under active development. It is incomplete and details may
9 change frequently.** Nonetheless we invite you to try it out as it stands, and
10 we welcome any feedback.
12 Chapter 4 Introduction
13 ======================
15 Welcome to Chapter 4 of the "Building an ORC-based JIT in LLVM" tutorial. This
16 chapter introduces custom MaterializationUnits and Layers, and the lazy
17 reexports API. Together these will be used to replace the CompileOnDemandLayer
18 from `Chapter 3 <BuildingAJIT3.html>`_ with a custom lazy-JITing scheme that JITs
19 directly from Kaleidoscope ASTs.
23 **(1) Describe the drawbacks of JITing from IR (have to compile to IR first,
24 which reduces the benefits of laziness).**
26 **(2) Describe CompileCallbackManagers and IndirectStubManagers in detail.**
28 **(3) Run through the implementation of addFunctionAST.**
33 Here is the complete code listing for our running example that JITs lazily from
34 Kaleidoscope ASTS. To build this example, use:
39 clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core orcjit native` -O3 -o toy
45 .. literalinclude:: ../../examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
48 `Next: Remote-JITing -- Process-isolation and laziness-at-a-distance <BuildingAJIT5.html>`_