3 ms·
Ha, well. I just spent a fair bit of time writing an interpreter in assembly and hand-optimized the regalloc to the limit. But I was surprised by my competitors
by titzer 5y ago
Ha, well. I just spent a fair bit of time writing an interpreter in assembly and hand-optimized the regalloc to the limit. But I was surprised by my competitors written in C and how well gcc, in particular, could regalloc hairy interpreter loops. Compilers are very good at register allocation at the right granularity; they just generally don't do it across procedures.
- zozbot234 5y ago> they just generally don't do it across procedures. They won't do it for extern (i.e. separately compiled) calls, because the ABI wouldn't really allow for anything of the sort. But calls to static (or inline) procedures that only have visibility within a single source file can occur with arbitrary calling conventions, so the compiler is free to optimize register allocation across procedures.
- pjmlp 5y agoSure it is a matter of how good the regalloc algorithm is, and how many registers are there to play with. My point was more about how we are willing to trade the optimal performance for something that gets us there most of the time, while offering much more productive tooling.