3 ms·
The article does not distinguish between recursive and nested subroutine calls. I understand, why the provided example does not allow for recursion, but doesn'
by weinzierl 3y ago
The article does not distinguish between recursive and nested subroutine calls.
I understand, why the provided example does not allow for recursion, but doesn't it also prevent a nested call to another subroutine?
If I remember correctly before FORTRAN90 we already had nested subroutine calls. How did that work?
EDIT: I think I get it. The hidden global variables are prefixed with the sub's name. This is pretty wasteful, but as long as a function does not call itself (even indirectly) we are good.
- comex 3y agoIt does allow nested calls, because each function has its own storage for the return address and local variables.
- dbcurtis 3y agoNor reentrant. In machines where the JSR that stores the return address at the jump target, usually interrupts are locked for 1 following instruction so that you have a chance to load the return address into the accumulator. Back in the day I worked with a RTOS on one of those beasties.
- kps 3y agoOn some systems, arguments were stored at the call site, typically immediately after the call instruction, where the callee could use the return address to find and skip over them. This made calls using constant arguments easy. CALL MUL 2 3 BNE 6, FAIL