And for very small data used only locally within a function, e.g. a ComplexF64
value or a 3-component StaticArray
, it can avoid both the heap and the stack and store the data directly in registers.
Moreover, because modern CPUs typically have more physical registers than are exposed in the instruction set, with register renaming my understanding is that the CPU itself can take a nominally stack-allocated value and store it in a register instead, e.g. to eliminate a register spill.