Introduce flag to prevent reallocation of shared memory
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
- wasm
- Ambito
- operating-systems
Direzione di ricerca
La issue non indica file del repository, test o punti di ingresso dell'implementazione; inizia esaminando la proposta WebAssembly threads e gli esempi di istanziazione di shared memory nel report. Stabilire se una cache di memoria o un flag associato al modulo rientrino nell'ambito, definirne il ciclo di vita e la semantica di incapsulamento e documentare i criteri di compatibilità e validazione prima dell'implementazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Instantiating a module more than once allocates new memory for each instance, what if, instead, there could be a flag that would cause all instances to refer to the same memory?
Instead of them being thread-local memories, they would be "global."
This allows Wasm to remain completely self-contained, encapsulated, and in control of its own memory.
Currently, shared memory is completely useless if not importing host shared memory, but every step in between the module getting its memory, and the host passing it to the module, leaves room for mutation, and unexpected change at runtime, as the host has control over the array buffer too.
Nothing more would need to be changed, it would just change the lifetime of the memory.
This could be implemented as a simple cache associated with the module.
Current loading (JS):
// main.mjs:
const memory = new WebAssembly.Memory({ ..., shared: true });
const {
instance,
module
} = await WebAssembly.instantiateStreaming(..., ...memory...);
const thread = new Worker("./worker.mjs", ...);
worker.postMessage({ memory, module });
// worker.mjs:
... // await .postMessage({ memory, module })
const instance = await WebAssembly.instantiate(module, ...memory...);
With cached memory:
// main.mjs:
const {
instance,
module
} = await WebAssembly.instantiateStreaming(...);
const thread = new Worker("./worker.mjs", ...);
worker.postMessage(module);
// worker.mjs:
... // await .postMessage(memory)
const instance = await WebAssembly.instantiate(module);
In the former example, the WebAssembly module's memory may be corrupted later at the will of the host, breaking encapsulation, but the way that multi-threaded Wasm loading works, it leaves no alternative.
Would this break any of the core motivations/ideas/philosophies behind WebAssembly?
- Lingua principale
- WebAssembly
- Stelle
- 767
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di WebAssembly/threads
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
WebAssembly/threads#254 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
WebAssembly/threads#253 · 6 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
WebAssembly/threads#245 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
WebAssembly/threads#240 ·
-
Branch renaming Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
WebAssembly/threads#237 ·
Tutte le issue di WebAssembly/threads
Issue simili
-
Bug Good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
johnsonjh/emu2-cpm86#61 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
arduino/arduino-app-lab#49 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zephyrproject-rtos/zephyr#120011 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ValveSoftware/Proton#10167 ·