Thomas Neumann via Gcc <[email protected]> writes:

> I would like to use -fsplit-stack for some recursion heavy C++ code,
> but I noticed that it currently has severe issues, which prevents
> practical usage, but which are fixable: 1) currently a stack switch
> costs about 167ns due to signal blocking, which is prohibitive in hot
> loops 2) the stack computation for signal handlers is wrong, which
> leads to crashes on machines with AVX-512 support, and 3) a signaler
> handler with split stack causes a crash if the signal happens during
> exception unwinding.
>
> I have prototype fixes for all three (x86-64 only for now). By making
> __morestack re-entrant safe we can avoid signal blocking, bringing
> stack switch cost to about 5ns, which fixes the hot loop problem. The
> other two are largely classical bug fixes.
>
> Before working on this more, are you actually interested in reviving
> this functionality? I got the impression that the code is hardly used
> at all (except for go, which uses a separate signal stack and thus
> avoids some of these problems). But I think it would be useful to make
> it work, as it makes recursive functions much more practical.

Note that signal handling is under control of the application, via the
__splitstack_block_signals function.

But making __morestack signal safe sounds like a good idea anyhow. I
would support that.

Ian

Reply via email to