3 ms·
This is poorly written nonsense article. "In the beginning, CPUs gave you the basics: registers, memory access, CALL and RETURN instructions." Well, CALL and
by killerstorm 1y ago
This is poorly written nonsense article.
"In the beginning, CPUs gave you the basics: registers, memory access, CALL and RETURN instructions."
Well, CALL and RETURN need a stack: RETURN would need an address to return to. So there you go.
A concept of subroutine was definitely not introduced by C. It was an essential part of older languages like Algol and Fortran, and is inherently a good way to organize computation. E.g the idea is that you can implement matrix multiplication subroutine just once and then call it every time you need to multiply matrices. That was absolutely a staple of programming back in the day.
Synchronous calls offer a simple memory management convention: caller takes care of data structures passed to callee. If caller's state is not maintained then you need to take care of allocated data in some other way, e.g. introduce GC. So synchronous calls are the simpler, less opinionated option.
- eqvinox 1y ago> Well, CALL and RETURN need a stack: RETURN would need an address to return to. So there you go. I agree with the sentiment but you're making an impermissible contraction here. Look at how ARM calls work—the instructions are "bl <addr>" (branch and link) and "bx lr" (branch to register, lr). "bl" just stores the return address in the link register. The stack is something the machine code does on top of that. Of course the CPUs are optimised for standard ways of doing that, but it's not inherent to the system.
- estimator7292 1y agoWe're talking about historic CPUs
- Veserv 1y agoARMv1 in 1985 had branch and link [1]. [1] https://en.wikichip.org/wiki/arm/armv1 https://en.wikichip.org/wiki/arm/armv1