unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: lloda <lloda@sarc.name>
Cc: 61660@debbugs.gnu.org
Subject: bug#61660: [feature request] optimization of case-lambda
Date: Mon, 27 Feb 2023 11:11:29 +0100	[thread overview]
Message-ID: <87edqbo1ta.fsf@gnu.org> (raw)
In-Reply-To: <B06590B5-6C8F-4313-BF53-CDE684B652FA@sarc.name> (lloda@sarc.name's message of "Fri, 24 Feb 2023 18:26:29 +0100")

Hi Daniel,

lloda <lloda@sarc.name> skribis:

> From 61ed612fb36108e395bdee4b1bbb46b49ef017b3 Mon Sep 17 00:00:00 2001
> From: Daniel Llorens <lloda@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’.





  reply	other threads:[~2023-02-27 10:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 19:16 bug#60971: build failure of v3.0.9rc1 on mac os 12.6 lloda
     [not found] ` <handler.60971.B.167424218722695.ack@debbugs.gnu.org>
2023-02-23 19:00   ` bug#61660: [feature request] optimization of case-lambda lloda
2023-02-24 17:26     ` lloda
2023-02-27 10:11       ` Ludovic Courtès [this message]
2023-02-27 17:19         ` lloda
  -- strict thread matches above, loose matches on Subject: below --
2023-02-20 17:56 lloda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edqbo1ta.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=61660@debbugs.gnu.org \
    --cc=lloda@sarc.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).