Hi,

I've been experimenting with implementing my own WebAssembly interpreter 
(https://github.com/joshuawarner32/rust-wasm), and I'm starting to throw 
some more complicated examples at it.  An emscripten/binaryen-compiled `int 
main() { return 42; }` works just fine, but once I graduate to `int main() 
{ printf("Hello"); }`, I start running into some problems with 
initial-conditions that the WebAssembly module expects.

Taking a step back, it looks like emscripten is generating a large 
javascript wrapper around the wasm module, and the wasm module is highly 
dependent on this external helper.  I'd like to avoid shipping a javascript 
engine next to my wasm interpreter, which means I'm left translating that 
wrapper code by hand.

Some of the relevant things that the wrapper seems to contain:
* Memory initialization - why can't this be done with standard `(memory ... 
(segment ...))` stuff, directly in the wasm module?
* Calling some initialization routines - possibly including 
`establishStackSpace` - again, why can't this be done in the `start` 
function of the wasm module?
* (Some other things that I'm clearly missing, since I have yet to get 
HelloWorld working on _any_ wasm interpreter (including v8), without the 
wrapping javascript)

In short, I'd like to get emscripten to generate a wasm module that, to the 
extent possible, doesn't depend on any javascript wrapper.

How small can I get the logic in that wrapper?

Any pointers on places in the emscripten code that I can poke at to push 
things in this direction?  I'd love to upstream some improvements if 
possible.

Thanks,
Joshua

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to