Why isnt it more widespread to implement the function call stack in hardware or at least have it closer to the CPU in the L1/L2 cache ?

Couldn't it save stacking/reading back function parameters to registers in the CPU by not having to travel to the memory each time ?

有帮助吗?

解决方案

Well, its a matter of price/performance trade of. For many reasons Modern CPU's use SRAM chips as cache. Unfortunately, SRAM is 1000 times pricier then cheap DDR3 you can buy at your local PC store. So, since you probably won't buy 15,000$ i7 CPU, just because it has 1 gig of SRAM L1 cache, no one will produce such. price/performance

Actually, CPU's implements sophisticate methods to compensate the lack of memory. Look for "cache management".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top