From 9654ab1f210720b55a2511a425f93abb48375bf4 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 1 Feb 2022 12:16:12 +0100 Subject: 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(-) (limited to 'module') 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) -- cgit v1.2.1