public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Paul Koning <paulkoning@comcast.net>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Turn on LRA on all targets
Date: Fri, 16 Feb 2024 07:47:48 -0600	[thread overview]
Message-ID: <20240216134748.GF19790@gate.crashing.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2402152341510.3971@angie.orcam.me.uk>

On Fri, Feb 16, 2024 at 11:34:55AM +0000, Maciej W. Rozycki wrote:
>  Not really, in particular because EH unwinding has to be reliable and 
> heuristics inherently is not.

Yup.  Which is why I did 0359465c703a for rs6000 six years ago (how time
flies!)  The commit message for that includes

    To find out where on-entry register values live at any point in a
    program, GDB currently tries to parse to parse the executable code.
    This does not work very well, for example it gets confused if some
    accesses to the stack use the frame pointer (r31) and some use the
    stack pointer (r1).  A symptom is that backtraces can be cut short.

and the patch does

+  /* By default, always emit DWARF-2 unwind info.  This allows debugging
+     without maintaining a stack frame back-chain.  It also allows the
+     debugger to find out where on-entry register values are stored at any
+     point in a function, without having to analyze the executable code (which
+     isn't even possible to do in the general case).  */
+#ifdef OBJECT_FORMAT_ELF
+  opts->x_flag_asynchronous_unwind_tables = 1;
+#endif

We went through very many refinements of the heuristics through the
years, but at some point you just have to give up: heuristics never
can make up for missing information.

>  Consequently the more aggressive the compiler has become to schedule
> function body instructions within a function's prologue the more lost the 
> machine code interpreter has become.  Ultimately it would have to become a 
> full-fledged CPU simulator to do its heuristics.

Yup, exactly.

> In reality it means the 
> unwinder may fail to produce acceptable results, which will happen at any 
> frequency between hardly ever to most often, depending on the exact 
> circumstances.

Yes.  If the compiler optimises the *logue code well, there is no way
heuristics can follow that.

>  Conversely no heuristics is required to unwind VAX frames, because they 
> are fixed in layout by hardware, fully self-described, and with the 
> hardware frame pointer always available.

The downside of the VAX situation of course is that the compiler has no
freedom to optimise the frame and *logue code at all, let alone well.
This may not matter so much on narrow ucoded in-order machines, there
are different balances there :-)


Segher

  reply	other threads:[~2024-02-16 13:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23 16:47 Segher Boessenkool
2023-04-23 17:01 ` Jeff Law
2023-04-23 20:23   ` Segher Boessenkool
2023-04-24  8:42   ` Andreas Schwab
2023-04-23 18:36 ` Paul Koning
2023-04-23 20:19   ` Segher Boessenkool
2023-04-23 18:56 ` Maciej W. Rozycki
2023-04-23 20:33   ` Segher Boessenkool
2023-05-15 21:09     ` Maciej W. Rozycki
2023-05-15 21:16       ` Sam James
2024-02-15 19:34         ` Sam James
2024-02-15 22:56           ` Segher Boessenkool
2024-02-16  1:41             ` Paul Koning
2024-02-16 10:22               ` Segher Boessenkool
2024-02-15 22:21       ` Paul Koning
2024-02-16 11:34         ` Maciej W. Rozycki
2024-02-16 13:47           ` Segher Boessenkool [this message]
2024-02-16 14:23             ` Maciej W. Rozycki
2024-02-16 14:31               ` Jakub Jelinek
2024-02-16 17:01                 ` Maciej W. Rozycki
2024-02-17  0:38                   ` Maciej W. Rozycki
2024-02-16 14:50           ` Paul Koning
2023-04-23 21:06 ` Uros Bizjak
2023-04-24  9:17   ` Segher Boessenkool
2023-04-24  9:46     ` Uros Bizjak
2023-04-29 14:38       ` Segher Boessenkool
2023-04-24  8:19 ` Richard Biener
2023-04-24  9:44   ` Segher Boessenkool
2023-04-30 19:52 ` Jeff Law
2023-04-29 13:37 Roger Sayle
2023-04-29 15:06 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240216134748.GF19790@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=macro@orcam.me.uk \
    --cc=paulkoning@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).