GNU bug report logs -
#70398
[PATCH 0/5] Reduce the size of gnu/packages/*.go files
Previous Next
Reported by: Ludovic Courtès <ludo <at> gnu.org>
Date: Mon, 15 Apr 2024 15:29:03 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
At -O1, peval does the bulk of the optimization work and it cannot
reduce things like (null? (list 1 2)), unlike what happens in CPS at
-O2. Thus, reduce the part of ‘sanitize-inputs’ that’s inlined.
* guix/packages.scm (maybe-add-input-labels): New procedure.
(sanitize-inputs): Turn into a macro; use ‘maybe-add-input-labels’.
Change-Id: Id2283bb5a2f5d714722200bdcfe0b0bfa606923f
---
guix/packages.scm | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 930b1a3b0e..bd6724cdd4 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2023 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012-2024 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2014, 2015, 2017, 2018, 2019 Mark H Weaver <mhw <at> netris.org>
;;; Copyright © 2015 Eric Bavier <bavier <at> member.fsf.org>
;;; Copyright © 2016 Alex Kost <alezost <at> gmail.com>
@@ -430,15 +430,26 @@ (define %cuirass-supported-systems
;; <https://lists.gnu.org/archive/html/guix-devel/2017-03/msg00790.html>.
(fold delete %supported-systems '("mips64el-linux" "powerpc-linux" "riscv64-linux")))
-(define-inlinable (sanitize-inputs inputs)
- "Sanitize INPUTS by turning it into a list of name/package tuples if it's
-not already the case."
- (cond ((null? inputs) inputs)
+(define (maybe-add-input-labels inputs)
+ "Add labels to INPUTS unless it already has them."
+ (cond ((null? inputs)
+ inputs)
((and (pair? (car inputs))
(string? (caar inputs)))
inputs)
(else (map add-input-label inputs))))
+(define-syntax sanitize-inputs
+ ;; This is written as a macro rather than as a 'define-inlinable' procedure
+ ;; because as of Guile 3.0.9, peval can handle (null? '()) but not
+ ;; (null? (list x y z)); that residual 'null?' test contributes to code
+ ;; bloat.
+ (syntax-rules (quote)
+ "Sanitize INPUTS by turning it into a list of name/package tuples if it's
+not already the case."
+ ((_ '()) '())
+ ((_ inputs) (maybe-add-input-labels inputs))))
+
(define-syntax current-location-vector
(lambda (s)
"Like 'current-source-location' but expand to a literal vector with
--
2.41.0
This bug report was last modified 1 year and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.