Hacker News new | ask | show | jobs
by ejpbruel 763 days ago
I haven’t tried this, but Stitch should technically be able to run itself if we gave it a C-like API that you could export from a Wasm module. Would be fun to try at some point :-)
1 comments

Wouldn't you need to add support for the tail call extensions, return_call (opcode 0x12) and return_call_indirect (opcode 0x13)? Stitch doesn't appear to implement those, even though Stitch itself relies on TCO for instruction dispatch, for which (IIUC) LLVM would emit return_call or return_call_indirect.
That’s a good point! I did’t even think about that. For Stitch to become self hosting, we’d either have to implement those instructions, or implement a fallback mode using an interpreter loop with a trampoline. The latter would negate most of the speed benefits of Stitch though.
Interesting, thank you for explaining so clearly.