From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#44676: [PATCH 4/4] Support native compilation of packages on install Date: Fri, 20 Nov 2020 22:56:02 +0000 Message-ID: References: Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14415"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 44676@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 20 23:57:28 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1kgFLK-0003dj-VV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Nov 2020 23:57:26 +0100 Original-Received: from localhost ([::1]:52474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgFLK-0007rt-1L for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Nov 2020 17:57:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgFKy-0007qK-8p for bug-gnu-emacs@gnu.org; Fri, 20 Nov 2020 17:57:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kgFKw-0006RH-KR for bug-gnu-emacs@gnu.org; Fri, 20 Nov 2020 17:57:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kgFKw-0002pX-Hk for bug-gnu-emacs@gnu.org; Fri, 20 Nov 2020 17:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Nov 2020 22:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44676 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44676-submit@debbugs.gnu.org id=B44676.160591296910820 (code B ref 44676); Fri, 20 Nov 2020 22:57:02 +0000 Original-Received: (at 44676) by debbugs.gnu.org; 20 Nov 2020 22:56:09 +0000 Original-Received: from localhost ([127.0.0.1]:44480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kgFK4-0002oR-OQ for submit@debbugs.gnu.org; Fri, 20 Nov 2020 17:56:09 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:51094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kgFK1-0002oE-En for 44676@debbugs.gnu.org; Fri, 20 Nov 2020 17:56:06 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTP id 0AKMu2xe006492; Fri, 20 Nov 2020 22:56:03 GMT In-Reply-To: (Stefan Kangas's message of "Fri, 20 Nov 2020 13:10:44 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193803 Archived-At: Stefan Kangas writes: > Andrea Corallo writes: > >>> However, perhaps we could make the LOAD parameter a simple boolean in >>> the user-facing `native-compile-async' function? I.e., we hide away >>> `late' for internal use only. >> >> Agree that's probably the best option. > > How does the attached look? Hi Stefan, > From 6ac20230fae2b700d301cd35238b283f287a6e81 Mon Sep 17 00:00:00 2001 > From: Stefan Kangas > Date: Thu, 19 Nov 2020 22:18:50 +0100 > Subject: [PATCH 4/4] Make load argument of native-compile-async internal > > * lisp/emacs-lisp/comp.el (native--compile-async-internal): New > defun extracted from native-compile-async. > (native-compile-async): Remove load argument and use above new defun. > * src/comp.c (maybe_defer_native_compilation): Use above new > defun. (Bug#44676) > --- > lisp/emacs-lisp/comp.el | 20 ++++++++++++++++++-- > src/comp.c | 6 +++--- > 2 files changed, 21 insertions(+), 5 deletions(-) > > diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el > index 2f1e8965c1..9bebc5ff1b 100644 > --- a/lisp/emacs-lisp/comp.el > +++ b/lisp/emacs-lisp/comp.el > @@ -3485,8 +3485,7 @@ batch-byte-native-compile-for-bootstrap > (`(,tempfile . ,target-file) > (rename-file tempfile target-file t)))))) > > -;;;###autoload > -(defun native-compile-async (paths &optional recursively load) > +(defun native--compile-async-internal (paths &optional recursively load) For constistency with `native--compile' and the other functions in the file containing -- I'd go for `native--compile-async' here. > "Compile PATHS asynchronously. > PATHS is one path or a list of paths to files or directories. > > @@ -3553,6 +3552,23 @@ native-compile-async > (when (zerop (comp-async-runnings)) > (comp-run-async-workers)))) > > +;;;###autoload > +(defun native-compile-async (paths &optional recursively load) > + "Compile PATHS asynchronously. > +PATHS is one path or a list of paths to files or directories. > + > +If optional argument RECURSIVELY is non-nil, recurse into > +subdirectories of given directories. > + > +If optional argument LOAD is non-nil, request to load the file > +after compiling. > + > +The variable `comp-async-jobs-number' specifies the number > +of (commands) to run simultaneously." > + ;; Normalize: we only want to pass t or nil, never e.g. 'late. > + (setq load (not (not load))) Nit, for my taste I'd rather use let or &aux, or probably just put `(not (not load))` directly in the following function call. > + (native--compile-async-internal paths recursively load)) > + > (provide 'comp) > > ;;; comp.el ends here > diff --git a/src/comp.c b/src/comp.c > index 6ddfad528b..89f8a4f3cd 100644 > --- a/src/comp.c > +++ b/src/comp.c > @@ -4677,13 +4677,13 @@ maybe_defer_native_compilation (Lisp_Object function_name, > /* Comp already loaded. */ > if (!NILP (delayed_sources)) > { > - CALLN (Ffuncall, intern_c_string ("native-compile-async"), > + CALLN (Ffuncall, intern_c_string ("native--compile-async-internal"), > delayed_sources, Qnil, Qlate); > delayed_sources = Qnil; > } > Fputhash (function_name, definition, Vcomp_deferred_pending_h); > - CALLN (Ffuncall, intern_c_string ("native-compile-async"), src, Qnil, > - Qlate); > + CALLN (Ffuncall, intern_c_string ("native--compile-async-internal"), > + src, Qnil, Qlate); > } > else > { Sorry for the nit picking. LGTM with these two. Thanks Andrea