From: Andy Wingo <wingo@pobox.com>
To: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: GNU Guile 2.9.8 Released [beta]
Date: Sat, 11 Jan 2020 11:25:03 +0100 [thread overview]
Message-ID: <87o8vaqohs.fsf@pobox.com> (raw)
In-Reply-To: <CAGua6m1FF7Knhc-aNuQkd9m4EgYLtSEzVe11cV90_2dOcNuksw@mail.gmail.com> (Stefan Israelsson Tampe's message of "Thu, 9 Jan 2020 22:14:05 +0100")
On Thu 09 Jan 2020 22:14, Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
> In language/cps/closure-conversion.scm:
> 749:15 5 (_ 2705 _)
> 771:22 4 (lp #<intmap 0-18,20-22,24-29,32-36,38,40-42,44,46-48,…> …)
> 771:22 3 (lp #<intmap 0-18,20-22,24-29,32-36,38,40-42,44,46-48,…> …)
> 771:22 2 (lp #<intmap 0-18,20-22,24-29,32-36,38,40-42,44,46-48,…> …)
> 610:11 1 (allocate-closure _ _ _ _ _ 1)
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/cps/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)
-;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2020 Free Software Foundation, Inc.
;;;; 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.
prev parent reply other threads:[~2020-01-11 10:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 13:36 GNU Guile 2.9.8 Released [beta] Andy Wingo
2020-01-02 14:32 ` Matt Wette
2020-01-03 5:34 ` Nala Ginrut
2020-01-03 9:02 ` tomas
2020-01-05 10:41 ` Andy Wingo
2020-01-07 20:00 ` Stefan Israelsson Tampe
2020-01-07 21:42 ` Andy Wingo
2020-01-08 14:22 ` Nala Ginrut
2020-01-11 10:32 ` Andy Wingo
2020-01-13 16:32 ` Stefan Israelsson Tampe
2020-01-14 8:49 ` Nala Ginrut
2020-01-18 19:43 ` Nala Ginrut
2020-01-26 3:16 ` Nala Ginrut
2020-01-09 21:14 ` Stefan Israelsson Tampe
2020-01-11 10:25 ` Andy Wingo [this message]
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8vaqohs.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=stefan.itampe@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 read-only IMAP folder(s) and NNTP newsgroup(s).