WebAssembly / WebAssembly/WASI

API to instantiate a module from a bytes

Open
#477 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

JavaScript API has WebAssembly.compile and WebAssembly.instantiate.
There seems to be no equivalent to this in wasi.

For example, if wasi have this, it should be able to realize a JIT compiler by generating a wasm module bytes and instantiating it by passing a function or memory. We can already do this with the JavaScript API.

Module-linking proposal

This looks like a problem that the module-linking proposal doesn't solve.

The general case of runtime dynamic linking in the style of dlopen, where an
a priori unknown module is linked into the program at runtime, is not possible
to do purely within wasm with this proposal. Additional host-provided APIs are
required for:

  • compiling files or bytes into a module;

https://github.com/WebAssembly/module-linking/blob/main/design/proposals/module-linking/Example-SharedEverythingDynamicLinking.md#runtime-dynamic-linking

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the JavaScript WebAssembly.compile and WebAssembly.instantiate APIs with the existing WASI surface. Read the linked module-linking proposal, especially its runtime dynamic-linking discussion, and define a host API that can compile module bytes and instantiate them with supplied functions or memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.