1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-08 12:40:49 -08:00
Commit graph

617 commits

Author SHA1 Message Date
Stefan Kangas
c66eb52453 Merge from origin/emacs-28
9c222b9c1a Port to C compilers that lack size-0 arrays
fed35a8951 Port emacsclient to Solaris 10
f35d6a9c73 * CONTRIBUTE: Improve commit message instructions
e0ee1d003a Work around IBM XL C compiler bug
6b99b6eb8b * admin/make-tarball.txt: Various clarifications.
bbf4140091 * admin/diff-tar-files: Don't assume .tar.gz.
0a50ad11db * lisp/tab-bar.el (tab-bar-close-other-tabs): Fix regression.
2021-12-03 06:30:26 +01:00
Paul Eggert
9c222b9c1a Port to C compilers that lack size-0 arrays
The C standard does not allow size-zero arrays, so redo struct
Lisp_Subr to not use size-zero arrays when native compilation is
not being used.  Formerly, the code was using size-zero arrays (a
GNU C extension) to avoid using memory unnecessarily when
HAVE_NATIVE_COMP is not defined.  Replace this hack with the
more-traditional hack of putting the relevant members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/alloc.c (cleanup_vector, mark_object):
* src/comp.c (make_subr):
* src/data.c (Fsubr_native_lambda_list, Fsubr_native_comp_unit):
* src/eval.c (init_eval_once, funcall_lambda):
* src/lisp.h (SUBR_NATIVE_COMPILEDP, SUBR_NATIVE_COMPILED_DYNP)
(SUBR_TYPE):
* src/lread.c (Fload):
Conditionally compile with ‘#ifdef HAVE_NATIVE_COMP’ instead of
with ‘if (NATIVE_COMP_FLAG)’.  Redo members like native_comp_u[0]
to be plain native_comp_u.  Put all uses of these members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/lisp.h (struct Lisp_Subr): Members native_comp_u,
native_c_name, lambda_list, type are now all ifdeffed out if
HAVE_NATIVE_COMP is not defined, instead of being size-zero
arrays.  All uses changed.
* src/pdumper.c (dump_subr, dump_cold_native_subr)
(dump_do_dump_relocation):
* src/comp.h (NATIVE_COMP_FLAG): Remove; no longer needed.
2021-12-02 19:03:14 -08:00
Stefan Kangas
93d9bc09f4 Merge from origin/emacs-28
e632b83a28 Update authors.el for Emacs 28
e9fdb11903 ; * ChangeLog.3: Some additional fixes.
8fa4749df1 ; * ChangeLog.3: Filename fixes.
ea5a90b4f4 * lisp/repeat.el: Fix long-standing problem when a random ...
ef4954b69c * lisp/repeat.el (repeat-keep-prefix): Change default to nil.
6d5886e780 * test/lisp/repeat-tests.el (repeat-tests-call-b): Test fo...
9e16c6a96d ; * src/comp.c (syms_of_comp) <comp-no-native-file-h>: Doc...
9aa8fd6e62 * src/callint.c (Fcall_interactively): Fix inhibit_mouse_e...
70c229b1fc Fix regression in gdb-frame-handler
cd9dd26d24 Format and index concept 'predicate' in ELisp Intro
ab291656d0 ; * ChangeLog.3: Fix typos.
354f6c5609 ; * ChangeLog.3: Formatting fixes.
6192525a96 ; make change-history-commit
2021-12-01 06:30:22 +01:00
Eli Zaretskii
9e16c6a96d ; * src/comp.c (syms_of_comp) <comp-no-native-file-h>: Doc fix. 2021-11-30 20:23:47 +02:00
Eli Zaretskii
bf299b7d2f ; * src/comp.c (syms_of_comp): Fix first lines of doc strings. 2021-11-30 20:16:25 +02:00
Andrea Corallo
9b381a95ef Improve native compiler startup circular dependecy prevention mechanism
* src/comp.c (maybe_defer_native_compilation): Update to accumulate
delayed objects in `comp--delayed-sources'.
(syms_of_comp): Add `comp--delayed-sources' and `comp--loadable'
vars.

