Skip to main content

Module multi_version

Module multi_version 

Source
Expand description

M10 per-major Linker cache for multi-version ABI coexistence.

A plugin’s manifest carries a semver range describing which host ABI majors it tolerates (uni_plugin::AbiRange). The host can support several majors concurrently — ^1 plugins use the v1 linker, ^2 plugins use the v2 linker — so an ABI bump does not force every plugin to be rebuilt in lockstep with the host.

MultiVersionLinker is the dispatch point. It owns a wasmtime Engine and, for each (major, caps_signature) pair, lazily constructs and caches an Arc<Linker<HostState>>.

§Why cache?

Linker::new plus per-host-fn func_wrap registrations are cheap (microseconds), but constructing a fresh linker on every plugin load() adds avoidable allocation churn — the same (major, caps) combination hits on every hot-reload of any plugin in that configuration. The cache reuses the Arc-shared linker across all compatible plugins.

Structs§

MultiVersionLinker
Per-major Linker cache.

Constants§

SUPPORTED_MAJORS
Major versions the host can link against.