guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 02/04: Fix reproducibility for inlinable-exports


From: Andy Wingo
Subject: [Guile-commits] 02/04: Fix reproducibility for inlinable-exports
Date: Tue, 1 Feb 2022 12:27:17 -0500 (EST)

wingo pushed a commit to branch main
in repository guile.

commit 9654ab1f210720b55a2511a425f93abb48375bf4
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Tue Feb 1 12:16:12 2022 +0100

    Fix reproducibility for inlinable-exports
    
    * module/language/tree-il/inlinable-exports.scm (compute-decoder): Map
    items in order of their code.
---
 module/language/tree-il/inlinable-exports.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/module/language/tree-il/inlinable-exports.scm 
b/module/language/tree-il/inlinable-exports.scm
index 0873fb078..76bb7da9f 100644
--- a/module/language/tree-il/inlinable-exports.scm
+++ b/module/language/tree-il/inlinable-exports.scm
@@ -753,6 +753,12 @@
               (make-struct/simple (@ ,mod ,name) ,@fields)))))))
   (define (constant-clause constant code)
     `((eq? code ,code) ',constant))
+  (define (map-encodings f table)
+    (map (match-lambda
+          ((value . code) (f value code)))
+         (sort (hash-map->list cons table)
+               (match-lambda*
+                (((_ . code1) (_ . code2)) (< code1 code2))))))
 
   `(lambda (bv)
      (define pos 0)
@@ -785,8 +791,8 @@
           ,@(if (symbol-code encoding)
                 (list (symbol-clause (symbol-code encoding)))
                 '())
-          ,@(hash-map->list vtable-clause (vtables encoding))
-          ,@(hash-map->list constant-clause (constants encoding))
+          ,@(map-encodings vtable-clause (vtables encoding))
+          ,@(map-encodings constant-clause (constants encoding))
           (else (error "bad code" code)))))))
 
 (define (encode term encoding)



reply via email to

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