スタックフレームとは何か?
スタックフレームは、関数が呼び出されたときにプッシュされ、リターンするときにポップされるコールスタックの領域です。呼び出しの引数、ローカル変数、保存されたレジスタ、そして戻り先のアドレスを格納します。アクティブなフレームの連なりが、debuggerやstack traceが表示するコールスタックを形成します。
なぜ重要か
スタックフレームは、ローカル変数がリターン時に自動的に片付けられる理由であり、深い、または無限の再帰がstack overflowを引き起こす理由でもあります。フレームを読むことは、デバッグ中にstack traceを解釈するうえで中心的です。
関連ガイド
What Is a Tail Call?A tail call is a function call that is the last action in a function, allowing the current stack frame to be…
What Is a Calling Convention in an ABI?A calling convention in an ABI defines how functions pass arguments, return values, and preserve registers so…
What Is a Continuation?A continuation represents the rest of a computation at a given point, as a value that can be invoked later to…