C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Monitor recursion by checking the frame pointer

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 17 Apr 2023 15:50:10 +0100
On Mon, Apr 17, 2023 at 3:17 PM Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> However, you said "frame pointer" but listed RSP for x86. That's the wrong
> register. The frame pointer on x86 is RBP and it doesn't need to be kept. In
> optimised code, if the compiler can avoid needing RBP for the frame pointer
> and free it instead for a variable, that improves performance, due to the
> shortage of available general-purpose registers. So you cannot count on there
> being a frame pointer on x86.


RBP can look like RSP when one is skimming over a post. I wrote RBP.

Anyway, the use of "std::frame_pointer" inside a function would be an
indicator to the compiler to actually use the frame pointer. If it
really doesn't want to use the frame pointer, it can return nullptr.

Received on 2023-04-17 14:50:23