llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

Running llvmlite inside WebAssembly

Open seibert opened this issue 2 years ago • 0 comments

We've been shipping with the WebAssembly target enabled for a few years now, but given the recent announcement of PyScript, I think it is time to figure out how llvmlite would run inside of a WebAssembly environment as well. (This is with a goal in mind of eventually supporting Numba inside PyScript.)

It seems pretty clear from the WebAssembly spec (although please let me know if I'm misinterpreting it) that the usual approach that MCJIT uses of "write machine instructions to a page in virtual memory and then flip the execute bit" won't work for WebAssembly. Instead, I think we'll need to write out a module in the WASM virtual file system and then immediately dlopen() it, which we know that Pyiodide can do. I'm assuming the best way to implement this in llvmlite would be to write an alternative ExecutionEngine class that does this.

Not sure who is going to try this first, but wanted to start the discussion here. :)

seibert avatar May 02 '22 20:05 seibert