4 ms·
What high-level language feature causes inherently increased register pressure?
by titzer 5y ago
What high-level language feature causes inherently increased register pressure?
- pjmlp 5y agoAssembly allows to use all of them, and there is no need to reserve any for ABI, other than syscalls or specific opcode requirements. On high level languages one needs to hope that the register allocator does a good job.
- titzer 5y agoHa, 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.