From: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
To: Andrea Corallo <akrl@sdf.org>
Cc: 41242@debbugs.gnu.org
Subject: bug#41242: Port feature/native-comp to Windows - Reduce the number of files probed when finding a lisp file.
Date: Tue, 2 Jun 2020 18:17:38 -0300 [thread overview]
Message-ID: <CAFnS-Okdiu_4HaRp_h2nObLB+J6qGectOqVFhSewas4gauXO4g@mail.gmail.com> (raw)
In-Reply-To: <xjfsgfdigfo.fsf@sdf.org>
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]
Hi,
The recent patches broke the Windows build. There is one patch that
fixes it and another one that improves the way to check for the gccjit version
functions.
Nico.
El mar., 2 jun. 2020 a las 13:24, Andrea Corallo (<akrl@sdf.org>) escribió:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Andrea Corallo <akrl@sdf.org>
> >> Cc: 41242@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> >> Date: Mon, 01 Jun 2020 19:24:43 +0000
> >>
> >> In which folders are we going to search if we do (load "...a/path/foo.eln")?
> >>
> >> I believe in this case we should search the file only in "...a/path/"
> >> because the user really want to load this specific file. Am I correct?
> >
> > Isn't that already so when we look for *.elc files?
>
> Yes but here the hash directory that we use to disambiguate the triplet
> comes into play so we search there too. This is what Nico posted about
> what we would probe for a load.
>
> (load "C:/dir/foo.eln")
>
> "c:/dir/foo.eln.eln"
> "c:/dir/eln-hash/foo.eln.eln"
> "c:/dir/foo.eln.dll"
> "c:/dir/foo.eln.elc"
> "c:/dir/foo.eln.elc.gz"
> "c:/dir/foo.eln.el"
> "c:/dir/foo.eln.el.gz"
> "c:/dir/foo.eln"
> "c:/dir/foo.eln.gz"
>
> My argument was that in the case of (load "C:/dir/foo.eln") we should
> try to load only "c:/dir/foo.eln" without having to look into
> "c:/dir/eln-hash/".
>
> But Nico pointed out (probably correctly) that the function is already
> quite dumb regarding ignoring extentions and is probably not worth doing
> an exception for this.
>
> >> That said IMO this logic is sufficiently complex to deserve a minimum of
> >> testing to make sure we have it under control. Not sure if the best
> >> place is files-tests.el or comp-tests.el.
> >>
> >> Maybe Eli likes to gives his opinion on this last point and on the patch
> >> in general.
> >
> > I think the logic should be consistent with how we search for Lisp
> > files in general.
> >
>
> --
> akrl@sdf.org
[-- Attachment #2: 0001-Fix-DLL-imports-of-gccjit-version-functions.patch --]
[-- Type: application/octet-stream, Size: 3196 bytes --]
From 80f6a7fc7a531e15ea909af9e254515e8888005a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo@gmail.com>
Date: Mon, 1 Jun 2020 19:53:00 -0300
Subject: [PATCH 1/2] Fix DLL imports of gccjit version functions.
* src/comp.c (init_gccjit_functions): Use LOAD_DLL_FN_OPT macro to
load gcc_jit_version_major, gcc_jit_version_major and
gcc_jit_version_patchlevel.
* src/w32common.h (LOAD_DLL_FN_OPT): Add macro optionally load a
function from a DLL.
---
src/comp.c | 18 ++++++++++++------
src/w32common.h | 8 ++++++++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/comp.c b/src/comp.c
index d0574ac5ef3..8e7582b3e65 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -98,6 +98,9 @@
#undef gcc_jit_struct_as_type
#undef gcc_jit_struct_set_fields
#undef gcc_jit_type_get_pointer
+#undef gcc_jit_version_major
+#undef gcc_jit_version_minor
+#undef gcc_jit_version_patchlevel
/* In alphabetical order */
DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_int,
@@ -231,9 +234,9 @@ DEF_DLL_FN (void, gcc_jit_context_set_logfile,
DEF_DLL_FN (void, gcc_jit_struct_set_fields,
(gcc_jit_struct *struct_type, gcc_jit_location *loc, int num_fields,
gcc_jit_field **fields));
-DEF_DLL_FN (int, gcc_jit_version_major);
-DEF_DLL_FN (int, gcc_jit_version_minor);
-DEF_DLL_FN (int, gcc_jit_version_patchlevel);
+DEF_DLL_FN (int, gcc_jit_version_major, (void));
+DEF_DLL_FN (int, gcc_jit_version_minor, (void));
+DEF_DLL_FN (int, gcc_jit_version_patchlevel, (void));
static bool
init_gccjit_functions (void)
@@ -297,9 +300,9 @@ init_gccjit_functions (void)
LOAD_DLL_FN (library, gcc_jit_struct_as_type);
LOAD_DLL_FN (library, gcc_jit_struct_set_fields);
LOAD_DLL_FN (library, gcc_jit_type_get_pointer);
- LOAD_DLL_FN (library, gcc_jit_version_major);
- LOAD_DLL_FN (library, gcc_jit_version_minor);
- LOAD_DLL_FN (library, gcc_jit_version_patchlevel);
+ LOAD_DLL_FN_OPT (library, gcc_jit_version_major);
+ LOAD_DLL_FN_OPT (library, gcc_jit_version_minor);
+ LOAD_DLL_FN_OPT (library, gcc_jit_version_patchlevel);
return true;
}
@@ -358,6 +361,9 @@ #define gcc_jit_rvalue_get_type fn_gcc_jit_rvalue_get_type
#define gcc_jit_struct_as_type fn_gcc_jit_struct_as_type
#define gcc_jit_struct_set_fields fn_gcc_jit_struct_set_fields
#define gcc_jit_type_get_pointer fn_gcc_jit_type_get_pointer
+#define gcc_jit_version_major fn_gcc_jit_version_major
+#define gcc_jit_version_minor fn_gcc_jit_version_minor
+#define gcc_jit_version_patchlevel fn_gcc_jit_version_patchlevel
#endif
diff --git a/src/w32common.h b/src/w32common.h
index eb7faa1939a..bd01fd40401 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -81,6 +81,14 @@ #define LOAD_DLL_FN(lib, func) \
} \
while (false)
+/* Load a function from the DLL, and don't fail if it does not exist. */
+#define LOAD_DLL_FN_OPT(lib, func) \
+ do \
+ { \
+ fn_##func = (W32_PFN_##func) get_proc_addr (lib, #func); \
+ } \
+ while (false)
+
#ifdef HAVE_HARFBUZZ
extern bool hbfont_init_w32_funcs (HMODULE);
#endif
--
2.25.1.windows.1
[-- Attachment #3: 0002-Remove-kludge-for-detecting-if-gcc_jit_version_major.patch --]
[-- Type: application/octet-stream, Size: 1868 bytes --]
From 8aa7673f626bfa2c12e6f9c8bbec102ce2fb72d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo@gmail.com>
Date: Mon, 1 Jun 2020 19:56:37 -0300
Subject: [PATCH 2/2] Remove kludge for detecting if gcc_jit_version_major can
be called.
* src/comp.c (comp-libgccjit-version): Use 'dlsym' in Posix and the
normal function loading mechanism in Windows.
---
src/comp.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/comp.c b/src/comp.c
index 8e7582b3e65..084d0b6745b 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -365,6 +365,8 @@ #define gcc_jit_version_major fn_gcc_jit_version_major
#define gcc_jit_version_minor fn_gcc_jit_version_minor
#define gcc_jit_version_patchlevel fn_gcc_jit_version_patchlevel
+#else
+#include <dlfcn.h>
#endif
static bool
@@ -3999,15 +4001,18 @@ DEFUN ("comp-libgccjit-version", Fcomp_libgccjit_version,
#if defined (LIBGCCJIT_HAVE_gcc_jit_version) || defined (WINDOWSNT)
load_gccjit_if_necessary (true);
- /* FIXME this kludge is quite bad. Can we dynamically load on all
- operating systems? */
-#pragma GCC diagnostic ignored "-Waddress"
- return gcc_jit_version_major
- ? list3 (make_fixnum (gcc_jit_version_major ()),
- make_fixnum (gcc_jit_version_minor ()),
- make_fixnum (gcc_jit_version_patchlevel ()))
- : Qnil;
-#pragma GCC diagnostic pop
+ bool ok_to_call;
+
+#if defined (WINDOWSNT)
+ ok_to_call = !!fn_gcc_jit_version_major;
+#else
+ ok_to_call = !!dlsym (RTLD_DEFAULT, "gcc_jit_version_major");
+#endif
+
+ return ok_to_call ? list3 (make_fixnum (gcc_jit_version_major ()),
+ make_fixnum (gcc_jit_version_minor ()),
+ make_fixnum (gcc_jit_version_patchlevel ()))
+ : Qnil;
#else
return Qnil;
#endif
--
2.25.1.windows.1
next prev parent reply other threads:[~2020-06-02 21:17 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
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 [this message]
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-Okdiu_4HaRp_h2nObLB+J6qGectOqVFhSewas4gauXO4g@mail.gmail.com \
--to=nicolasbertolo@gmail.com \
--cc=41242@debbugs.gnu.org \
--cc=akrl@sdf.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).