Expand description
The copy-and-patch assembler: glue stencils into executable code.
JitBuffer collects stencil instances with their hole values, then
finish() lays everything out — stencil code, an 8-byte-aligned literal
pool for constant holes, and pointer slots for GOT-indirect sites — maps a
page (learning the final base address), patches every relocation against
that base, writes ONCE, and seals. No mutable window ever escapes; W^X
toggling stays confined to the constructing thread.
Layout:
[piece 0][piece 1]…[piece N] [pointer slots…] [value slots…]
^code, 16-byte aligned ^8-byte aligned GOT-style slotsStructs§
- JitBuffer
- The staged assembly.
- JitChain
- A finished, executable chain.
- Label
- A placed stencil instance, identifying a continuation target.
Enums§
- Buffer
Error - Assembly errors.
- Hole
Value - What to plug into a stencil’s holes, by hole id.
Functions§
- jit_
canary_ enabled - Whether
LOGOS_JIT_CANARY=1armed the operand-stack / region-frame sentinel guards (read once; the per-chain path stays branch-cheap).