Skip to content
La3 Docs
Browse docs

Runtime and Linking

How the native runtime, exported symbols, linking, and native binaries fit together.

Runtime contract

The runtime crate is the support library compiled programs link against.

The runtime is where heap-owning values become concrete and where the code generation path gets a predictable ABI. That keeps the generated code from having to know every storage detail itself.

  • str is heap-backed and owns its data.
  • Collections drop their contents recursively.
  • Small stdlib shims are exported as ordinary symbols.

Owned types

Owned runtime values are the ones the compiler must manage with deterministic drops.

  • Strings own UTF-8 buffers.
  • Lists, maps, and sets own heap storage and their element drops.
  • The runtime is designed around explicit ownership, not reference counting.

ABI surface

Native code needs a stable shape for calls, returns, and aggregate values.

  • Scalar values flow through the normal machine calling convention.
  • Aggregates need a predictable layout that the backend and runtime agree on.
  • The docs should always state when a value is passed by copy, by move, or by reference.

Verification

The runtime is not done unless compiled output matches the interpreter for representative programs.

  • fib and fizzbuzz are useful smoke tests for the first native path.
  • The differential harness compares interpreter and compiled output.
  • The runtime needs to stay Miri-clean as it evolves.