4 ms·
Each instance has its own stack. Switching between them is cooperative on a single thread. What am I missing?
by couchand 3y ago
Each instance has its own stack. Switching between them is cooperative on a single thread. What am I missing?
- kevingadd 3y agoWebAssembly stores stack data - parameters, return addresses, local variables - in a "shadow stack" that does not live in the native heap your application has access to. There's no way for you to switch it.
- couchand 3y agoEach instantiated module has its own complete function call stack. A call out of the module, to a bit of control code in JS, and then into a different instance of the same module, with the same memory mappings, would look (to the program itself) like a stack switch, no? I guess it raises the philosophical question of what is a stack switch, anyway? If you end up cooperatively running multiple "green threads" within a single "OS thread" does it matter that what you actually switched was the entire execution environment?