caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anders Fugmann <anders@fugmann.net>
To: Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Exceptions and backtraces
Date: Thu, 10 Sep 2015 12:54:33 +0200	[thread overview]
Message-ID: <55F16169.3070001@fugmann.net> (raw)
In-Reply-To: <CAGrdgiVLt1XFF1XXA8vhB0WAkAhC2DGciTDoKNGKku842iJrZw@mail.gmail.com>

Yes. Tail call optimization and inlining will limit the usability of the 
stack traces.

I assume that inlining can be disabled with -inline 0 (and it is not a 
problem for bytecode).

The tail call optimization pass is more problematic in terms of produced 
stack trace, and I don't see any good solution to this.

Maybe it would be possible to just count number of function calls within 
the same stack frame. The back trace would then print the function call 
counts in addition to the regular stack trace.
Another possibility would be to only perform TCO on recursive functions.

/Anders


On 09/10/2015 11:45 AM, Jesper Louis Andersen wrote:
>
> On Wed, Sep 9, 2015 at 9:59 PM, Anders Peter Fugmann <anders@fugmann.net
> <mailto:anders@fugmann.net>> wrote:
>
>     It just occurred to me that the functions I made are tail recursive
>     and which is why the middle function call is eliminated.
>
>
> Or even worse, tail calling. This, and aggressive inlining are the two
> things which most often rears its ugly head when hunting for why a piece
> of code is breaking some invariant. You have to "guess" at what the
> compiler did to the code base and reconstruct the code path from this.
>
> On the other hand, you don't want to lose either of those two optimizations.
>
> I agree it is worthwhile to document both behaviours.
>
>
> --
> J.


  reply	other threads:[~2015-09-10 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09 19:18 Anders Peter Fugmann
2015-09-09 19:59 ` Anders Peter Fugmann
2015-09-10  9:45   ` Jesper Louis Andersen
2015-09-10 10:54     ` Anders Fugmann [this message]
2015-09-10 11:09       ` Jesper Louis Andersen

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=55F16169.3070001@fugmann.net \
    --to=anders@fugmann.net \
    --cc=caml-list@inria.fr \
    --cc=jesper.louis.andersen@gmail.com \
    /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 NNTP newsgroup(s).