Date: Thu, 29 Apr 2021 19:01:56 +0300
On 4/29/21 6:44 PM, Edward Catmur wrote:
> On Thu, 29 Apr 2021 at 16:20, Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
>
> On 4/29/21 5:39 PM, Edward Catmur via Std-Proposals wrote:
> > On Thu, 29 Apr 2021 at 13:28, Andrey Semashev via Std-Proposals
> > Presumably, someone has to tell the runtime to collect the
> stacktrace,
> > and, if I understood you right, that someone is supposed to
> be the
> > compiler, which sees a std::current_exception_stacktrace call
> in the
> > catch block.
> >
> > Yes? That sounds entirely feasible.
>
> No, it doesn't sound feasible at all. At least, not with current
> compiler technology. And in case if you bring up link-time code
> generation, no, it is not the answer. As any other optimization, it is
> entirely optional and must not affect the program behavior.
>
> Quick sketch: the compiler sets a directive at the catch site to request
> stacktrace,
The compiler would do that based on what?
> which the personality routine observes and allocates a
> stacktrace array reachable via the __cxa_exception, then when it is
> called again in unwind phase it populates. What's wrong with this
> technique?
> On Thu, 29 Apr 2021 at 16:20, Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
>
> On 4/29/21 5:39 PM, Edward Catmur via Std-Proposals wrote:
> > On Thu, 29 Apr 2021 at 13:28, Andrey Semashev via Std-Proposals
> > Presumably, someone has to tell the runtime to collect the
> stacktrace,
> > and, if I understood you right, that someone is supposed to
> be the
> > compiler, which sees a std::current_exception_stacktrace call
> in the
> > catch block.
> >
> > Yes? That sounds entirely feasible.
>
> No, it doesn't sound feasible at all. At least, not with current
> compiler technology. And in case if you bring up link-time code
> generation, no, it is not the answer. As any other optimization, it is
> entirely optional and must not affect the program behavior.
>
> Quick sketch: the compiler sets a directive at the catch site to request
> stacktrace,
The compiler would do that based on what?
> which the personality routine observes and allocates a
> stacktrace array reachable via the __cxa_exception, then when it is
> called again in unwind phase it populates. What's wrong with this
> technique?
Received on 2021-04-29 11:02:03