guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Guile 2.9.8 Released [beta]


From: Andy Wingo
Subject: Re: GNU Guile 2.9.8 Released [beta]
Date: Sat, 11 Jan 2020 11:25:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

On Thu 09 Jan 2020 22:14, Stefan Israelsson Tampe <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]