From: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org, Andrea Corallo <akrl@sdf.org>
Subject: Re: [PATCH] [WIP] Port feature/native-comp to Windows.
Date: Mon, 11 May 2020 23:46:09 -0300 [thread overview]
Message-ID: <CAFnS-OkT=x1Ni8jwVRJRWVTRYVEKgK1uqpePws2G2HzTgAPf9A@mail.gmail.com> (raw)
In-Reply-To: <833686d08r.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 377 bytes --]
> Right, I think at least on MS-Windows we need to do that. On Posix
> platforms, Emacs will be able to start if there's no libgccjit (and
> will crash if it attempts to call any of its functions), so it might
> be a good idea to use dlopen/dlsym there as well. But on Windows it
> is IMO critical.
The attached patch does implement dynamic loading of libgccjit in Windows.
[-- Attachment #2: 0001-Load-libgccjit-dynamically-in-Windows.patch --]
[-- Type: application/octet-stream, Size: 19705 bytes --]
From edea454459bbf434241a9f2299cb5032d4412723 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo@gmail.com>
Date: Mon, 11 May 2020 20:43:06 -0300
Subject: [PATCH] Load libgccjit dynamically in Windows.
* configure.ac: don't add linker flags if compiling on Windows.
* lisp/term/w32-win.el: Map 'gccjit to "libgccjit.dll" in
`dynamic-library-alist`.
* src/comp.c: Add declarations of used libgccjit functions using
DEF_DLL_FN. Add calls to load_gccjit_if_necessary() where necessary.
* src/w32fns.c: Add Qgccjit symbol.
---
configure.ac | 5 +-
lisp/term/w32-win.el | 3 +-
src/comp.c | 304 +++++++++++++++++++++++++++++++++++++++++++
src/w32fns.c | 1 +
4 files changed, 311 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 23b94cf6ca..97639fdfba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3793,7 +3793,10 @@ AC_DEFUN
[AC_LINK_IFELSE([libgccjit_smoke_test], [], [libgccjit_not_found])])
LIBS=$emacs_save_LIBS
HAVE_NATIVE_COMP=yes
- LIBGCCJIT_LIB="-lgccjit -ldl"
+ # mingw32 loads the library dynamically.
+ if test "${opsys}" != "mingw32"; then
+ LIBGCCJIT_LIB="-lgccjit -ldl"
+ fi
COMP_OBJ="comp.o"
AC_DEFINE(HAVE_NATIVE_COMP, 1, [Define to 1 if you have the libgccjit library (-lgccjit).])
fi
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 5901e0295e..6b9716ca30 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -289,7 +289,8 @@ libgnutls-version
'(libxml2 "libxml2-2.dll" "libxml2.dll")
'(zlib "zlib1.dll" "libz-1.dll")
'(lcms2 "liblcms2-2.dll")
- '(json "libjansson-4.dll")))
+ '(json "libjansson-4.dll")
+ '(gccjit "libgccjit.dll")))
;;; multi-tty support
(defvar w32-initialized nil
diff --git a/src/comp.c b/src/comp.c
index 69525acfc0..d7fd408366 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -36,6 +36,291 @@
#include "blockinput.h"
#include "sha512.h"
+\f
+/********************************/
+/* Dynamic loading of libgccjit */
+/********************************/
+
+#ifdef WINDOWSNT
+# include "w32common.h"
+bool gccjit_initialized;
+
+/* In alphabetical order */
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_int,
+ (gcc_jit_context *ctxt, gcc_jit_type *numeric_type, int value));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_lvalue_as_rvalue,
+ (gcc_jit_lvalue *lvalue));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_rvalue_access_field,
+ (gcc_jit_rvalue *struct_or_union, gcc_jit_location *loc,
+ gcc_jit_field *field));
+DEF_DLL_FN (void, gcc_jit_block_add_comment,
+ (gcc_jit_block *block, gcc_jit_location *loc, const char *text));
+DEF_DLL_FN (void, gcc_jit_context_release, (gcc_jit_context *ctxt));
+DEF_DLL_FN (const char *, gcc_jit_context_get_first_error,
+ (gcc_jit_context *ctxt));
+DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block,
+ (gcc_jit_function *func, const char *name));
+DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void));
+DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type,
+ const char *name));
+DEF_DLL_FN (gcc_jit_function *, gcc_jit_context_get_builtin_function,
+ (gcc_jit_context *ctxt, const char *name));
+DEF_DLL_FN (gcc_jit_function *, gcc_jit_context_new_function,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ enum gcc_jit_function_kind kind, gcc_jit_type *return_type,
+ const char *name, int num_params, gcc_jit_param **params,
+ int is_variadic));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_context_new_array_access,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_rvalue *ptr,
+ gcc_jit_rvalue *index));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_context_new_global,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ enum gcc_jit_global_kind kind, gcc_jit_type *type,
+ const char *name));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_function_new_local,
+ (gcc_jit_function *func, gcc_jit_location *loc, gcc_jit_type *type,
+ const char *name));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_lvalue_access_field,
+ (gcc_jit_lvalue *struct_or_union, gcc_jit_location *loc,
+ gcc_jit_field *field));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_param_as_lvalue, (gcc_jit_param *param));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_rvalue_dereference,
+ (gcc_jit_rvalue *rvalue, gcc_jit_location *loc));
+DEF_DLL_FN (gcc_jit_lvalue *, gcc_jit_rvalue_dereference_field,
+ (gcc_jit_rvalue *ptr, gcc_jit_location *loc, gcc_jit_field *field));
+DEF_DLL_FN (gcc_jit_param *, gcc_jit_context_new_param,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type,
+ const char *name));
+DEF_DLL_FN (gcc_jit_param *, gcc_jit_function_get_param,
+ (gcc_jit_function *func, int index));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_binary_op,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ enum gcc_jit_binary_op op, gcc_jit_type *result_type,
+ gcc_jit_rvalue *a, gcc_jit_rvalue *b));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_call,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ gcc_jit_function *func, int numargs , gcc_jit_rvalue **args));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_call_through_ptr,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ gcc_jit_rvalue *fn_ptr, int numargs, gcc_jit_rvalue **args));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_comparison,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ enum gcc_jit_comparison op, gcc_jit_rvalue *a, gcc_jit_rvalue *b));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_long,
+ (gcc_jit_context *ctxt, gcc_jit_type *numeric_type, long value));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_ptr,
+ (gcc_jit_context *ctxt, gcc_jit_type *pointer_type, void *value));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_unary_op,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ enum gcc_jit_unary_op op, gcc_jit_type *result_type,
+ gcc_jit_rvalue *rvalue));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_lvalue_get_address,
+ (gcc_jit_lvalue *lvalue, gcc_jit_location *loc));
+DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_param_as_rvalue, (gcc_jit_param *param));
+DEF_DLL_FN (gcc_jit_struct *, gcc_jit_context_new_opaque_struct,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, const char *name));
+DEF_DLL_FN (gcc_jit_struct *, gcc_jit_context_new_struct_type,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, const char *name,
+ int num_fields, gcc_jit_field **fields));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_context_get_int_type,
+ (gcc_jit_context *ctxt, int num_bytes, int is_signed));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_context_get_type,
+ (gcc_jit_context *ctxt, enum gcc_jit_types type_));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_context_new_array_type,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ gcc_jit_type *element_type, int num_elements));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_context_new_function_ptr_type,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc,
+ gcc_jit_type *return_type, int num_params,
+ gcc_jit_type **param_types, int is_variadic));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_context_new_union_type,
+ (gcc_jit_context *ctxt, gcc_jit_location *loc, const char *name,
+ int num_fields, gcc_jit_field **fields));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_rvalue_get_type, (gcc_jit_rvalue *rvalue));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_struct_as_type,
+ (gcc_jit_struct *struct_type));
+DEF_DLL_FN (gcc_jit_type *, gcc_jit_type_get_pointer, (gcc_jit_type *type));
+DEF_DLL_FN (void, gcc_jit_block_add_assignment,
+ (gcc_jit_block *block, gcc_jit_location *loc, gcc_jit_lvalue *lvalue,
+ gcc_jit_rvalue *rvalue));
+DEF_DLL_FN (void, gcc_jit_block_add_eval,
+ (gcc_jit_block *block, gcc_jit_location *loc,
+ gcc_jit_rvalue *rvalue));
+DEF_DLL_FN (void, gcc_jit_block_end_with_conditional,
+ (gcc_jit_block *block, gcc_jit_location *loc,
+ gcc_jit_rvalue *boolval, gcc_jit_block *on_true,
+ gcc_jit_block *on_false));
+DEF_DLL_FN (void, gcc_jit_block_end_with_jump,
+ (gcc_jit_block *block, gcc_jit_location *loc,
+ gcc_jit_block *target));
+DEF_DLL_FN (void, gcc_jit_block_end_with_return,
+ (gcc_jit_block *block, gcc_jit_location *loc,
+ gcc_jit_rvalue *rvalue));
+DEF_DLL_FN (void, gcc_jit_block_end_with_void_return,
+ (gcc_jit_block *block, gcc_jit_location *loc));
+DEF_DLL_FN (void, gcc_jit_context_compile_to_file,
+ (gcc_jit_context *ctxt, enum gcc_jit_output_kind output_kind,
+ const char *output_path));
+DEF_DLL_FN (void, gcc_jit_context_dump_reproducer_to_file,
+ (gcc_jit_context *ctxt, const char *path));
+DEF_DLL_FN (void, gcc_jit_context_dump_to_file,
+ (gcc_jit_context *ctxt, const char *path, int update_locations));
+DEF_DLL_FN (void, gcc_jit_context_set_bool_option,
+ (gcc_jit_context *ctxt, enum gcc_jit_bool_option opt, int value));
+DEF_DLL_FN (void, gcc_jit_context_set_int_option,
+ (gcc_jit_context *ctxt, enum gcc_jit_int_option opt, int value));
+DEF_DLL_FN (void, gcc_jit_context_set_logfile,
+ (gcc_jit_context *ctxt, FILE *logfile, int flags, int verbosity));
+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));
+
+static bool
+init_gccjit_functions(void)
+{
+ HMODULE library;
+
+ if (!(library = w32_delayed_load (Qgccjit)))
+ {
+ return false;
+ }
+
+ /* In alphabetical order */
+ LOAD_DLL_FN(library, gcc_jit_block_add_assignment);
+ LOAD_DLL_FN(library, gcc_jit_block_add_comment);
+ LOAD_DLL_FN(library, gcc_jit_block_add_eval);
+ LOAD_DLL_FN(library, gcc_jit_block_end_with_conditional);
+ LOAD_DLL_FN(library, gcc_jit_block_end_with_jump);
+ LOAD_DLL_FN(library, gcc_jit_block_end_with_return);
+ LOAD_DLL_FN(library, gcc_jit_block_end_with_void_return);
+ LOAD_DLL_FN(library, gcc_jit_context_acquire);
+ LOAD_DLL_FN(library, gcc_jit_context_compile_to_file);
+ LOAD_DLL_FN(library, gcc_jit_context_dump_reproducer_to_file);
+ LOAD_DLL_FN(library, gcc_jit_context_dump_to_file);
+ LOAD_DLL_FN(library, gcc_jit_context_get_builtin_function);
+ LOAD_DLL_FN(library, gcc_jit_context_get_first_error);
+ LOAD_DLL_FN(library, gcc_jit_context_get_int_type);
+ LOAD_DLL_FN(library, gcc_jit_context_get_type);
+ LOAD_DLL_FN(library, gcc_jit_context_new_array_access);
+ LOAD_DLL_FN(library, gcc_jit_context_new_array_type);
+ LOAD_DLL_FN(library, gcc_jit_context_new_binary_op);
+ LOAD_DLL_FN(library, gcc_jit_context_new_call);
+ LOAD_DLL_FN(library, gcc_jit_context_new_call_through_ptr);
+ LOAD_DLL_FN(library, gcc_jit_context_new_comparison);
+ LOAD_DLL_FN(library, gcc_jit_context_new_field);
+ LOAD_DLL_FN(library, gcc_jit_context_new_function);
+ LOAD_DLL_FN(library, gcc_jit_context_new_function_ptr_type);
+ LOAD_DLL_FN(library, gcc_jit_context_new_global);
+ LOAD_DLL_FN(library, gcc_jit_context_new_opaque_struct);
+ LOAD_DLL_FN(library, gcc_jit_context_new_param);
+ LOAD_DLL_FN(library, gcc_jit_context_new_rvalue_from_int);
+ LOAD_DLL_FN(library, gcc_jit_context_new_rvalue_from_long);
+ LOAD_DLL_FN(library, gcc_jit_context_new_rvalue_from_ptr);
+ LOAD_DLL_FN(library, gcc_jit_context_new_struct_type);
+ LOAD_DLL_FN(library, gcc_jit_context_new_unary_op);
+ LOAD_DLL_FN(library, gcc_jit_context_new_union_type);
+ LOAD_DLL_FN(library, gcc_jit_context_release);
+ LOAD_DLL_FN(library, gcc_jit_context_set_bool_option);
+ LOAD_DLL_FN(library, gcc_jit_context_set_int_option);
+ LOAD_DLL_FN(library, gcc_jit_context_set_logfile);
+ LOAD_DLL_FN(library, gcc_jit_function_get_param);
+ LOAD_DLL_FN(library, gcc_jit_function_new_block);
+ LOAD_DLL_FN(library, gcc_jit_function_new_local);
+ LOAD_DLL_FN(library, gcc_jit_lvalue_access_field);
+ LOAD_DLL_FN(library, gcc_jit_lvalue_as_rvalue);
+ LOAD_DLL_FN(library, gcc_jit_lvalue_get_address);
+ LOAD_DLL_FN(library, gcc_jit_param_as_lvalue);
+ LOAD_DLL_FN(library, gcc_jit_param_as_rvalue);
+ LOAD_DLL_FN(library, gcc_jit_rvalue_access_field);
+ LOAD_DLL_FN(library, gcc_jit_rvalue_dereference);
+ LOAD_DLL_FN(library, gcc_jit_rvalue_dereference_field);
+ LOAD_DLL_FN(library, gcc_jit_rvalue_get_type);
+ 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);
+
+ return true;
+}
+
+/* In alphabetical order */
+#define gcc_jit_block_add_assignment fn_gcc_jit_block_add_assignment
+#define gcc_jit_block_add_comment fn_gcc_jit_block_add_comment
+#define gcc_jit_block_add_eval fn_gcc_jit_block_add_eval
+#define gcc_jit_block_end_with_conditional fn_gcc_jit_block_end_with_conditional
+#define gcc_jit_block_end_with_jump fn_gcc_jit_block_end_with_jump
+#define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return
+#define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return
+#define gcc_jit_context_acquire fn_gcc_jit_context_acquire
+#define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file
+#define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file
+#define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file
+#define gcc_jit_context_get_builtin_function fn_gcc_jit_context_get_builtin_function
+#define gcc_jit_context_get_first_error fn_gcc_jit_context_get_first_error
+#define gcc_jit_context_get_int_type fn_gcc_jit_context_get_int_type
+#define gcc_jit_context_get_type fn_gcc_jit_context_get_type
+#define gcc_jit_context_new_array_access fn_gcc_jit_context_new_array_access
+#define gcc_jit_context_new_array_type fn_gcc_jit_context_new_array_type
+#define gcc_jit_context_new_binary_op fn_gcc_jit_context_new_binary_op
+#define gcc_jit_context_new_call fn_gcc_jit_context_new_call
+#define gcc_jit_context_new_call_through_ptr fn_gcc_jit_context_new_call_through_ptr
+#define gcc_jit_context_new_comparison fn_gcc_jit_context_new_comparison
+#define gcc_jit_context_new_field fn_gcc_jit_context_new_field
+#define gcc_jit_context_new_function fn_gcc_jit_context_new_function
+#define gcc_jit_context_new_function_ptr_type fn_gcc_jit_context_new_function_ptr_type
+#define gcc_jit_context_new_global fn_gcc_jit_context_new_global
+#define gcc_jit_context_new_opaque_struct fn_gcc_jit_context_new_opaque_struct
+#define gcc_jit_context_new_param fn_gcc_jit_context_new_param
+#define gcc_jit_context_new_rvalue_from_int fn_gcc_jit_context_new_rvalue_from_int
+#define gcc_jit_context_new_rvalue_from_long fn_gcc_jit_context_new_rvalue_from_long
+#define gcc_jit_context_new_rvalue_from_ptr fn_gcc_jit_context_new_rvalue_from_ptr
+#define gcc_jit_context_new_struct_type fn_gcc_jit_context_new_struct_type
+#define gcc_jit_context_new_unary_op fn_gcc_jit_context_new_unary_op
+#define gcc_jit_context_new_union_type fn_gcc_jit_context_new_union_type
+#define gcc_jit_context_release fn_gcc_jit_context_release
+#define gcc_jit_context_set_bool_option fn_gcc_jit_context_set_bool_option
+#define gcc_jit_context_set_int_option fn_gcc_jit_context_set_int_option
+#define gcc_jit_context_set_logfile fn_gcc_jit_context_set_logfile
+#define gcc_jit_function_get_param fn_gcc_jit_function_get_param
+#define gcc_jit_function_new_block fn_gcc_jit_function_new_block
+#define gcc_jit_function_new_local fn_gcc_jit_function_new_local
+#define gcc_jit_lvalue_access_field fn_gcc_jit_lvalue_access_field
+#define gcc_jit_lvalue_as_rvalue fn_gcc_jit_lvalue_as_rvalue
+#define gcc_jit_lvalue_get_address fn_gcc_jit_lvalue_get_address
+#define gcc_jit_param_as_lvalue fn_gcc_jit_param_as_lvalue
+#define gcc_jit_param_as_rvalue fn_gcc_jit_param_as_rvalue
+#define gcc_jit_rvalue_access_field fn_gcc_jit_rvalue_access_field
+#define gcc_jit_rvalue_dereference fn_gcc_jit_rvalue_dereference
+#define gcc_jit_rvalue_dereference_field fn_gcc_jit_rvalue_dereference_field
+#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
+
+#endif
+
+static bool
+load_gccjit_if_necessary(bool mandatory)
+{
+#ifdef WINDOWSNT
+ if (!gccjit_initialized)
+ {
+ Lisp_Object status;
+ gccjit_initialized = init_gccjit_functions ();
+ status = gccjit_initialized ? Qt : Qnil;
+ Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache);
+ }
+
+ if (mandatory && !gccjit_initialized)
+ xsignal1(Qnative_compiler_error, build_string("libgccjit not found"));
+
+ return gccjit_initialized;
+#else
+ return true;
+#endif
+}
+
+\f
/* C symbols emitted for the load relocation mechanism. */
#define CURRENT_THREAD_RELOC_SYM "current_thread_reloc"
#define PURE_PTR_SYM "pure_ptr"
@@ -3328,6 +3613,8 @@ DEFUN ("comp--init-ctxt", Fcomp__init_ctxt, Scomp__init_ctxt,
doc: /* Initialize the native compiler context. Return t on success. */)
(void)
{
+ load_gccjit_if_necessary(true);
+
if (comp.ctxt)
{
xsignal1 (Qnative_ice,
@@ -3474,6 +3761,8 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt,
doc: /* Release the native compiler context. */)
(void)
{
+ load_gccjit_if_necessary(true);
+
if (comp.ctxt)
gcc_jit_context_release (comp.ctxt);
@@ -3490,6 +3779,8 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
doc: /* Compile as native code the current context to file. */)
(Lisp_Object base_name)
{
+ load_gccjit_if_necessary(true);
+
CHECK_STRING (base_name);
gcc_jit_context_set_int_option (comp.ctxt,
@@ -3660,6 +3951,9 @@ maybe_defer_native_compilation (Lisp_Object function_name,
fflush (f);
}
#endif
+ if (!load_gccjit_if_necessary(false))
+ return;
+
if (!comp_deferred_compilation
|| noninteractive
|| !NILP (Vpurify_flag)
@@ -3928,6 +4222,15 @@ DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0,
return Qt;
}
+DEFUN ("native-comp-available-p", Fnative_comp_available_p,
+ Snative_comp_available_p, 0, 0, 0,
+ doc: /* Returns t if native compilation of Lisp files is available in
+this instance of Emacs. */)
+ (void)
+{
+ return load_gccjit_if_necessary(false) ? Qt : Qnil;
+}
+
\f
void
syms_of_comp (void)
@@ -4039,6 +4342,7 @@ syms_of_comp (void)
defsubr (&Scomp__register_subr);
defsubr (&Scomp__late_register_subr);
defsubr (&Snative_elisp_load);
+ defsubr (&Snative_comp_available_p);
staticpro (&comp.exported_funcs_h);
comp.exported_funcs_h = Qnil;
diff --git a/src/w32fns.c b/src/w32fns.c
index e595b0285a..eeb73489dd 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -10462,6 +10462,7 @@ syms_of_w32fns (void)
DEFSYM (Qzlib, "zlib");
DEFSYM (Qlcms2, "lcms2");
DEFSYM (Qjson, "json");
+ DEFSYM (Qgccjit, "gccjit");
Fput (Qundefined_color, Qerror_conditions,
pure_list (Qundefined_color, Qerror));
--
2.25.1.windows.1
next prev parent reply other threads:[~2020-05-12 2:46 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 19:55 [PATCH] [WIP] Port feature/native-comp to Windows Nicolas Bertolo
2020-05-08 22:00 ` Andrea Corallo
2020-05-08 22:11 ` Nicolas Bértolo
2020-05-08 22:22 ` Andrea Corallo
2020-05-08 22:23 ` Nicolas Bértolo
2020-05-08 22:27 ` Andrea Corallo
2020-05-08 23:18 ` Stefan Monnier
2020-05-09 6:07 ` Eli Zaretskii
2020-05-09 15:28 ` Nicolas Bértolo
2020-05-09 15:48 ` Eli Zaretskii
2020-05-09 17:09 ` Andrea Corallo
2020-05-10 16:36 ` Nicolas Bértolo
2020-05-10 17:08 ` Eli Zaretskii
2020-05-10 17:50 ` Nicolas Bértolo
2020-05-10 18:22 ` Eli Zaretskii
2020-05-10 19:02 ` Nicolas Bértolo
2020-05-10 19:16 ` Eli Zaretskii
2020-05-10 19:41 ` Nicolas Bértolo
2020-05-10 19:50 ` Andrea Corallo
2020-05-10 19:55 ` Nicolas Bértolo
2020-05-10 20:01 ` Andrea Corallo
2020-05-11 14:19 ` Eli Zaretskii
2020-05-11 14:17 ` Eli Zaretskii
2020-05-11 15:20 ` Nicolas Bértolo
2020-05-11 16:19 ` Eli Zaretskii
2020-05-11 16:43 ` Andrea Corallo
2020-05-11 16:44 ` Nicolas Bértolo
2020-05-11 17:05 ` Eli Zaretskii
2020-05-11 18:19 ` Fabrice Popineau
2020-05-11 18:37 ` Andrea Corallo
2020-05-11 18:48 ` Eli Zaretskii
2020-05-11 19:27 ` Stefan Monnier
2020-05-11 19:42 ` Fabrice Popineau
2020-05-12 2:46 ` Nicolas Bértolo [this message]
2020-05-12 16:56 ` Eli Zaretskii
2020-05-12 17:25 ` Nicolas Bértolo
2020-05-12 18:21 ` Andrea Corallo
2020-05-12 20:33 ` Andrea Corallo
2020-05-13 14:09 ` Nicolas Bértolo
2020-05-13 14:31 ` Andrea Corallo
2020-05-13 15:00 ` Nicolas Bértolo
2020-05-13 15:17 ` Andrea Corallo
2020-05-13 15:48 ` Eli Zaretskii
2020-05-13 3:59 ` Richard Stallman
2020-05-13 14:02 ` Nicolas Bértolo
2020-05-13 15:23 ` Eli Zaretskii
2020-05-13 14:52 ` Eli Zaretskii
2020-05-10 19:47 ` Andrea Corallo
2020-05-10 19:39 ` Andrea Corallo
2020-05-10 17:13 ` Andrea Corallo
2020-05-10 17:15 ` Eli Zaretskii
2020-05-10 18:14 ` Andrea Corallo
2020-05-10 18:30 ` Eli Zaretskii
2020-05-10 18:54 ` Andrea Corallo
2020-05-10 19:02 ` Eli Zaretskii
2020-05-10 19:07 ` Nicolas Bértolo
2020-05-10 19:14 ` Andrea Corallo
2020-05-10 19:24 ` Andrea Corallo
2020-05-10 19:30 ` Eli Zaretskii
2020-05-10 18:05 ` Nicolas Bértolo
2020-05-10 18:23 ` Andrea Corallo
2020-05-10 17:20 ` Andrea Corallo
2020-05-09 13:42 ` Andrea Corallo
2020-05-09 15:40 ` Nicolas Bértolo
2020-05-09 15:55 ` Eli Zaretskii
2020-05-09 16:07 ` Nicolas Bértolo
2020-05-09 16:15 ` Eli Zaretskii
2020-05-09 16:27 ` Andrea Corallo
2020-05-09 16:33 ` Eli Zaretskii
2020-05-09 16:46 ` Andrea Corallo
2020-05-09 16:52 ` 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-OkT=x1Ni8jwVRJRWVTRYVEKgK1uqpePws2G2HzTgAPf9A@mail.gmail.com' \
--to=nicolasbertolo@gmail.com \
--cc=akrl@sdf.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@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).