kanaka / warpy

WebAssembly interpreter in RPython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extending warpy to allow for full state dump

void4 opened this issue · comments

commented

I'm interested in building a WebAssembly interpreter that supports not only dumping the memory, globals and tables, but the full stack state as well. Do you think it is sensible to build on your project to achieve this?

The overhead may wipe out some JIT advantages, but as long as its not worse than a 10x slowdown, I'm fine with that.

Edit: Oh, I see warpy already has tracing built in! Sweet!

warpy doesn't implement the full MVP specification. The signed/unsigned and 32-bit/64-bit conversions turned out to be harder than expected in rpython.

I also have a C implementation that does have a full implementation. If you recompile with TRACE flag turned on you should get a lot of trace information about the stack. I don't recall if it's the full stack or just part of the top of the stack but it should be pretty easy to extend to print the full stack if that's what you need.

Also, if you know rpython or want to learn, I would be happy to take pull requests to add full MVP support to warpy :-)

commented

I might try to implement this for warpy if I get far enough. I once tried to implement my own interpreter in RPython, but the lack of documentation and explicit typing made it very painful.

My main goal is building or extending an interpreter to support serializing the entire execution state on demand, to be able to resume execution somewhere else. Stackless python can do this, but it's not a good general compiler target, not deterministic and not sandboxable.

My first interpreter can do fun stuff like this:

https://twitter.com/dd4ta/status/964196870645010433

https://twitter.com/dd4ta/status/998342411301646336

Now I'm trying to build a similar system for Wasm.