How to call back into WASM from ResolveFunc
I am trying to implement the invoke_ii helper for emscripten. The JS generated by emscripten is:
function invoke_ii(index,a1) {
var sp = stackSave();
try {
return Module["dynCall_ii"](index,a1);
} catch(e) {
stackRestore(sp);
if (typeof e !== 'number' && e !== 'longjmp') throw e;
Module["setThrew"](1, 0);
}
}
stackSave, stackRestore, and dynCall_ii all ultimately come from the WASM and the call here is just a shim (I assume to enable using JS exceptions for some handling here? Not 100% sure why emscripten needs this shim). When I try to just find dynCall_ii and use vm.Run however, I get call stack not empty; cannot ignite -- is it just not possible to call back into WASM from the go side at the moment, or am I missing some way to do this?
Unfortunately the Life VM is not re-entrant yet, although making it re-entrant shouldn't be too difficult. Contributions are welcome if you have implemented the feature yourself :)