* lisp/startup.el (startup--honor-delayed-native-compilations): New
function.
(normal-top-level): Call it.
2021-11-30 15:42:41 +01:00
Lars Ingebrigtsen
40c0864f4b Update Fstring_match calls in comp.c
* src/comp.c (Fcomp_el_to_eln_rel_filename, file_in_eln_sys_dir):
Update Fstring_match calls.
2021-10-07 20:55:05 +02:00
Eli Zaretskii
2386b08526 Fix build with native compilation but without zlib
* src/comp.c (comp_hash_source_file): Condition code that requires
zlib with HAVE_ZLIB.

* etc/NEWS: Explain that '--without-compress-install' is necessary
when configuring with native compilation but without zlib.
2021-09-22 19:13:49 +03:00
Eli Zaretskii
959d647568 Doc string fixes in comp.e
* src/comp.c (Fcomp_el_to_eln_filename)
(Fcomp_el_to_eln_rel_filename): Doc fix.
2021-09-22 16:01:30 +03:00
Eli Zaretskii
6b631f490a Avoid compiler warnings in comp.c on MS-Windows
* src/comp.c (DEF_DLL_FN, init_gccjit_functions): Don't load and
don't define functions/macros if libgccjit doesn't have them, to
avoid compiler warnings.
2021-09-15 16:09:45 +03:00
Andrea Corallo
1b0fb8fc2e * Clean-up some unnecessary macro usage in comp.c
* src/comp.c (emit_static_object)
	(Fcomp_native_driver_options_effective_p, add_driver_options)
	(Fcomp__compile_ctxt_to_file, Fcomp_libgccjit_version): Clean-up
	unenecessary 'defined (WINDOWSNT)' usage.
