Repository navigation
feat: support Wasm plugins that use exception handling - #1371
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables wasmtime's
gcandgc-drcfeatures so plugins can use the exception-handling proposal. Wasmtime requiresgcfor it because an exception is anexnrefon its GC heap. Without this, such a plugin fails to load:This is for plugins compiled from .NET with NativeAOT-LLVM's
WasmEnableExceptionHandling, which throws and catches .NET exceptions with Wasm's own instructions instead of the emulation it uses otherwise. For dprint-plugin-prettier (compiled from TypeScript to C# by nts) the module gets 17% smaller (29.9 MB against 35.9 MB) and formatting 5–7% faster. One thread, ms, three alternating rounds:Other plugins are not slower (one thread, ms, five alternating rounds of dprint-plugin-typescript and dprint-plugin-json):
gcgcThe binary is 119 KB larger (30.64 to 30.76 MB on Windows).
No plugin cache change is needed: the cache key includes wasmtime's
precompile_compatibility_hash, which covers the enabled Wasm features, so modules compiled before this get new entries.gc-drcis the collector because exceptions hold no cycles. The new test fails without the features with the error above.