From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#9542: peval error Date: Sun, 18 Sep 2011 12:00:30 +0200 Message-ID: <87mxe2gqil.fsf@gnu.org> References: <874o0kti4m.fsf@pobox.com> <87d3f4s7a3.fsf@gnu.org> <87litpaclc.fsf@pobox.com> <877h59fpl8.fsf@gnu.org> <87zki4pzyi.fsf@gnu.org> <87d3f09ex5.fsf@pobox.com> <87litni5lp.fsf@gnu.org> <8762kr9hra.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1316340079 2034 80.91.229.12 (18 Sep 2011 10:01:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 18 Sep 2011 10:01:19 +0000 (UTC) Cc: 9542@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Sep 18 12:01:15 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R5EBV-0002Vl-UF for guile-bugs@m.gmane.org; Sun, 18 Sep 2011 12:01:14 +0200 Original-Received: from localhost ([::1]:37370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EBV-0000PB-AX for guile-bugs@m.gmane.org; Sun, 18 Sep 2011 06:01:13 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EBS-0000Os-AP for bug-guile@gnu.org; Sun, 18 Sep 2011 06:01:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5EBP-0006br-V6 for bug-guile@gnu.org; Sun, 18 Sep 2011 06:01:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EBP-0006bh-SG for bug-guile@gnu.org; Sun, 18 Sep 2011 06:01:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R5EGA-0000nD-6f for bug-guile@gnu.org; Sun, 18 Sep 2011 06:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 18 Sep 2011 10:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9542 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13163403383011 (code B ref -1); Sun, 18 Sep 2011 10:06:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Sep 2011 10:05:38 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R5EFk-0000mR-Iw for submit@debbugs.gnu.org; Sun, 18 Sep 2011 06:05:37 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R5EFh-0000mJ-HL for submit@debbugs.gnu.org; Sun, 18 Sep 2011 06:05:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5EAw-0006Zk-1t for submit@debbugs.gnu.org; Sun, 18 Sep 2011 06:00:39 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:55869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EAv-0006Zg-UG for submit@debbugs.gnu.org; Sun, 18 Sep 2011 06:00:37 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EAu-0000Ol-Vz for bug-guile@gnu.org; Sun, 18 Sep 2011 06:00:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5EAt-0006ZP-H8 for bug-guile@gnu.org; Sun, 18 Sep 2011 06:00:36 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:60373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5EAt-0006ZJ-B6 for bug-guile@gnu.org; Sun, 18 Sep 2011 06:00:35 -0400 Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id 5E41D44653; Sun, 18 Sep 2011 12:00:32 +0200 (CEST) In-Reply-To: <8762kr9hra.fsf@pobox.com> (Andy Wingo's message of "Sat, 17 Sep 2011 10:54:33 -0700") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Jour du =?UTF-8?Q?G=C3=A9nie?= de =?UTF-8?Q?l'Ann=C3=A9e?= 219 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 18 Sep 2011 06:06:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5838 Archived-At: Hi Andy, Andy Wingo skribis: > Still, though, the results are not great: [...] > Here we see that `fold' was inlined once, but to no use. More code for > no more speed. Yes. OTOH, it was inlined *and* specialized; peval only =E2=80=9Cinlines= =E2=80=9D where=E2=80=99s there=E2=80=99s at least one static argument (known at comp= ile-time), in which case there=E2=80=99s room for specialization (in this example, *, 1, zero?, and the anonymous lambdas were propagated/resolved as primitives.) In the above example, I agree that we can argue that inlining wasn=E2=80=99t useful. > Waddell and Dybvig report on similar problems in their inlining paper > (Fast and Effective Procedure Inlining, IU CS Dept. TR 484). See > section 4.4 where they discuss this and similar problems. We should > figure out what we can do in these cases; and in the case where we can't > fully inline a call site, perhaps we should abort the attempt to inline > it. Right. I think we should avoid inlining when recursive calls appear in the residual code, as mentioned in the referred section. WDYT? Now, the current heuristic in peval is to =E2=80=9Cinline=E2=80=9D procedur= es only at call sites with static arguments. Conversely, a general procedure inlining algorithm like Waddell=E2=80=99s may inline even when there are on= ly dynamic arguments. This puts more pressure on the inlining criteria because there are many more potential inlining opportunities. I don=E2=80=99t think an optimization heuristic can be optimal in all cases. So the question is not whether we can find such pathological cases, but how frequent they are in practice. So I think we must keep an eye on the optimized code, like you did, to find out more. Thanks for your feedback! Ludo=E2=80=99.