wapc/wapc-rust

Update to wasmtime 0.15.0

autodidaddict opened this issue · 1 comments

Wasmtime 0.15.0 has one large breaking change, the removal of the Callable trait. Now, it works more like what wasmer did with the Context, where the signature of the function you pass to Func::new() takes a Caller struct, which allows you to access the exports of the instance.

The main issue I see is that right now each of the Callable objects that we've got is storing a reference to the instance (this is now superfluous), but it's also storing the module state, which has all of the "current values" for the guest request, response, error, etc that facilitate the waPC protocol.

Those values will likely have to be moved into a hashmap stored in a lazy_static to keep the values/call state isolated between modules. What's even more difficult is that without module state being bound to individual callbacks, we need to figure out another way to uniquely identify/number the wasm modules so they can be distinguished both for individual call state and for consuming libraries (like wascc)

@thomastaylor312 I think the sticking point here is in figuring out how to assign each of the modules a unique identifier so that it can distinguish its call state from that of the other modules. Any thoughts on how this might work within wasmtime?