WebAssembly / wasm-c-api

Wasm C API prototype
Apache License 2.0
550 stars 77 forks source link

Request for clarification: why only one engine? #59

Closed ggreif closed 5 years ago

ggreif commented 5 years ago

The readme states:

The VM must be initialised by creating an instance of an engine (wasm::Engine/wasm_engine_t) and is shut down by deleting it. Such an instance may only be created once per process.

I removed the block. Then spun an engine up and down, then another up. But when creating a store, it crashed. Backtraces point into v8. Looks like there is some kind of history effect.

So is this restriction a self imposed one to avoid the necessity to deal with a buggy v8, or is there some fundamental reason that no subsequent engines can be created?

Motivation: I have tests that would profit from the ability to toggle the creation of engines many times in the scope of a linux process.

rossberg commented 5 years ago

It's inherent in the implementation of V8 (and presumably other engines) that they cannot be initialised twice. It should never be needed either, creating a new store gives you a fresh "instance" of the VM.

ggreif commented 5 years ago

Accepted.