From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.emacs.devel Subject: Re: native compilation units Date: Mon, 6 Jun 2022 22:14:00 -0400 Message-ID: References: <83o7z6849m.fsf@gnu.org> <831qw191b0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ff8f3605e0d224be" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4791"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Andrea Corallo , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 07 04:24:48 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyOtk-00012v-MS for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Jun 2022 04:24:48 +0200 Original-Received: from localhost ([::1]:46434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyOtj-0001Js-Eg for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Jun 2022 22:24:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyOjc-0007xg-Uf for emacs-devel@gnu.org; Mon, 06 Jun 2022 22:14:20 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:46748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyOjW-0003We-6w; Mon, 06 Jun 2022 22:14:20 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id s6so26057566lfo.13; Mon, 06 Jun 2022 19:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=122GTcLJwDf1fWUXG2EYWyGaPZW34K1MUQrQdELPJy8=; b=LsMp6+/XBSD58Srpe2M7WLTcBihSUlg0PpsCI29KTTU21x5awCYLfmrJU0VqX+s8KI baP2a+THaN0h5Km/TqP7sOL7TVIgHDm7Omk9s4I7CV+ErAthyMnvPvNyyytsbWGm32+s ZY/6TGQ0rA0K3trX6SefNobv7R3RFxLtLd2j1YJ3SI9RTqMdrEkRqD3Xedmqn+d3rsIs uMf6Le7hxRpEvdCSWPkCBgkf1lFDcIzsGeyDk+cVP/WzmSefmxeMD+39xdWDrRG8zdhk GTrW1F/XwYcANNhdezb+fYD+S9blDXu6SGnLtcwOpxDmn9vwgr7TapeiP7EEPpgmsYvP ouTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=122GTcLJwDf1fWUXG2EYWyGaPZW34K1MUQrQdELPJy8=; b=mDtOp9rr/0CbuToO7VC1WTEU8dUSOayfLQc56jC3p5tHHO5MB44XMwbnLwd3EHUFQx TlPaLfK0uAlRVyy/iocINPmXv1TNIV7rplSifHogWE3rz5pXhA5/b1VuJng5UE85Jghg zXd3te3SGGyCtmoU2gp849Ky6S1SKMTQLZX3vy2OE/O7WATud89ZBnnb9nKKGBtuVejf LgkBAHG6mXqVhPA0DvDx334rrap14RihtOCRfbvetD6CsImIq2lq8Y4DbNVyqx2rwuKI Dl3dKSf9czuT5cu34b458fkZTM3VC/KVTHaDcTYd8QxWQQ4fy0OLnDRiAWxWBYZVF0sl gX7w== X-Gm-Message-State: AOAM533s9F6JmXJoqfuFPK4MKkPxkYo42P4AVxR2ID1uUMp5TcruQ4YK KfxI342ST7UVcpePWWMXgiGIonyJMjcyyRjSgqy/qawV0LY= X-Google-Smtp-Source: ABdhPJx9OHAeRbelPa/TYmbcR3ajNxIFK9C1cgHCrxCv12bKZslF273NEMAXMltJ8OEycX1fAMOoVoEfXYFFvoRWsKE= X-Received: by 2002:a05:6512:2290:b0:478:5fe1:c754 with SMTP id f16-20020a056512229000b004785fe1c754mr55137965lfu.323.1654568052033; Mon, 06 Jun 2022 19:14:12 -0700 (PDT) In-Reply-To: <831qw191b0.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=owinebar@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 06 Jun 2022 22:24:00 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:290820 Archived-At: --000000000000ff8f3605e0d224be Content-Type: text/plain; charset="UTF-8" On Mon, Jun 6, 2022 at 12:58 PM Eli Zaretskii wrote: > > From: Lynn Winebarger > > Date: Mon, 6 Jun 2022 12:23:49 -0400 > > Cc: Stefan Monnier , Andrea Corallo < > akrl@sdf.org>, emacs-devel@gnu.org > > > > Of course, there is: that function is what is invoked when building a > > release tarball, where the *.elc files are already present. See > > lisp/Makefile.in. > > > > That's what I expected was the case, but the question is whether it > "should" > > check for those .elc files and create them only if they do not exist, as > opposed > > to batch-byte+native-compile, which creates both unconditionally. Or > perhaps > > just note the possible hiccup in the docstring for batch-native-compile? > > You are describing a different function. batch-native-compile was > explicitly written to support the build of a release tarball, where > the *.elc files are always present, and regenerating them is just a > waste of cycles, and also runs the risk of creating a .elc file that > is not fully functional, due to some peculiarity of the platform or > the build environment. > Ok - I'm not sure why only generating the .elc in the case that it does not already exist is inconsistent with the restriction you describe. Ignoring that, according to https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/comp.el the signature and docstring are: (defun batch-native-compile (&optional for-tarball) "Perform batch native compilation of remaining command-line arguments. Native compilation equivalent of `batch-byte-compile'. Use this from the command line, with `-batch'; it won't work in an interactive Emacs session. Optional argument FOR-TARBALL non-nil means the file being compiled as part of building the source tarball, in which case the .eln file will be placed under the native-lisp/ directory (actually, in the last directory in `native-comp-eln-load-path')." If the restriction you describe is the intent, why not (1) make "for-tarball" non-optional and remove that argument, and (2) put that intent in the documentation so we would know not to use it > > However, since the eln file can be generated without the elc file, it > also begs the question > > of why the use of the eln file is conditioned on the existence of the > elc file in the > > first place. Are there situations where the eln file would be incorrect > to use > > without the byte-compiled file in place? > > Andrea was asked this question several times and explained his design, > you can find it in the archives. Basically, native compilation is > driven by byte compilation, and is a kind of side effect of it. > I understood that already - the question was why the .elc file, as an artifact, was required to exist in addition to the .eln file. I did follow your (implied?) suggestion and went back through the archives for 2021 and 2020 and saw some relevant discussions. The last relevant post I saw was from Andrea indicating he thought it shouldn't be required, but then it was just dropped: https://lists.gnu.org/archive/html/emacs-devel/2020-08/msg00561.html I have an experimental branch where the .elc are not produced at all by make bootstrap. The only complication is that for the Emacs build I had to modify the process to depose files containing the doc so make-docfile.c can eat those instead of the .elc files. Other than that we should re-add .eln to load-suffixes. But as I'm not sure this is a requirement I'd prefer first to converge with the current setup. Unless I get some specific input on that I think I'll keep this idea and its branch aside for now :) I may have missed a relevant subsequent post. Lynn --000000000000ff8f3605e0d224be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, Jun 6, = 2022 at 12:58 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Lynn Winebarger <owinebar@gmail.com>=
> Date: Mon, 6 Jun 2022 12:23:49 -0400
> Cc: Stefan Monnier &l= t;monnier@iro= .umontreal.ca>, Andrea Corallo <akrl@sdf.org>,=C2=A0emacs-devel@gnu.org
>
>=C2=A0 Of = course, there is: that function is what is invoked when building a
>= =C2=A0 release tarball, where the *.elc files are already present.=C2=A0 Se= e
>=C2=A0 lisp/Makefile.in.
>
> That's what I expecte= d was the case, but the question is whether it "should"
> c= heck for those .elc files and create them only if they do not exist, as opp= osed
> to batch-byte+native-compile, which creates both unconditional= ly.=C2=A0 Or perhaps
> just note the possible hiccup in the docstring= for batch-native-compile?

You are describing a different function.= =C2=A0 batch-native-compile was
explicitly written to support the build = of a release tarball, where
the *.elc files are always present, and rege= nerating them is just a
waste of cycles, and also runs the risk of creat= ing a .elc file that
is not fully functional, due to some peculiarity of= the platform or
the build environment.
Ok -= I'm not sure why only generating the=C2=A0.elc in the case that it doe= s not already exist is inconsistent with the restriction you describe.
Ignoring that, according to=C2=A0https:/= /github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/comp.el=C2= =A0the signature and docstring are:
<= div>=
(defun batch-native-compi= le (&optional for-tarball) "Perform batch native compilation of remaining command-line = arguments.
Native compilation equivalent of `batch-byte-compile'.
Use this from the command line, wit= h `-batch'; it won't w= ork
in an interactive Emacs session.
Optional argument FOR-TA= RBALL non-nil means the file being compiled
a= s part of building the source tarball, in which case the .eln file
will be placed under the= native-lisp/ directory (actually, in the
la= st directory in `native-comp-eln-load= -path')."
If = the restriction you describe is the intent, why not=C2=A0
(1) mak= e "for-tarball" non-optional and remove that argument, and
<= div>(2) put that intent in the documentation so we would know not to use it=
=C2=A0
=
> However, since= the eln file can be generated without the elc file, it also begs the quest= ion
> of why the use of the eln file is conditioned on the existence = of the elc file in the
> first place.=C2=A0 Are there situations wher= e the eln file would be incorrect to use
> without the byte-compiled = file in place?

Andrea was asked this question several times and expl= ained his design,
you can find it in the archives.=C2=A0 Basically, nati= ve compilation is
driven by byte compilation, and is a kind of side effe= ct of it.

I understood that alre= ady - the question was why the .elc file, as an artifact, was required to e= xist in addition to the .eln file.
I did follow your (implied?) s= uggestion and went back through the archives for 2021 and 2020 and saw some= relevant discussions.
The last relevant post I saw was from Andr= ea indicating he thought it shouldn't be required, but then it was just= dropped:

= I have an experimental branch where the .elc are not produced at all by
make bootstrap. The only complication is that for t= he Emacs build I had
to modify the process to de= pose files containing the doc so
make-docfile.c = can eat those instead of the .elc files. Other than that
we should re-add .eln to load-suffixes. But as I'm not sure th= is is a
requirement I'd prefer first to conv= erge with the current setup. Unless
I get some s= pecific input on that I think I'll keep this idea and its
branch aside for now :)
=

I may have missed a relevant= subsequent post.

Lynn

=C2=A0
--000000000000ff8f3605e0d224be--