From: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 41242@debbugs.gnu.org, Andrea Corallo <akrl@sdf.org>
Subject: bug#41242: Port feature/native-comp to Windows
Date: Tue, 19 May 2020 16:25:53 -0300 [thread overview]
Message-ID: <CAFnS-OkJ+Nxjryq0=T8RD-FZknH4_zsR-rW9yax8L8=PN9c4TA@mail.gmail.com> (raw)
In-Reply-To: <CAFnS-OnsKJ7H1mDsJYby6mkg2N66qd5ah7tkWcyd4uUCWLrz2Q@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 149 bytes --]
The following two patches handle minor issues:
* Removal of the emacs_root_dir() hack.
* Determine the number of processors for native compilation.
[-- Attachment #1.2: Type: text/html, Size: 219 bytes --]
[-- Attachment #2: 0001-Windows-Use-NUMBER_OF_PROCESSORS-environment-variabl.patch --]
[-- Type: application/octet-stream, Size: 1429 bytes --]
From 1fb5c38748c12735ee1d6eb6e794d61720e4fc11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo@gmail.com>
Date: Wed, 13 May 2020 16:22:17 -0300
Subject: [PATCH] Windows: Use NUMBER_OF_PROCESSORS environment variable.
* lisp/emacs-lisp/comp.el (comp-effective-async-max-jobs): Use
NUMBER_OF_PROCESSORS environment variable if system is Windows NT,
"nproc" if it is in PATH or a default of 1.
---
lisp/emacs-lisp/comp.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index d32f93a1e1..26bb79fcd1 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2208,9 +2208,11 @@ comp-async-runnings
(if (zerop comp-async-jobs-number)
(or num-cpus
(setf num-cpus
- ;; Half of the CPUs or at least one.
- ;; FIXME portable?
- (max 1 (/ (string-to-number (shell-command-to-string "nproc"))
+ (max 1 (/ (cond ((eq 'windows-nt system-type)
+ (string-to-number (getenv "NUMBER_OF_PROCESSORS")))
+ ((executable-find "nproc")
+ (string-to-number (shell-command-to-string "nproc")))
+ (t 1))
2))))
comp-async-jobs-number)))
--
2.25.1.windows.1
[-- Attachment #3: 0001-Determine-the-emacs-root-dir-only-when-necessary.patch --]
[-- Type: application/octet-stream, Size: 4337 bytes --]
From a7176a64d4d882874d4a81cc3924e03fa2a09ce8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo@gmail.com>
Date: Wed, 13 May 2020 18:31:42 -0300
Subject: [PATCH] Determine the emacs root dir only when necessary.
* src/fileio.c: Introduce function emacs_root_dir(). Refactor
`expand-file-name` to use it.
* src/lisp.h: Separate emacs_root_dir() into dos_emacs_root_dir() and
w32_emacs_root_dir().
* src/msdos.c: Rename emacs_root_dir() to dos_emacs_root_dir().
* src/w32.c: Rename emacs_root_dir() to w32_emacs_root_dir().
---
src/fileio.c | 37 ++++++++++++++++++++++---------------
src/lisp.h | 11 +++++++----
src/msdos.c | 2 +-
src/w32.c | 2 +-
4 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/src/fileio.c b/src/fileio.c
index 2f1d2f8243..e20fa93c65 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -781,6 +781,18 @@ user_homedir (char const *name)
return pw->pw_dir;
}
+static Lisp_Object
+emacs_root_dir()
+{
+#ifdef DOS
+ return build_string (dos_emacs_root_dir ());
+#elif defined(WINDOWSNT)
+ return build_string (w32_emacs_root_dir ());
+#else
+ return build_string ("/");
+#endif
+}
+
DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
doc: /* Convert filename NAME to absolute, and canonicalize it.
Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
@@ -851,21 +863,16 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
}
/* As a last resort, we may have to use the root as
- default_directory below. */
- Lisp_Object root;
-#ifdef DOS_NT
- /* "/" is not considered a root directory on DOS_NT, so using it
- as default_directory causes an infinite recursion in, e.g.,
- the following:
+ default_directory below.
- (let (default-directory)
- (expand-file-name "a"))
+ "/" is not considered a root directory on DOS_NT, so using it
+ as default_directory causes an infinite recursion in, e.g.,
+ the following:
- To avoid this, we use the root of the current drive. */
- root = build_string (emacs_root_dir ());
-#else
- root = build_string ("/");
-#endif
+ (let (default-directory)
+ (expand-file-name "a"))
+
+ To avoid this, we use the root of the current drive. */
/* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
if (NILP (default_directory))
@@ -891,13 +898,13 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
Lisp_Object absdir
= STRINGP (Vinvocation_directory)
&& file_name_absolute_no_tilde_p (Vinvocation_directory)
- ? Vinvocation_directory : root;
+ ? Vinvocation_directory : emacs_root_dir();
default_directory = Fexpand_file_name (dir, absdir);
}
}
}
if (! STRINGP (default_directory))
- default_directory = root;
+ default_directory = emacs_root_dir();
handler = Ffind_file_name_handler (default_directory, Qexpand_file_name);
if (!NILP (handler))
diff --git a/src/lisp.h b/src/lisp.h
index 3d082911f5..834b3e586c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4719,10 +4719,13 @@ maybe_disable_address_randomization (int argc, char **argv)
extern void malloc_probe (size_t);
extern void syms_of_profiler (void);
-#ifdef DOS_NT
-/* Defined in msdos.c, w32.c. */
-extern char *emacs_root_dir (void);
-#endif /* DOS_NT */
+#ifdef MSDOS
+/* Defined in msdos.c. */
+extern char *dos_emacs_root_dir (void);
+#elif defined(WINDOWSNT)
+/* Defined in w32.c. */
+extern char *w32_emacs_root_dir (void);
+#endif /* MSDOS */
#ifdef HAVE_NATIVE_COMP
INLINE bool
diff --git a/src/msdos.c b/src/msdos.c
index b5f06c99c3..0827cc96cd 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -3350,7 +3350,7 @@ getdefdir (int drive, char *dst)
}
char *
-emacs_root_dir (void)
+dos_emacs_root_dir (void)
{
static char root_dir[4];
diff --git a/src/w32.c b/src/w32.c
index 0f69e652a5..1ec0094c8e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3147,7 +3147,7 @@ #define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
/* Called from expand-file-name when default-directory is not a string. */
char *
-emacs_root_dir (void)
+w32_emacs_root_dir (void)
{
static char root_dir[MAX_UTF8_PATH];
const char *p;
--
2.25.1.windows.1
next prev parent reply other threads:[~2020-05-19 19:25 UTC|newest]
Thread overview: 149+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 19:26 bug#41242: Port feature/native-comp to Windows Nicolas Bértolo
2020-05-13 19:36 ` Eli Zaretskii
2020-05-13 19:39 ` Eli Zaretskii
2020-05-13 20:01 ` Nicolas Bértolo
2020-05-13 22:25 ` Andrea Corallo
2020-05-14 13:42 ` Eli Zaretskii
2020-05-13 20:08 ` Andrea Corallo
2020-05-13 20:27 ` Andrea Corallo
2020-05-13 19:56 ` Andrea Corallo
2020-05-13 20:03 ` Nicolas Bértolo
2020-05-14 10:18 ` Andrea Corallo
2020-05-14 10:45 ` Eli Zaretskii
2020-05-14 11:17 ` Andrea Corallo
2020-05-14 14:32 ` Eli Zaretskii
2020-05-14 15:03 ` Andrea Corallo
2020-05-14 16:50 ` Nicolas Bértolo
2020-05-14 17:28 ` Eli Zaretskii
2020-05-14 17:35 ` Nicolas Bértolo
2020-05-14 17:56 ` Eli Zaretskii
2020-05-14 18:00 ` Nicolas Bértolo
2020-05-14 18:29 ` Eli Zaretskii
2020-05-14 18:35 ` Andrea Corallo
2020-05-14 18:29 ` Andrea Corallo
2020-05-14 18:59 ` Achim Gratz
2020-05-14 17:34 ` Andrea Corallo
2020-05-14 17:51 ` Nicolas Bértolo
2020-05-14 18:13 ` Andrea Corallo
2020-05-14 18:40 ` Nicolas Bértolo
2020-05-14 18:48 ` Andrea Corallo
2020-05-14 19:00 ` Nicolas Bértolo
2020-05-14 19:15 ` Andrea Corallo
2020-05-14 19:48 ` Nicolas Bértolo
2020-05-14 19:58 ` Andrea Corallo
2020-05-14 20:16 ` Nicolas Bértolo
2020-05-14 20:29 ` Andrea Corallo
2020-05-14 20:34 ` Nicolas Bértolo
2020-05-15 6:10 ` Eli Zaretskii
2020-05-14 19:16 ` Eli Zaretskii
2020-05-14 19:00 ` Eli Zaretskii
2020-05-14 19:36 ` Nicolas Bértolo
2020-05-15 6:08 ` Eli Zaretskii
2020-05-15 12:33 ` Nicolas Bértolo
2020-05-15 13:00 ` Eli Zaretskii
2020-05-15 19:44 ` Nicolas Bértolo
2020-05-16 6:22 ` Eli Zaretskii
2020-05-16 7:12 ` Andrea Corallo
2020-05-16 16:12 ` Nicolas Bértolo
2020-05-16 16:19 ` Eli Zaretskii
2020-05-16 16:31 ` Nicolas Bértolo
2020-05-16 16:42 ` Eli Zaretskii
2020-05-16 17:09 ` Nicolas Bértolo
2020-05-19 19:23 ` Nicolas Bértolo
2020-05-19 19:25 ` Nicolas Bértolo [this message]
2020-05-20 15:27 ` Eli Zaretskii
2020-05-20 15:46 ` Nicolas Bértolo
[not found] ` <83blmf13d1.fsf@gnu.org>
[not found] ` <xjfh7w7vyjk.fsf@sdf.org>
[not found] ` <83367r0zvb.fsf@gnu.org>
2020-05-23 10:37 ` Andrea Corallo
2020-05-23 11:03 ` Eli Zaretskii
2020-05-23 11:21 ` Andrea Corallo
2020-05-23 12:20 ` Eli Zaretskii
2020-05-23 12:54 ` Andrea Corallo
2020-05-23 14:41 ` Nicolas Bértolo
2020-05-23 15:11 ` Andrea Corallo
2020-05-23 15:26 ` Nicolas Bértolo
2020-05-23 16:00 ` Andrea Corallo
2020-05-23 16:04 ` Eli Zaretskii
2020-05-23 16:20 ` Nicolas Bértolo
2020-05-23 17:04 ` Eli Zaretskii
2020-05-23 17:20 ` Nicolas Bértolo
2020-05-23 17:35 ` Eli Zaretskii
2020-05-23 17:47 ` Nicolas Bértolo
2020-05-23 18:21 ` Eli Zaretskii
2020-05-23 18:29 ` Nicolas Bértolo
2020-05-23 18:37 ` Eli Zaretskii
2020-05-23 18:43 ` Nicolas Bértolo
2020-05-23 22:52 ` Nicolas Bértolo
2020-05-25 12:21 ` Andrea Corallo
2020-05-24 3:53 ` Richard Stallman
2020-05-23 17:56 ` Andrea Corallo
2020-05-23 15:52 ` Eli Zaretskii
2020-05-23 16:03 ` Nicolas Bértolo
2020-05-20 16:06 ` Andrea Corallo
2020-05-20 15:55 ` Eli Zaretskii
2020-05-20 16:12 ` Andrea Corallo
2020-05-20 16:17 ` Nicolas Bértolo
2020-05-20 17:24 ` Andrea Corallo
2020-05-20 17:29 ` Andrea Corallo
2020-05-20 17:59 ` Eli Zaretskii
2020-05-20 18:09 ` Andrea Corallo
2020-05-20 18:48 ` Nicolas Bértolo
2020-05-20 21:38 ` Andrea Corallo
2020-05-21 1:58 ` Nicolas Bértolo
2020-05-21 18:51 ` Andrea Corallo
2020-05-22 21:23 ` Andrea Corallo
2020-05-14 19:13 ` Eli Zaretskii
2020-05-14 17:14 ` Eli Zaretskii
2020-05-14 16:24 ` Nicolas Bértolo
2020-05-14 17:21 ` Eli Zaretskii
2020-05-20 16:44 ` Eli Zaretskii
2020-05-23 22:58 ` bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation Andrea Corallo
2020-05-23 23:43 ` Nicolas Bértolo
2020-05-24 8:19 ` Andrea Corallo
2020-05-24 17:58 ` Nicolas Bértolo
2020-05-24 19:13 ` Andrea Corallo
2020-05-24 19:43 ` Nicolas Bértolo
2020-05-25 14:04 ` Andrea Corallo
2020-05-25 14:27 ` Nicolas Bértolo
2020-05-25 15:06 ` Andrea Corallo
2020-05-25 20:27 ` Andrea Corallo
2020-05-25 21:49 ` Nicolas Bértolo
2020-05-27 21:02 ` bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir Andrea Corallo
2020-05-28 6:17 ` Eli Zaretskii
2020-05-29 0:39 ` Nicolas Bértolo
2020-05-29 12:12 ` Andrea Corallo
2020-05-29 13:54 ` Eli Zaretskii
2020-05-29 14:26 ` Andrea Corallo
2020-05-30 10:51 ` Andrea Corallo
2020-05-30 13:06 ` Nicolas Bértolo
2020-05-30 14:17 ` Andrea Corallo
2020-05-30 13:23 ` Nicolas Bértolo
2020-05-30 14:51 ` Andrea Corallo
2020-05-30 16:25 ` Nicolas Bértolo
2020-05-30 18:51 ` Andrea Corallo
2020-05-30 20:15 ` Nicolas Bértolo
2020-05-30 20:54 ` Nicolas Bértolo
2020-05-31 8:55 ` Andrea Corallo
2020-05-30 16:29 ` Eli Zaretskii
2020-05-30 14:15 ` bug#41242: Port feature/native-comp to Windows - Reduce the number of files probed when finding a lisp file Andrea Corallo
2020-05-31 15:34 ` Nicolas Bértolo
2020-05-31 22:41 ` Nicolas Bértolo
2020-06-01 7:21 ` Andrea Corallo
2020-06-01 13:56 ` Nicolas Bértolo
2020-06-01 19:24 ` Andrea Corallo
2020-06-02 0:42 ` Nicolas Bértolo
2020-06-02 14:43 ` Andrea Corallo
2020-06-02 15:02 ` Eli Zaretskii
2020-06-02 16:24 ` Andrea Corallo
2020-06-02 21:17 ` Nicolas Bértolo
2020-06-02 23:08 ` Andrea Corallo
2020-06-02 23:39 ` Nicolas Bértolo
2020-06-03 13:50 ` Andrea Corallo
2020-06-03 15:28 ` Nicolas Bértolo
2020-06-03 16:24 ` Andrea Corallo
2020-06-06 21:41 ` Andrea Corallo
2020-06-06 21:51 ` Nicolas Bértolo
2020-06-06 22:32 ` Andrea Corallo
2020-06-06 22:50 ` Nicolas Bértolo
2020-06-06 23:20 ` Andrea Corallo
2020-06-09 14:14 ` Nicolas Bértolo
2020-06-09 17:17 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFnS-OkJ+Nxjryq0=T8RD-FZknH4_zsR-rW9yax8L8=PN9c4TA@mail.gmail.com' \
--to=nicolasbertolo@gmail.com \
--cc=41242@debbugs.gnu.org \
--cc=akrl@sdf.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).