JIT and CLI hosts may load a beskid_runtime artifact built separately from the active compiler. Without an explicit version gate, stale toolchains call builtins with wrong layouts or missing symbols.
Design model
Platform spec article
Design model
Spec standingStandard
-
Hosts reject mismatched compiler and runtime ABI integers before executing generated code.
Context
Decision
Rule Detail Version surface beskid_runtime_abi_version()returnsBESKID_RUNTIME_ABI_VERSION(u32inbeskid_abi)Host check Hosts should fail before user mainwhen runtime version ≠ compiler-embedded constant (ABI-003)Diagnostics Failure messages must name both integers and recommend aligning CLI/VSIX/runtime release sets Consequences
Release matrices document paired compiler/runtime builds. Conformance should assert version parity in JIT smoke tests (
beskid_testsruntime/jit).Verification anchors
compiler/crates/beskid_abi/src/version.rs;beskid_engineJIT module setup; ABI-001–ABI-003 in contracts and edge cases. -
Layout, signature, or semantic breaks must increment BESKID_RUNTIME_ABI_VERSION.
Context
Additive runtime symbols and Cargo feature gates are easy to confuse with ABI-stable changes. Silent signature drift breaks AOT/JIT link steps or causes undefined behavior at call sites.
Decision
Trigger Action BeskidStr/BeskidArray/ interop payload layout changeMust increment BESKID_RUNTIME_ABI_VERSION(ABI-004)Builtin rename, arity change, or AbiParamKind/AbiReturnKindchangeMust bump version Semantics relied on by lowering change (e.g. barrier no-op) Must bump version New symbol appended, older artifacts never import it May ship without bump (ABI-005) Optional Cargo featuresonlyMust not bump ABI version Reference tree pins version 2 until the next breaking change.
Consequences
Release notes should list bumped versions and removed symbols. Renaming without bump is a release-process violation.
Verification anchors
beskid_abisymbol tables;RUNTIME_EXPORT_SYMBOLSparity checks in CI.
- Contracts and edge cases MUST/SHOULD rules for ABI version bumps, symbol stability, and mixed toolchain failures.
- Design model ABI version negotiation, symbol stability, and compiler–runtime compatibility boundaries.
- Examples ABI version checks, symbol parity, and migration scenarios for toolchain maintainers.
- FAQ and troubleshooting Common ABI mismatch failures and maintainer guidance for version bumps.
- Flow and algorithm JIT symbol registration, ABI version export, and compatibility check ordering.
- Verification and traceability Tests and crate paths that pin ABI version and runtime export symbol parity.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Purpose
Section titled “Purpose”Define how the compiler, JIT/AOT backends, and Beskid runtime agree on a single numeric ABI version and a frozen export surface so generated code never calls missing or mis-typed runtime entrypoints.
Primary actors
Section titled “Primary actors”| Actor | Responsibility |
|---|---|
beskid_abi | Owns BESKID_RUNTIME_ABI_VERSION, RUNTIME_EXPORT_SYMBOLS, and builtin signature metadata consumed by codegen. |
beskid_codegen / beskid_engine | Declares imports from BUILTIN_SPECS and validates user Extern shapes before linking. |
beskid_runtime | Implements #[unsafe(no_mangle)] exports; beskid_runtime_abi_version() returns the compile-time constant. |
| Host tooling | JIT session and AOT link steps load the same runtime artifact the compiler was built against (or an explicitly compatible newer runtime). |
Subsystem boundaries
Section titled “Subsystem boundaries”- In scope: ABI integer version, additive vs breaking symbol changes, JIT symbol registration parity with AOT, and migration expectations when bumping
BESKID_RUNTIME_ABI_VERSIONincompiler/crates/beskid_abi/src/version.rs. - Out of scope: Language-level
Externsyntax (FFI and extern), C link-time profiles (C ABI profile), and per-builtin semantics (Builtins and symbols).
Version and symbol model
Section titled “Version and symbol model”The ABI version is a u32 exposed as beskid_runtime_abi_version. The reference tree currently pins BESKID_RUNTIME_ABI_VERSION = 2. A bump is required when any of the following change incompatibly:
- C layout of
BeskidStr,BeskidArray, or interop payload offsets referenced by lowering. - Name, parameter count, or
AbiParamKind/AbiReturnKindof a builtin inBUILTIN_SPECS. - Semantics that generated code already depends on (for example making
gc_write_barriera no-op when lowering assumes barriers run).
Additive changes (new symbols appended to RUNTIME_EXPORT_SYMBOLS, new optional runtime features) should not require a version bump if existing artifacts keep working without recompilation.
Compatibility diagram
Section titled “Compatibility diagram”flowchart LR abi[beskid_abi version + symbols] codegen[Codegen artifact] jit[JIT / AOT linker] rt[beskid_runtime exports] abi --> codegen abi --> jit jit -->|resolve imports| rt codegen --> jit
Codegen and the engine read the same beskid_abi crate revision at build time. At run time, hosts should treat a lower runtime version than the compiler expects as a hard compatibility failure before executing user code.
Platform assumptions (v0.2 baseline)
Section titled “Platform assumptions (v0.2 baseline)”Reference implementations target 64-bit pointers and Linux x86_64 for syscall-backed builtins; other hosts may stub behavior but must preserve symbol names and Cranelift signature shapes declared in BUILTIN_SPECS.
Related topics
Section titled “Related topics”- Flow and algorithm — JIT registration and version check ordering
- Contracts and edge cases — normative ABI-00x requirements
- Legacy bridge: Runtime ABI (v0.1)