Worker imports & memory sharing

Aperta
#112 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript, wasm
Ambito
web-dev

Direzione di ricerca

Start by reading the linked discussion in issue 14 and the ESM Phase Imports proposal in pull request 106, then compare the worker and dynamic import scenarios described here. Determine whether passing imports to new Worker() should be specified and how that interacts with module import resolution. Done means a concrete, agreed proposal or specification change with its ergonomics and compatibility implications resolved.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

As brought up in https://github.com/WebAssembly/esm-integration/issues/14#issuecomment-2931717336, one problem with the ESM integration instance import model is that for multi-threading scenarios the memory import needs to be available at startup.

The ESM Phase Imports proposal also enables the ability for new Worker(wasmModule) to create a worker from a WebAssembly module which is currently specified in https://github.com/WebAssembly/esm-integration/pull/106.

Delaying instantiation via dynamic import provides one route, but it might be worth considering the ergonomics more carefully here.

One idea might be to allow passing module imports to the new Worker() constructor when using the new source form:

import source mod from './mod.wasm';
const memory = new WebAssembly.Memory(...);
const worker = new Worker(source, {
  imports: {
    'memory': memory
  }
});

Normally for dynamic import() this sort of resolution override is dangerous due to mismatch with existing imports, but as the creator of the module environment it could be framed as a sort of top-level-only import map, so that setting imports for context creation can certainly work actually.

@sbc100 let me know if I'm summarizing the issue correctly or missing anything here too.

Lingua principale
WebAssembly
Stelle
458
Fork
40
Merge medio
10g 37m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebAssembly/esm-integration

Tutte le issue di WebAssembly/esm-integration

Issue simili

Altre issue su Web Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.