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.
Flow and algorithm
Platform spec article
Flow and algorithm
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”Document the end-to-end algorithm from compiler build through JIT/AOT link to first user entry, including where ABI version and export symbols are validated.
See the design model diagram for actor boundaries.
JIT session setup
Section titled “JIT session setup”- Construct
BeskidJitModule(compiler/crates/beskid_engine/src/jit_module.rs) with an optionalextrastable for resolved userExternaddresses when dynamic linking is enabled. - On first
compile, calldeclare_builtin_importsonce, wiring every name inBUILTIN_SPECSto the in-processbeskid_runtimefunction pointer of the same symbol string. - Declare user functions and validated extern imports from the
CodegenArtifact, emit string literals and type descriptors, then define and finalize Cranelift bodies. - Before transferring control to generated code, the host should call
beskid_runtime_abi_version()and compare the result toBESKID_RUNTIME_ABI_VERSIONembedded in the compiler’sbeskid_abidependency (ABI-003).
AOT / bundled runtime path
Section titled “AOT / bundled runtime path”- Backend emits object code that imports the same symbol names listed in
RUNTIME_EXPORT_SYMBOLS. - Link step resolves symbols against the bundled
beskid_runtimestatic or shared library built for the target triple. - Packaging must record the ABI version used at link time in release metadata when distributing standalone binaries (tooling convention; see verification).
Symbol registration algorithm
Section titled “Symbol registration algorithm”For each BuiltinFnSpec entry in compiler/crates/beskid_abi/src/builtins.rs:
- Map
symbolto a hostextern "C-unwind"function inbeskid_runtime::builtins. - Build a Cranelift function signature from
params: &[AbiParamKind]andreturns: AbiReturnKind(Ptr,I64,Void,Never, …). - Store the
FuncIdin the JIT module’sfunc_idsmap so lowering can emit direct calls.
Missing symbols surface as JitError::MissingFunction at finalize time rather than as undefined behavior at runtime.
ABI bump workflow (maintainers)
Section titled “ABI bump workflow (maintainers)”- Increment
BESKID_RUNTIME_ABI_VERSIONinbeskid_abi/src/version.rs. - Update
RUNTIME_EXPORT_SYMBOLSandBUILTIN_SPECStogether with runtime#[unsafe(no_mangle)]implementations. - Refresh platform-spec articles and
compiler/crates/beskid_tests/beskid_e2e_testsfixtures that pin version or symbol lists. - Publish runtime and compiler artifacts in lockstep; mixed versions are unsupported for production (ABI-004).
Related topics
Section titled “Related topics”- Design model — compatibility diagram and actors
- Builtins and symbols — per-symbol contracts