Subroutine calls in the ancient world, before computers had stacks or heaps

Raymond Chen explains how older computers operated without stacks or heaps for dynamic memory allocation. To simulate variable-sized data, fixed-size memory buffers were used, with global variables representing function parameters, return addresses, and local variables. Function calls happened by assigning values to these secret global variables. Recursion was impractical due to overwriting return addresses. Some processors used self-modifying code or added subroutine call instructions to address this. FORTRAN didn’t initially support subroutines or recursion. The unique approach to memory allocation without stacks or heaps highlights the evolution of computing languages and processors over time.

https://devblogs.microsoft.com/oldnewthing/20240401-00/?p=109599

To top