Stream: git-wasmtime

Topic: wasmtime / issue #15086 Resolve builtins transitively


view this post on Zulip Wasmtime GitHub notifications bot (Oct 30 2026 at 10:46):

dyslexicsteak opened issue #15086:

Feature

Allow transitive inclusion of compile-time builtins into composition graphs.

Benefit

As it stands, builtins are only composed in if a guest directly imports them. For example, in the case of layering higher-level builtins atop lower-level ones, the guest is forced to manually import all layers. After this change the guest only needs to import its direct dependencies, closing the abstraction leak.

Implementation

Starting at the main instance, walk depth-first in declaration order and discover builtins, instantiating as we go and reusing instances already created. A stack holding builtins currently being instantiated (i.e. having their imports resolved) is used to reject repeated names which result from cyclic imports. The stack from the repeated name onwards is the cycle path used for error reporting.

By instantiating each builtin once and sharing them among their importers, stateful builtins behave correctly and all importers observe the same state.

Imports that aren't builtins, including the unsafe intrinsics, are left alone and remain imports of the result, as they do now.

Alternatives

Leave it as-is; guests must explicitly name all builtins they use.


Last updated: Oct 31 2026 at 23:03 UTC