Expand description
Running the machine code a .cdlb carries.
candela build compiles the functions it can to machine code and puts
the code in the artifact beside the bytecode, one section per kind of
machine (NativeImage). Loading a program picks the section this
machine can run, copies its code into memory of its own, makes that memory
executable (never writable and executable at once), and rewrites the calls
the section covers so they call the machine code. Everything else runs on
the interpreter, and any section that does not fit this machine, or memory
the operating system refuses to make executable, leaves the whole program
on bytecode, which is complete on its own.
The code reaches the VM only through a NativeCtx: the register file,
the object pool, a few status words and the helpers it calls for anything
the VM does itself. The contract between the two is versioned by
abi::VERSION.
Modules§
- abi
- The contract between generated code and the VM: the layout of the context, the status codes, and the layout of an object in the pool.
Structs§
- Native
Code - The machine code of a loaded program.
- Native
Ctx - What a native function and the VM share while it runs. One lives for each run of the interpreter, and every call into native code during that run reuses it.
- Native
Function - One function of the loaded code.
Functions§
- load
- Loads the first of
sectionsthis machine can run: maps its code, and rewrites the calls it covers ininstructions. AnswersNone, leavinginstructionsas they were, when no section fits or the code cannot be made executable; the program then runs on bytecode alone.
Type Aliases§
- Entry
- The signature of every entry point: the context, and how far below the ceiling the function stands.