From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 52BFA7F734 for ; Thu, 10 Sep 2015 12:54:38 +0200 (CEST) IronPort-PHdr: 9a23:1u21TROPqgWTRCVqUBIl6mtUPXoX/o7sNwtQ0KIMzox0KPX9rarrMEGX3/hxlliBBdydsKIYzbOI+Pu8EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35jxjr75oMGbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzhQBCX62FUdmILkwEAKg7J4QvhU5G55in3rfJwwm+eOtD3VvY9Xziv9bxmTjfnjS4GM3gy92SB2eJqi6cOiRStqgZki6DJb4ScMvw2Kqrbcd4AXkJPQ8lUXipHRIWxc91cXKI6Ie9Eotyl9BM1phykCFzpXbu3xw== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=anders@fugmann.net; spf=Pass smtp.mailfrom=anders@fugmann.net; spf=None smtp.helo=postmaster@gw.fugmann.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of anders@fugmann.net) identity=pra; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="anders@fugmann.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of anders@fugmann.net designates 90.184.182.235 as permitted sender) identity=mailfrom; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="anders@fugmann.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@gw.fugmann.net) identity=helo; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="postmaster@gw.fugmann.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AaBQD/X/FV/+u2uFpdgncsgT2DJsIBAoFCPBABAQEBAQEBAYEJgh2CBwEBBCMVCAEBNgEBDwsYAgIFFggDAgIJAwIBAgE0EQYNBgICF4gUA7YUcYRlAQWPMAEBAQEGAhoGgSKKTIQ0WAeCaYFDlVuNS5onOCuCAw0cgVZvhwKBRwEBAQ X-IPAS-Result: A0AaBQD/X/FV/+u2uFpdgncsgT2DJsIBAoFCPBABAQEBAQEBAYEJgh2CBwEBBCMVCAEBNgEBDwsYAgIFFggDAgIJAwIBAgE0EQYNBgICF4gUA7YUcYRlAQWPMAEBAQEGAhoGgSKKTIQ0WAeCaYFDlVuNS5onOCuCAw0cgVZvhwKBRwEBAQ X-IronPort-AV: E=Sophos;i="5.17,504,1437429600"; d="scan'208";a="176832243" Received: from gw.fugmann.net ([90.184.182.235]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 10 Sep 2015 12:54:37 +0200 Received: from [IPv6:2a01:3a0:1:601:cabc:c8ff:fe9f:e077] (unknown [IPv6:2a01:3a0:1:601:cabc:c8ff:fe9f:e077]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by gw.fugmann.net (Postfix) with ESMTPSA id 90B1A2930474; Thu, 10 Sep 2015 12:54:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fugmann.net; s=mail; t=1441882475; bh=9yYiz4RMSkBttRTJ+vPArcIwXlF9l7oW46a5x4EN/cM=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=do0bnJhmik37loAy8xwvtqT5BFKkuFe6UZBnP8nmWwsPRo3+/I41vYc3CDyI8Apys sFFcta+vKPBSesM69HQ8477KSR0rRVb2AFYu+/4vZ9O6cCVtFeOip2Iga/y1Kp5Pt9 AVzWD82dKHkgLmCLGyYIoTr5ycDJFfD5r09ZBmqU= To: Jesper Louis Andersen References: <55F085FE.7010809@fugmann.net> <55F08FB2.2090103@fugmann.net> Cc: Caml List From: Anders Fugmann Message-ID: <55F16169.3070001@fugmann.net> Date: Thu, 10 Sep 2015 12:54:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Exceptions and backtraces 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 > 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.