Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Flow and algorithm

Platform spec article

Flow and algorithm

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Trace how a builtin reference in CLIF becomes a live function pointer at run time. Registry diagram: design model.

  1. HIR/lowering selects a runtime operation (allocate string, fiber_yield, etc.).
  2. Codegen emits a call to the stable symbol string (for example alloc, not a mangled Rust name).
  3. During JIT compile, declare_builtin_imports walks BUILTIN_SPECS in declaration order.
  4. For each spec, codegen maps AbiParamKind::Ptr to the host pointer type and I64 to i64, then sets return type from AbiReturnKind.
  1. Generated code calls using the platform default calling convention (SysV on Linux x86_64).
  2. The runtime builtin enters enter_runtime_scope / GC rules as needed (alloc, barriers).
  3. Fiber/channel builtins park or enqueue work via beskid_runtime::scheduler without exposing scheduler internals to CLIF.
  1. Read BeskidStr headers for left and right operands.
  2. Allocate a fresh buffer via alloc for combined byte length.
  3. Copy UTF-8 payload; return new { ptr, len } handle.
  4. On allocation failure or null inputs, trap via panic (no implicit Option at ABI layer).
  1. Lowering emits gc_write_barrier(parent, child) after pointer stores when concurrent GC is active.
  2. Runtime barrier ensures tri-color invariant (see Memory and GC).
  3. Phase A may simplify barrier work when only one mutator runs; symbol remains reserved.