GNU bug report logs - #61660
[feature request] optimization of case-lambda

Previous Next

Package: guile;

Reported by: lloda <lloda <at> sarc.name>

Date: Mon, 20 Feb 2023 17:57:02 UTC

Severity: wishlist

Tags: patch

Done: lloda <lloda <at> sarc.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: lloda <lloda <at> sarc.name>
Cc: 61660 <at> debbugs.gnu.org
Subject: bug#61660: [feature request] optimization of case-lambda
Date: Mon, 27 Feb 2023 11:11:29 +0100
Hi Daniel,

lloda <lloda <at> sarc.name> skribis:

> From 61ed612fb36108e395bdee4b1bbb46b49ef017b3 Mon Sep 17 00:00:00 2001
> From: Daniel Llorens <lloda <at> sarc.name>
> Date: Thu, 23 Feb 2023 17:38:10 +0100
> Subject: [PATCH] peval reduces some inlined case-lambda calls
>
> * module/language/tree-il/peval.scm (peval): Reduce multiple case lambda
>   in <call> trees according to the number of arguments. Do not try to
>   reduce case-lambda using keyword arguments.
> * test-suite/tests/peval.test: Tests.

[...]

> +++ b/module/language/tree-il/peval.scm
> @@ -1668,6 +1668,29 @@ top-level bindings from ENV and return the resulting expression."
>  
>                    (log 'inline-end result exp)
>                    result)))))
> +           (($ <lambda> src-proc meta orig-body)
> +            ;; If there are multiple cases and one matches nargs, omit all the others.
> +            (or (and
> +                 (lambda-case-alternate orig-body)
> +                 (let ((nargs (length orig-args)))
> +                   (let loop ((body orig-body))
> +                     (match body
> +                       (#f #f) ;; No matching case; an error.
> +                       (($ <lambda-case> src-case req opt rest kw inits gensyms case-body alt)
> +                        (cond (kw
> +                               ;; FIXME: Not handling keyword cases.
> +                               #f)

Maybe s/FIXME/XXX/ since it’s at most a limitation, certainly not a bug.

It LGTM and Andy already approved it on IRC, so go ahead!

Ludo’.




This bug report was last modified 2 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.