asmjs
asmjs copied to clipboard
Stack trampolines
The asm.js port supports stack trampolines: it's quite easy since we can catch function calls to invalid addresses, then make sure those addresses actually point to data, not code, that will tell us how to proceed.
By contrast, with WebAssembly, I think we need to do things the hard way: when constructing a stack trampoline, we grow our function table by one new entry, for this nested function, and call it normally afterwards.
But how do we then dispose of the new function table entry? The GCC trampoline code is fairly general, but appears to lack an option to clean up when the trampoline is no longer needed. I'm looking at GIMPLE_WITH_CLEANUP_EXPR, but haven't really found an example of how to use it.