Skip to content

Function Calls and Returns: Stack Frames, call, and ret ​

To the CPU, a function call is a small set of agreed-upon moves: call jumps in, the prologue sets the stage, the epilogue cleans up, and ret jumps back. This topic walks each move instruction by instruction; what leaf functions save, which way the stack grows, and what -O2 rewrites are all settled by assembly.

pdf-latest-41-gc317b3f · c317b3f · 2026-10-24