all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64646@debbugs.gnu.org, Andrea Corallo <acorallo@gnu.org>
Subject: bug#64646: Master: Native compiler doesn't always compile lambda forms.
Date: Sat, 15 Jul 2023 13:20:04 +0000	[thread overview]
Message-ID: <ZLKdBEAONzKJxVFH@ACM> (raw)
In-Reply-To: <83wmz1b9yt.fsf@gnu.org>

Hello, Eli.

On Sat, Jul 15, 2023 at 16:06:18 +0300, Eli Zaretskii wrote:
> > Date: Sat, 15 Jul 2023 12:10:06 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > In the master branch:

> > (i) emacs -Q
> > (ii) C-x b foo.el <RET>
> > (iii) Insert into foo.el:
> >     ;; -*- lexical-binding:t -*-
> > (iv) M-x emacs-lisp-mode
> > (v) Insert into foo.el:
> >     (defun foo () "foo doc string"
> >       (lambda (bar) "lambda doc string" (car bar)))
> > (vi) With point after the function, C-x C-e to evaluate it.

> > (vii) M-: (native-compile 'foo)
> > This returns #<subr foo>
> > (viii) M-: (foo)
> > This returns the lambda form as a byte-compiled function.  This is a bug:
> > it should return the lambda form as a native-compiled function.

> Why do you think it should return the native-compiled form?  Based on
> what?

Well, if the native compilation compiled _all_ of the defun, the lambda
form would also have been compiled, and surely that is what should have
been returned.  There is some suspicion that the native compilation on
this defun is incomplete.

When we do byte-compilation, the returned value is byte-compiled.  By
analogy, when we do NC, the return value should be NC'd.

I can't see any reason to return a byte-compiled function.  The fact that
we use byte-compilation as a part of native-compilation should be an
internal detail, not visible from outside.

Also, the returned lambda function being byte-compiled will cause it to
run more slowly that if it were native-compiled.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2023-07-15 13:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15 12:10 bug#64646: Master: Native compiler doesn't always compile lambda forms Alan Mackenzie
2023-07-15 13:06 ` Eli Zaretskii
2023-07-15 13:20   ` Alan Mackenzie [this message]
2023-07-16  4:16 ` Michael Heerdegen
2023-07-16  9:01   ` Alan Mackenzie
2023-07-17  2:01     ` Michael Heerdegen
2023-07-17 13:17 ` Andrea Corallo
2023-07-20 12:14   ` Alan Mackenzie
2023-07-26 14:57     ` Andrea Corallo
2023-10-29 13:21       ` Alan Mackenzie
2023-11-02 17:32         ` Andrea Corallo
2023-11-08 20:59           ` Alan Mackenzie
2023-11-09 10:08             ` Andrea Corallo

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

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

  git send-email \
    --in-reply-to=ZLKdBEAONzKJxVFH@ACM \
    --to=acm@muc.de \
    --cc=64646@debbugs.gnu.org \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.