From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: GNU Guile 2.9.8 Released [beta] Date: Sat, 11 Jan 2020 11:25:03 +0100 Message-ID: <87o8vaqohs.fsf@pobox.com> References: <87woaa3rq4.fsf@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="163145"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Jan 11 11:29:21 2020 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iqDxW-0001kQ-ND for guile-devel@m.gmane-mx.org; Sat, 11 Jan 2020 11:25:34 +0100 Original-Received: from localhost ([::1]:55980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqDxV-00087q-4V for guile-devel@m.gmane-mx.org; Sat, 11 Jan 2020 05:25:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51696) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqDxJ-00087D-Dg for guile-devel@gnu.org; Sat, 11 Jan 2020 05:25:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iqDxI-0006FD-8a for guile-devel@gnu.org; Sat, 11 Jan 2020 05:25:21 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:41913) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iqDxH-0005yk-Jc for guile-devel@gnu.org; Sat, 11 Jan 2020 05:25:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=dxEf7VpKVC3jPpjRFZdj5Zw4GxBzEyKAH0p5+Mc5EGw=; b=c8rjy5Cqb5jpIk0WtZlCbgEcopVrzrIUQ6KoVXgek6hrvxw63pe3N5VsH8ZYbmHJvqn7aX3uAgsyJPPmH9LMJ9X+GUKAD0Nvy7S9oFEkHB9Cc3xFRfTDP1hP4GVGYUSzg9uhUJ0iF0zVWcKqkF09eUSCPwIKxmYt7+61laIy+IwX3bzDABMWiQcwWIv1gtV7eu3UFRv+rjzuSFH75U7bxfFW57Y1PkcSWgNIVSMZ7JGK+TA6GstLXXWxxjyDn/N5qfwKk7SU+lcijGMNLPkj5exiu+YSuycmL2zexSmjrsrVgIpOh4bf/O/HZBwMHlxvZmiZvRZc/QWhPtSYbJZutg==; Original-Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iqDxC-0003AB-1e; Sat, 11 Jan 2020 11:25:14 +0100 In-Reply-To: (Stefan Israelsson Tampe's message of "Thu, 9 Jan 2020 22:14:05 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:20249 Archived-At: On Thu 09 Jan 2020 22:14, Stefan Israelsson Tampe = writes: > In language/cps/closure-conversion.scm:=20 > 749:15 5 (_ 2705 _)=20 > 771:22 4 (lp # =E2=80=A6)=20 > 771:22 3 (lp # =E2=80=A6)=20 > 771:22 2 (lp # =E2=80=A6)=20 > 610:11 1 (allocate-closure _ _ _ _ _ 1)=20 Nice bug! I wish I had a test case :) Can you try the following patch and see if it fixes the issue for you? Cheers, Andy diff --git a/module/language/cps/closure-conversion.scm b/module/language/c= ps/closure-conversion.scm index 1452212f0..17a81f674 100644 --- a/module/language/cps/closure-conversion.scm +++ b/module/language/cps/closure-conversion.scm @@ -1,6 +1,6 @@ ;;; Continuation-passing style (CPS) intermediate language (IL) =20 -;; Copyright (C) 2013-2019 Free Software Foundation, Inc. +;; Copyright (C) 2013-2020 Free Software Foundation, Inc. =20 ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -596,6 +596,17 @@ term." ($continue ktag0 src ($primcall 'allocate-words/immediate `(closure . ,(+ nfree = 2)) ()))))) + (#(#t 0) + (with-cps cps + (build-term ($continue k src ($const #f))))) + (#(#t 1) + ;; A well-known closure of one free variable is replaced + ;; at each use with the free variable itself, so we don't + ;; need a binding at all; and yet, the continuation + ;; expects one value, so give it something. DCE should + ;; clean up later. + (with-cps cps + (build-term ($continue k src ($const #f))))) (#(#t 2) ;; Well-known closure with two free variables; the closure is a ;; pair. @@ -666,17 +677,6 @@ bound to @var{var}, and continue to @var{k}." (#(#f 0) (with-cps cps (build-term ($continue k src ($const-fun kfun))))) - (#(#t 0) - (with-cps cps - (build-term ($continue k src ($const #f))))) - (#(#t 1) - ;; A well-known closure of one free variable is replaced - ;; at each use with the free variable itself, so we don't - ;; need a binding at all; and yet, the continuation - ;; expects one value, so give it something. DCE should - ;; clean up later. - (with-cps cps - (build-term ($continue k src ($const #f))))) (#(well-known? nfree) ;; A bit of a mess, but beta conversion should remove the ;; final $values if possible.