Stream: git-wasmtime

Topic: wasmtime / PR #2637 Added unstable-allow-missing-imports ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 04 2021 at 13:36):

AlexEne opened PR #2637 from main to main:

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

I've added the possibility to allow missing imports in modules. This has been discussed here.

To re-iterate the need for this, there are use-cases where not all host programs VMs have been updated to the latest version that exports all functions required by modules that execute on these hosts.

In such instances it's more convenient to dynamically check a feature flag and call the native methods only if they exist vs emitting different binaries for each VM version.

For example, this allows your WASM program to use this type of pattern:

// call specific function to check for functionality before calling a method that might not exist
if (vm_host_has_feature("feature_name") {
     call_function_from_vm_because_it_should_exist_here();
} else {
     fallback_bhv();
}

If the you call a missing import it will cause the VM issue a trap.

Once optional imports are standard and implemented, the escape hatch can be removed, in the meantime it's a really useful feature to have.

Maybe @tschneidereit can review this since we discussed it on zulip?


Last updated: Nov 22 2024 at 16:03 UTC