2021-09-13 16:51:49 +02:00
Arthur Miller
dea67939b6 Add support for GCC compiler command-line options
* lisp/emacs-lisp/comp.el ('native-comp-compiler-options): New option.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Add support
for new 'native-comp-compiler-options'.
* src/comp.c (Fcomp_native_compiler_options_effective_p): New function.
(add_compiler_options): New function.
(Fcomp__compile_ctxt_to_file): Call 'add_compiler_options'.
2021-09-10 21:04:41 +02:00
Kien Nguyen
c0243d9e82 * Add a dll loader entry for gcc_jit_context_new_cast (bug#50315)
* src/comp.c: Add a dll loader entry for
'gcc_jit_context_new_cast' (bug#50315).
2021-09-01 15:26:04 +02:00
Andreas Schwab
6767e55659 Implement proper type conversion in native compiler
* src/comp.c (enum cast_kind_of_type): Remove.
(comp_t): Add cast_ptr_to_int, cast_int_to_ptr, remove
cast_type_sizes, cast_type_kind, cast_type_names, cast_union_fields,
cast_union_field_biggest_type.
(emit_coerce): Remove check for type size.
(struct cast_type): Remove bytes_size.
(define_type_punning): New function.
(define_cast_from_to): Implement proper type conversion.
(define_cast_functions): Adjust.  (bug#50230)
2021-08-30 19:00:46 +02:00
Andrea Corallo
6c007668b3 Set a unique ID for eln files on macOS (bug#45934)
* src/comp.c (Fcomp__compile_ctxt_to_file): Set gcc's -install_name
parameter to the real filename.
2021-08-22 22:15:29 +01:00
Alan Third
1b88404acc Fix NS self contained eln location (bug#49271)
* Makefile.in:
* configure.ac: Change eln file install location to
Contents/Frameworks.
* src/comp.c (hash_native_abi): Replace dots with underscores in the
eln install location as the macOS code-signing tool won't sign the
files if the parent directories have dots.
2021-07-01 20:41:58 +01:00
Mattias Engdegård
b9f339e8f8 ; * src/comp.c (ADD_IMPORTED): Fix broken macro. 2021-06-18 15:02:58 +02:00
Eli Zaretskii
d3817ad6ce Fix resolution of symlinks during dumping
* src/comp.c (Fcomp_el_to_eln_rel_filename): Don't use
'file-truename', as it is only available once files.el is loaded,
which doesn't work during dumping, until loadup loads files.el.
Instead, use 'realpath'.  (Bug#48578)
* src/w32.c (realpath): New function.
* src/w32.h (realpath): Add prototype.

* nt/mingw-cfg.site (ac_cv_func_realpath)
(gl_cv_func_realpath_works): Define to "yes", as this function is
now implemented in w32.c.
2021-05-27 16:31:14 +03:00
Andrea Corallo
3f207753a0 * Fix ahead-of-time native compilation for out-of-tree builds (bug#48497)
* src/comp.c (Fcomp_el_to_eln_rel_filename): Expand
'PATH_DUMPLOADSEARCH' while computing 'loadsearch_re_list'.
2021-05-21 08:49:25 +02:00
Andrea Corallo
63df3372be Rename comp-deferred-compilation
* lisp/progmodes/elisp-mode.el
	(emacs-lisp-native-compile-and-load): Rename
	comp-deferred-compilation -> native-comp-deferred-compilation.
	* src/comp.c (maybe_defer_native_compilation, syms_of_comp):
	Likewise.
2021-05-11 18:31:45 +02:00
Andrea Corallo
fbbcbed10e Rename comp-eln-load-path → native-comp-eln-load-path
* src/comp.c (Fcomp_el_to_eln_filename): Rename comp-eln-load-path →
native-comp-eln-load-path.
* src/lread.c (maybe_swap_for_eln): Likewise.
* lisp/startup.el (native-comp-eln-load-path)
(normal-top-level): Likewise.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function, comp-final)
(comp-eln-load-path-eff, comp-trampoline-compile)
(comp-clean-up-stale-eln, comp-run-async-workers)
(comp-lookup-eln, batch-byte-native-compile-for-bootstrap): Likewise.
2021-05-06 17:16:09 +02:00
Andrea Corallo
901ce56603 Rename comp-warning-on-missing-source
* src/lread.c (maybe_swap_for_eln): Rename
comp-warning-on-missing-source →
native-comp-warning-on-missing-source.
* src/comp.c (syms_of_comp): Likewise.
* lisp/emacs-lisp/comp.el (native-comp-warning-on-missing-source):
Likewise.
2021-05-06 17:16:09 +02:00
Andrea Corallo
8c429a42c4 Rename comp-native-driver-options → native-comp-driver-options
* src/comp.c (add_driver_options, syms_of_comp): Rename
comp-native-driver-options → native-comp-driver-options.
* lisp/emacs-lisp/comp.el (native-comp-driver-options)
(comp-ctxt, comp-spill-lap-function, comp-final)
(comp-run-async-workers): Likewise.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Likewise.
2021-05-06 17:16:08 +02:00
Andrea Corallo
94c69eb1d7 Rename comp-debug -> native-comp-debug
* src/comp.c (emit_ctxt_code, syms_of_comp): Rename comp-debug ->
native-comp-debug.
* lisp/emacs-lisp/comp.el (native-comp-debug, comp-ctxt)
(comp-spill-lap-function, comp-run-async-workers): Likewise.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Likewise.
* test/src/comp-tests.el (comp-tests-bootstrap): Likewise.
2021-05-06 17:16:07 +02:00
Andrea Corallo
43f29696ad Rename comp-speed -> native-comp-speed
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename
comp-speed -> native-comp-speed.
* lisp/emacs-lisp/comp.el (native-comp-speed, comp-ctxt, comp-func,
comp-spill-lap-function, comp-trampoline-compile,
comp-run-async-workers): Likewise.
* src/comp.c (emit_ctxt_code, load_comp_unit, syms_of_comp): Likewise.
* test/src/comp-tests.el (comp-tests-tco, comp-tests-fw-prop-1)
(comp-tests-check-ret-type-spec, comp-tests-pure): Likewise.
2021-05-06 17:16:07 +02:00
Andrea Corallo
40736357b8 Rename feature nativecomp' into native-compile'
* test/src/comp-tests.el : Rename feature `nativecomp' into
	`native-compile'.
	* test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Likewise.
	* src/comp.c (syms_of_comp): Likewise.
	* lisp/startup.el (normal-top-level): Likewise.
	* lisp/loadup.el: Likewise.
	* lisp/help.el (help-function-arglist): Likewise.
	* lisp/emacs-lisp/package.el (package--native-compile-async)
	(package--delete-directory): Likewise.
	* lisp/emacs-lisp/nadvice.el (advice--add-function): Likewise.
	* lisp/emacs-lisp/comp.el (comp-ensure-native-compiler): Likewise.
	* lisp/emacs-lisp/advice.el (ad-add-advice): Likewise.
2021-05-05 22:27:29 +02:00
Eli Zaretskii
7e25e0f96b ; * src/comp.c: Fix typos. 2021-04-27 21:51:57 +03:00
Stefan Kangas
233c0af31e ; Fix typos 2021-04-27 18:54:37 +02:00
Eli Zaretskii
490b8c2c33 * src/comp.c (fixup_eln_load_path): Simplify code. 2021-04-18 16:44:44 +03:00
Eli Zaretskii
9aa5203b54 Fix loading *.eln files when Emacs is installed via symlinks
* src/emacs.c (real_filename, set_invocation_vars)
(init_vars_for_load): Functions deleted; callers adjusted.
(init_cmdargs): Put back all the code which was extracted into
set_invocation_vars.
(load_pdump_find_executable): Make sure the return value has any
symlinks in it expanded.
(load_pdump): Accept only 2 arguments, not 3.  Determine both the
file name of the Emacs executable and of the dump file in
synchronized manner, so that if we decided to look for the dump
file in its hardcoded installation directory, the directory of the
Emacs executable will also be where we expect it to be installed.
Pass only 2 arguments to pdumper_load.  (Bug#47800)  (Bug#44128)
* src/pdumper.c (dump_do_dump_relocation): Use emacs_execdir
instead of Vinvocation_directory to produce absolute file names of
*.eln files that are recorded in the pdumper file.  Pass the full
.eln file name to fixup_eln_load_path.
(pdumper_set_emacs_execdir) [HAVE_NATIVE_COMP]: New function.
(pdumper_load) [HAVE_NATIVE_COMP]: Call pdumper_set_emacs_execdir.
* src/comp.c (fixup_eln_load_path): Use Fsubstring_no_properties
instead of Fsubstring.  No need to cons a file name, as the caller
already did that.  Use explicit const string to avoid "magic"
values.

* lisp/startup.el (normal-top-level): Use expand-file-name instead
of concat.  Decode comp-eln-load-path and expand-file-name its
members.
2021-04-17 16:49:16 +03:00
Andrea Corallo
0a3e715e1f * Introduce `comp-file-preloaded-p'
* src/comp.c (syms_of_comp): Define `comp-file-preloaded-p'.
	(Fcomp_el_to_eln_filename): Account for `comp-file-preloaded-p'.
2021-04-05 20:59:11 +02:00
Andrea Corallo
39bc9bc770 * src/comp.c (fixup_eln_load_path): Fix parameter name. 2021-04-04 22:51:24 +02:00
Andrea Corallo
9333bc4863 * src/comp.c (Fcomp_el_to_eln_filename): Fix doc. 2021-04-04 22:51:24 +02:00
Andrea Corallo
6f8ec14491 Output native compiled preloaded files into the 'preloaded' subfolder
* src/comp.c (fixup_eln_load_path): Account the fact that the
	file can be dumped in the 'preloaded' subfolder.
	* lisp/loadup.el: Likewise.
	* src/lread.c (maybe_swap_for_eln1): New function.
	(maybe_swap_for_eln): Handle 'preloaded' subfolder.
	* src/Makefile.in (LISP_PRELOADED): Export preloaded files.
2021-04-04 22:41:17 +02:00
Andrea Corallo
dc393517ca Issue a warning when eln look-up fails due to missing .el source file.
* lisp/emacs-lisp/comp.el (comp-warning-on-missing-source): New
	customize.
	* src/lread.c (maybe_swap_for_eln): Issue a warning when eln
	look-up fails due to missing .el source file.
	* src/comp.c (syms_of_comp): Define
	'Qcomp_warning_on_missing_source'.
2021-04-01 21:49:38 +02:00
Eli Zaretskii
8d550700c5 * src/comp.c (Fcomp__compile_ctxt_to_file): Fix debug level 1. 2021-03-31 22:11:08 +03:00
Andrea Corallo
53ca0d9844 Rework native compilation `comp-debug' (bug#46495)
* lisp/emacs-lisp/comp.el (comp-debug): Update docstring and
	move default on Windows systems from 0 to 1.
	* src/comp.c (Fcomp__compile_ctxt_to_file): Tweak debug
	levels.
2021-03-31 20:25:08 +02:00
Andrea Corallo
613caa9527 Do not defer compilation when bytecode is explicitly requested (bug#46617)
* src/comp.c (maybe_defer_native_compilation): Check if the file
	is registered in 'V_comp_no_native_file_h'.
	(syms_of_comp): 'V_comp_no_native_file_h' new global.
	* src/lread.c (maybe_swap_for_eln): Register files in
	'V_comp_no_native_file_h'.
	* lisp/faces.el (tty-run-terminal-initialization): Do not
	explicitly load .elc file to not exclude .eln being loaded in
	place.
2021-03-31 19:56:10 +02:00
Andrea Corallo
92914ade6d Improve two native compiler related docstrings.
* lisp/emacs-lisp/comp.el (comp-eln-load-path-eff): Improve docstring.
	* src/comp.c (comp-eln-load-path): Likewise.
2021-03-24 17:02:40 +01:00
Andrea Corallo
5ae0a728c0 ; * src/comp.c (Fcomp_el_to_eln_filename): Improve docstring. 2021-03-21 21:50:22 +01:00
Andrea Corallo
5aa42f686c Prevent unnecessary multiple .el hashing in 'maybe_swap_for_eln'
* src/comp.c (Fcomp_el_to_eln_rel_filename): New function.
	(Fcomp_el_to_eln_filename): Make use of.
	(syms_of_comp): Register 'Scomp_el_to_eln_rel_filename'.
	* src/lread.c (maybe_swap_for_eln): Make use of
	'Fcomp_el_to_eln_rel_filename' to hash prevent unnecessary
	multiple hashing.
2021-03-21 20:45:03 +01:00
Eli Zaretskii
aabda4263b Prefer expand-file-name to concat in native-compilation code
* lisp/emacs-lisp/comp.el (comp-eln-load-path-eff):
* src/comp.c (Fcomp_el_to_eln_filename)
(eln_load_path_final_clean_up): Prefer expand-file-name to concat.
(Bug#43725)
2021-03-15 16:56:08 +02:00
Pip Cet
472cd53d93 Don't call setjmp through a function pointer on Windows (bug#47067)
* src/comp.c (ABI_VERSION): Bump.
(emit_setjmp): Call setjmp directly.
(declare_runtime_imported_funcs): Remove setjmp.
(helper_link_table): Remove entry for setjmp.
2021-03-14 15:47:18 +00:00
Eli Zaretskii
f142f5ba46 Fix hang due to failure to clean up *.eln.old files at exit
* src/comp.c (eln_load_path_final_clean_up): Call
internal_delete_file, not Fdelete_file, to ignore any errors.
(Bug#46972)
2021-03-14 15:36:39 +02:00
Andrea Corallo
79c83f79c5 * src/comp.c (ABI_VERSION): Bump following-up 380ba045c4. 2021-03-09 16:37:05 +01:00
Pip Cet
380ba045c4 * Fix comp unit type decl in eln files to fix GC crash (bug#46256)
* src/comp.c (emit_ctxt_code): Allocate comp_unit as a Lisp_Object,
not a pointer to pointer to Lisp_Object.
2021-03-09 09:25:38 +01:00
Pip Cet
93f92cf1ba Zero stale pointer when unloading comp units (bug#46256)
* src/alloc.c (cleanup_vector): Call unload_comp_unit.
* src/comp.c (unload_comp_unit): New function.
2021-03-09 09:25:27 +01:00
Andrea Corallo
15aa239ba0 * Handle `comp-native-driver-options' both as file-local both as global
* src/comp.c (add_driver_options): Throw an error if
	`comp-native-driver-options' is set globally but
	'gcc_jit_context_add_driver_option' is not available, ignore for
	the file-local case.
2021-03-07 22:20:07 +01:00
Andrea Corallo
dcf2be6971 ; * src/comp.c (load_comp_unit): Fix a comment. 2021-03-07 21:01:35 +01:00
Andrea Corallo
dbdc44db15 Allow for `comp-native-driver-options' to work as a file-local variable. 2021-03-07 20:19:20 +01:00