Skip to content

Allow dart2wasm to interop with other wasm code & provide wasm data structures (e.g. in dart:wasm) #55856

@mkustermann

Description

@mkustermann

Currently dart2wasm compiled apps are full apps that have a main function which can be invoked - there's no (official) capability to call out to imported wasm functions or export wasm functions to be consumed by other wasm modules.

This issue tracks (possibly in a dart:wasm):

  • Export / Export functionality based on wasm types
  • Defining & operating on rich set of wasm types (wasm primitives, user-defined wasm structs, etc)
  • Only allow operating on the wasm types in a static way (i.e. they are not real objects, no dynamic dispatch, no tear-offs of functions using wasm types, etc - possibly with CFE/analyzer compile-time checks) and restrict user-defined Wasm structs, ...

WasmGC interop: For User-defined wasm structs the compiler would need to ensure that the types end up in the right recursion groups in order to ensure they will match with other wasm modules, ensuring interop works.

LinearWasm interop: We'd need to ensure the design is considering a future where multiple linear memories are supported (see https://github.com/WebAssembly/multi-memory).

We may want to expose this in a dart:wasm (possibly with same or separate dart:wasmgc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart2wasmIssues for the dart2wasm compiler.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions