I'm a beginner in assembly language and have noticed that the x86 code emitted by compilers usually keeps the frame pointer around even in release/optimized mode when it could use the EBP
register for something else.
I understand why the frame pointer might make code easier to debug, and might be necessary if alloca()
is called within a function. However, x86 has very few registers and using two of them to hold the location of the stack frame when one would suffice just doesn't make sense to me. Why is omitting the frame pointer considered a bad idea even in optimized/release builds?
alloca
) 3. ease of runtime implementation: exceptoins handling, sandbox, GC