Skip to content

WASM feature selection at parse/validation time #44

@jmillikin

Description

@jmillikin

(originally dylibso/chicory#768)

When WebAssembly is used as a plugin system it's desirable to be able to control which extensions to the base WebAssembly v1.0 spec are allowed. Otherwise the different levels of WebAssembly feature support between versions can cause plugins to accidentally depend on a feature that's only supported on the most recent version of the host program.

Imagine a plugin developer is writing WebAssembly plugins for their IDE, which uses Endive. One day they publish a new version of their plugin and some users complain that it's broken. After some testing they realize their updated C toolchain is auto-vectorizing some loops, which means it requires an Endive version with SIMD, which after some investigation is found to only ship in IDE release v2025.01 and later. If Endive allowed the WebAssembly feature set to be explicitly selected then the IDE could have configured it to be "just v1.0", so the toolchain issue would have been caught early. Updating WebAssembly feature support (e.g. v1.0 -> v2.0) would be more legible to the host application.

Similar issues also exist for ecosystems with multiple WebAssembly implementations in use, for example Endive for JVM host applications and one written in C++ for native applications. If Endive supports the GC proposal and the C++ impl doesn't, then plugins that require GC will work in some host applications but not others (with no easy way for a plugin user to realize what's going wrong).

Would it be possible to add some sort of "WebAssembly feature" enum, and let the parser builder have a set of enabled features? By default it would support everything, but calling .feature(Feature.V_1_0) would cause validation errors for non-MVP features, .feature(Feature.SIMD) would enable SIMD support, etc. Obviously adjustments to the API are fine, I'm more interested in the functionality than the exact shape.

Proposed subsets to target: V_1_0, V_2_0, V_3_0, LIME_1. Then add whatever additional per-feature selections the Endive devs feel would be reasonable to target by themselves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions