Elektrine lite

← Feed

@mjk@hachyderm.io

2026-04-05 11:52 UTC

If – on this grey Sunday morning – you would like to read a dozen pages about using tail calls for fast interpreters, then I have Excellent News for you: https://www.mattkeeter.com/blog/2026-04-05-tailcall/

Replies (4)

  • @mjk@hachyderm.io 2026-04-05 18:14

    alternatively, you can read this meme instead

    Open ##2840135

  • @aburka@hachyderm.io 2026-04-05 15:35

    @mjk@hachyderm.io how did you know I wanted nothing more than that

    Open ##2840136

  • @folkertdev@hachyderm.io 2026-04-06 14:22

    @mjk@hachyderm.io Neat, I'm working on moving tail calls in rust forward, and having a real but relatively small interpreter to benchmark is really useful! https://rust-lang.github.io/rust-project-goals/2026/tail-call-loop-match.html I think your post again shows though that it's really hard to strike a balance between actually useful functionality and something that is portable enough that it can be stabilized. E.g. preserve-none does not work for many LLVM targets. Something might come of this thread though: https://discourse.llvm.org/t/experience-with-clang-musttail/89085 Also with latest nightly the add function does not do the register shuffle/spill any more, though it's still not perfect and I can still roughly reproduce your benchmark results on x86_64. https://gist.github.com/folkertdev/9097f4621ac00ab7829a41cd8b9a38dc

    Open ##2840139

  • @wren6991@types.pl 2026-04-07 17:34

    @mjk@hachyderm.io Looks like some data movement could be eliminated in both the asm and codegen'd versions by explicitly keeping top-of-stack in a register. Also I like the "arguments are registers" trick, it reminds me of copy-and-patch

    Open ##2840141