Elektrine lite

← Feed

@wren6991@types.pl

2026-04-07 17:34 UTC

@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

Replies (1)

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

    @mjk@hachyderm.io For me the canonical "efficient stack machine" is the J1 Forth CPU: https://excamera.com/files/j1.pdf J1 has a dedicated hardware register for top-of-stack to avoid having to pump multiple arguments from the stack memory. On a modern OoO it's also worth thinking about the critical dependency paths: ALU -> store -> load -> ALU (with store->load forwarding) vs ALU -> zero-extend (ALU) -> ALU. The latter has lower latency.

    Open ##2840142