1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-07 08:00:48 -08:00
Commit graph

43715 commits

Author SHA1 Message Date
Andrea Corallo
79c83f79c5 * src/comp.c (ABI_VERSION): Bump following-up 380ba045c4. 2021-03-09 16:37:05 +01:00
Andrea Corallo
43b0df62cd Merge commit '9cbdf20316' into native-comp 2021-03-09 10:03:47 +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
Andrea Corallo
38b4ac3e6b * Work around GCC PR99126 on all libgccjit < 11
* src/comp.c (Fcomp__compile_ctxt_to_file): Work around GCC
	PR99126 on all libgccjit < 11.
2021-03-07 19:49:18 +01:00
Eli Zaretskii
948e6609b1 Avoid aborts in native-comp subprocesses when exiting Emacs on Windows
* src/w32.c (shutdown_handler): Clear the message stack when being
shut down in noninteractive mode, to avoid aborting in
shut_down_emacs when a native-compilation subprocess is killed
because the parent Emacs exits.
2021-03-07 16:31:35 +02:00
Eli Zaretskii
f89e70a704 Fix encoding of file names in comp.c
* src/comp.c (Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Fix
encoding of file names passed to libgccjit.
2021-03-07 15:52:20 +02:00
Eli Zaretskii
619f66f423 Use MS-Windows system APIs to get number of processors
* lisp/emacs-lisp/comp.el: Use 'w32-get-nproc' instead of the
environment variable NUMBER_OF_PROCESSORS.

* src/w32proc.c (Fw32_get_nproc): New primitive.
* src/w32.c (w32_get_nproc): New function.
(sample_system_load): Call w32_get_nproc to initialize the number
of processors on this system.
* src/w32.h (w32_get_nproc): Add prototype.
2021-03-07 15:32:55 +02:00
Eli Zaretskii
99638d128e ; * src/comp.c (Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Fix last change. 2021-03-07 12:53:51 +02:00
Eli Zaretskii
7a13a0d616 Fix libgccjit PROGNAME on MS-Windows
* src/comp.c [WINDOWSNT]: Import gcc_jit_context_set_str_option.
(init_gccjit_functions): Load gcc_jit_context_set_str_option.
(gcc_jit_context_set_str_option) [WINDOWSNT]: New macro.
(Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Pass the actual name of
the libgccjit DLL to the library, to be used as PROGNAME.
2021-03-07 12:49:05 +02:00
Glenn Morris
9cbdf20316 * src/Makefile.in (base_obj): Remove GMP_OBJ, undefined since 202007. 2021-03-06 11:37:11 -08:00
Stefan Monnier
d582356a7f * src/fns.c (Frandom): Handle bignum limits
(ccall2, get_random_bignum): New functions.
2021-03-05 12:09:50 -05:00
Eli Zaretskii
552ef6d6c0 Fix some unsafe uses of SSDATA in comp.c
* src/comp.c (comp_hash_source_file)
(Fcomp__compile_ctxt_to_file, Fnative_elisp_load): Encode file
names before passing them to library APIs.
(Fcomp__compile_ctxt_to_file): use emacs_fopen instead of fopen.
(declare_lex_function): Avoid keeping a 'char *' pointer around
while calling Lisp, which could trigger GC, which could relocate
string data.
2021-03-05 16:41:41 +02:00
Andrea Corallo
260617ddc2 * Harden `comp-abi-hash' computation
Account for subr arity in `comp-abi-hash' computation as that's part
of the ABI exposed to .eln files.

	* src/comp.c (Fcomp__subr_signature): New support function.
	(hash_native_abi): Make use of.
	(syms_of_comp): Register 'Scomp__subr_signature'.
2021-03-05 11:02:21 +01:00
Eli Zaretskii
b456b19ec4 Fix typos and doc strings in native-compilation files
* lisp/emacs-lisp/comp.el (comp-speed, comp-debug, comp-verbose)
(comp-always-compile, comp-deferred-compilation-deny-list)
(comp-bootstrap-deny-list, comp-never-optimize-functions)
(comp-async-jobs-number, comp-async-cu-done-hook)
(comp-async-all-done-hook, comp-async-env-modifier-form)
(comp-pass, comp-native-compiling, comp-post-pass-hooks)
(comp-known-predicate-p, comp-pred-to-cstr)
(comp-symbol-values-optimizable, comp-limple-assignments)
(comp-limple-calls, comp-limple-branches, comp-block)
(comp-vec--verify-idx, comp-vec-aref, comp-vec-append)
(comp-vec-prepend, comp-block-preds)
(comp-ensure-native-compiler, comp-log, comp-log-func)
(comp-loop-insn-in-block, comp-byte-frame-size)
(comp-add-func-to-ctxt, comp-spill-lap-function, comp-spill-lap)
(comp-lap-fall-through-p, comp-new-frame, comp-emit-set-call)
(comp-copy-slot, comp-latch-make-fill, comp-emit-cond-jump)
(comp-body-eff, comp-op-case, comp-prepare-args-for-top-level)
(comp-limplify-top-level, comp-negate-arithm-cmp-fun)
(comp-emit-assume, comp-cond-cstrs-target-mvar)
(comp-function-foldable-p, comp-function-call-maybe-fold)
(comp-form-tco-call-seq, comp-clean-up-stale-eln)
(comp-delete-or-replace-file, comp--native-compile)
(native--compile-async, native-compile)
(batch-byte-native-compile-for-bootstrap): Fix typos, wording, and
punctuation in doc strings.
* lisp/loadup.el: Fix typos.

* src/lread.c (syms_of_lread): Doc fix.
2021-03-04 20:36:43 +02:00
Matt Armstrong
6ff90ef0bb Call the set_buffer_overlays_ setters
* src/buffer.c (Fkill_buffer): Call set_buffer_overlays_before and
set_buffer_overlays_after instead of setting the fields directly
(bug#46914).
2021-03-04 21:12:00 +01:00
Andrea Corallo
6444f69de2 * src/comp.c (hash_native_abi): Account for `system-configuraton-options'. 2021-03-04 09:03:26 +01:00
Pip Cet
43b40bc880 Don't call _setjmp through a function pointer (Bug#46824)
* src/comp.c (helper_link_table): Don't include SETJMP except on Windows.
(emit_setjmp): Don't use function pointers except on Windows.
(declare_runtime_imported_funcs): Don't import SETJMP at runtime.
(ABI_VERSION): Bump.
* test/src/comp-tests.el (46824-1): New test.
* test/src/comp-test-funcs.el (comp-test-46824-1-f): New function.
2021-03-03 20:36:16 +01:00
Andrea Corallo
cf37850e2d * src/comp.c (return_nil): Make it not a nested function. 2021-03-03 20:36:16 +01:00
Eli Zaretskii
30810905de Fix compilation warnings in --with-wide-int build on Windows
* src/comp.c (emit_rvalue_from_emacs_uint)
(emit_rvalue_from_lisp_word_tag): Fix comparison of unsigned
values.
(gcc_jit_context_new_rvalue_from_ptr): Define only if
LISP_WORDS_ARE_POINTERS, to avoid compilation warning.
(init_gccjit_functions): Load gcc_jit_context_new_rvalue_from_ptr
only if LISP_WORDS_ARE_POINTERS.
2021-03-03 20:15:58 +02:00
Eli Zaretskii
e5a0d4c425 Avoid aborting on MS-Windows at startup
* src/emacs.c (set_invocation_vars) [WINDOWSNT]: If argv0 is not
an absolute file name, obtain the absolute file name of the Emacs
executable from 'w32_my_exename'.
2021-03-03 19:58:20 +02:00
Stefan Monnier
6ad9b8d677 * src/eval.c (init_eval_once): Bump max_specpdl_size (bug46818)
Further testing seems to confirm my suspicion that the increase in the
specpdl comes from the recent change to `pcase--if`.

* lisp/international/mule-cmds.el (update-leim-list-file): Revert workaround.
2021-03-01 11:42:04 -05:00
Matt Armstrong
70514c6374 Clean up obsolete comment
* src/marker.c (unchain_marker): Clean up obsolete comment
(bug#46836).

Commit cf3164523b (* src/alloc.c: Avoid O(N²) complexity when
unchaining markers (bug#24548)., 2018-03-23) removed the call from GC
into unchain_marker, so there is no need to warn about it.
2021-03-01 14:26:21 +01:00
Andrea Corallo
2acc46b55b Migrate and rename a bunch of functions from comp.el to comp-cstr.el
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-imm-vld-p)
	(comp-cstr-imm, comp-cstr-fixnum-p, comp-cstr-symbol-p)
	(comp-cstr-cons-p): Move and rename from 'comp.el'.
	* lisp/emacs-lisp/comp.el (comp-mvar-type-hint-match-p)
	(make-comp-mvar, comp-emit-assume, comp-fwprop-prologue)
	(comp-function-foldable-p, comp-function-call-maybe-fold)
	(comp-fwprop-call, comp-fwprop-insn, comp-call-optim-func)
	(comp-compute-function-type): Update for renamed functions.
	* src/comp.c (emit_mvar_rval): Likewise.
	* test/src/comp-tests.el (comp-tests-mentioned-p-1)
	(comp-tests-cond-rw-checker-val): Likewise.
2021-02-28 23:29:49 +01:00
Andrea Corallo
312deba530 * Canonicalize filenames on Windows before hashing (bug#46256)
* src/comp.c (Fcomp_el_to_eln_filename): On Windowns
	canonicalize filenames before hashing.
2021-02-26 21:28:59 +01:00
Andrea Corallo
5c922cc3a4 Merge remote-tracking branch 'savannah/master' into native-comp 2021-02-26 19:54:59 +01:00
Eli Zaretskii
6bf56a3614 Fix documentation of a recent change
* src/fns.c (Fyes_or_no_p): Don't use braces around one-line
block.
(syms_of_fns) <use-short-answers>: Improve the wording of the doc
string.
* etc/NEWS: Improve wording of the entry about 'use-short-answers'.
2021-02-25 20:58:44 +02:00
Juri Linkov
297c0e0306 New variable 'use-short-answers' to use 'y-or-n-p' instead of 'yes-or-no-p'
* lisp/cus-start.el: Add use-short-answers.

* lisp/emacs-lisp/map-ynp.el (read-answer): Handle use-short-answers.
(read-answer-short): Add use-short-answers to docstring.

* src/fns.c (Fyes_or_no_p): Call y-or-n-p if use_short_answers is true.
(syms_of_fns): Add DEFVAR_BOOL use-short-answers (bug#46594).
2021-02-25 20:45:40 +02:00
Alan Third
056b468f74 Fix freeze on older macOS's (bug#46687)
* src/nsterm.m ([EmacsView windowDidChangeBackingProperties:]):
([EmacsView viewWillDraw]): Only run this code when actually drawing
to an offscreen bitmap.
2021-02-25 17:58:59 +00:00
Robert Pluim
d84d69dfbc Don't crash if gnutls_handshake fails
In some situations involving Internet access not being fully
functional, gnutls_handshake returns a fatal error, which we were
ignoring, causing us to call gnutls_handshake again.  Now we check for
the error and return it to the caller.

* src/gnutls.c (gnutls_try_handshake): Return immediately if
gnutls_handshake returns a fatal error (Bug#46709).
2021-02-25 16:44:43 +01:00
Robert Pluim
a1673d3296 ; * src/xfaces.c (realize_gui_face): Correct formatting
* src/xfaces.c (realize_gui_face): Correct code formatting.
2021-02-25 16:44:43 +01:00
Eli Zaretskii
ac45f31454 Fix dangerous code in xdisp.c
* src/xdisp.c (move_it_to, display_line): Make sure ZV_BYTE is
greater than 1 before fetching previous byte.
2021-02-24 17:55:28 +02:00
Eli Zaretskii
eef185dfc8 Better support for 'truncate-line' non-nil in the mini-window
* src/xdisp.c (resize_mini_window): Resize the mini-window
when multi-line text is displayed under	truncate-lines
non-nil in the minibuffer.  (Bug#46718)
2021-02-24 17:43:08 +02:00
Stefan Kangas
7466b10346 Improve wrong number of args error message in propertize
* src/editfns.c (Fpropertize): Improve error message.
(syms_of_editfns) <Qpropertize>: New DEFSYM.
* test/src/editfns-tests.el
(propertize/error-wrong-number-of-args): New test.
2021-02-22 11:56:12 +01:00
Andrea Corallo
cf1e8e792f Merge remote-tracking branch 'savannah/master' into HEAD 2021-02-21 22:08:01 +01:00
Mattias Engdegård
d0c47652e5 Faster, more compact, and readable closure creation
Simplify closure creation by calling a single function at run time
instead of putting it together from small pieces.  This is faster
(by about a factor 2), takes less space on disk and in memory, and
makes internal functions somewhat readable in disassembly listings again.

This is done by creating a prototype function at compile-time whose
closure variables are placeholder values V0, V1... which can be seen
in the disassembly.  The prototype is then cloned at run time using
the new make-closure function that replaces the placeholders with
the actual closure variables.

* lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure):
Generate call to make-closure from a prototype function.
* src/alloc.c (Fmake_closure): New function.
(syms_of_alloc): Defsubr it.
* src/data.c (syms_of_data): Defsym byte-code-function-p.
2021-02-21 21:58:25 +01:00
Alan Third
e6842038c9 Fix memory leak
* src/nsterm.m ([EmacsSurface dealloc]): Release will remove all
objects and free the memory.
2021-02-20 20:42:11 +00:00
Lars Ingebrigtsen
12578d6aca Change how (declare (modes store the data
* lisp/emacs-lisp/byte-run.el (byte-run--set-modes): Change from
being a predicate to storing the modes.  This allows using the
modes for positive command discovery, too.
* src/data.c (Fcommand_modes): Look at the `command-modes' symbol
property, too.
2021-02-20 14:29:41 +01:00
Andrea Corallo
39792cf629 * Work around bug#46495 (GCC PR99126)
* src/comp.c (gcc_jit_context_add_command_line_option): Import for
	dynamic load.
	(Fcomp__compile_ctxt_to_file): Disable GCC "isolate-paths" on GCC
	10.
2021-02-19 23:02:42 +01:00
Andrea Corallo
92fe7a91f4 * Remove unnecessary function 'emit_rvalue_from_unsigned_long_long'
* src/comp.c (emit_rvalue_from_unsigned_long_long): Remove
	function.
	(emit_rvalue_from_emacs_uint, emit_rvalue_from_lisp_word_tag)
	(emit_rvalue_from_lisp_word): Make use of
	'emit_rvalue_from_long_long'.
2021-02-19 22:56:51 +01:00
Andrea Corallo
14e6268d14 * Pacify GCC warning on non wide-int configurations
* src/comp.c (emit_rvalue_from_emacs_uint)
	(emit_rvalue_from_lisp_word_tag): Pacify GCC warning.
	(emit_rvalue_from_unsigned_long_long): Define it only when
	necessary.
2021-02-19 22:56:51 +01:00
Alan Third
283f98353f Fix frame contents scaling bug on macOS (bug#46155)
Discussion in bug#46406.

* src/nsterm.m ([EmacsView focusOnDrawingBuffer:]): Set the scale
factor for the backing layer.
2021-02-19 19:37:02 +00:00
Glenn Morris
1d50050af7 Merge from origin/emacs-27
8e8b46ef81 (origin/emacs-27) More accurate documentation of the "r" i...
dcb2015a5b Mention the GNU Kind Communications Guidelines in the FAQ
9882e63eea ; * CONTRIBUTE: Another wording change regarding tiny chan...
850f18ef23 Allow newlines in password prompts again in comint
c977370dd7 Avoid point movement when visiting image files
da64a257a4 ; * CONTRIBUTE: Yet another clarification of significant c...
d03f2a6ee9 Avoid assertion violation in callproc.c
dcc00bbb19 ; * CONTRIBUTE: Clarify the "15-lines" rule a bit more.
2021-02-19 08:36:56 -08:00
Glenn Morris
07b22b6b5d Merge from origin/emacs-27
4712c75ab8 Clarify when activate-mark-hook is run
abedf3a865 Fix language-environment and font selection on MS-Windows
8b8708eadd Fix example in Sequence Functions node in the manual
2021-02-19 08:36:55 -08:00
Andrea Corallo
2110a3faf7 * src/pdumper.c (dump_do_dump_relocation): Use emacs_fopen + ENCODE_FILE. 2021-02-18 22:50:55 +01:00
Andrea Corallo
805cae572a * src/emacs.c (syms_of_emacs): Add a FIXME for Windows native-comp. 2021-02-18 22:32:58 +01:00
Andrea Corallo
b1bab6e073 * Add a bunch of assertions for fixnums coming from Lisp later used as int
* src/comp.c (emit_limple_insn, declare_lex_function)
	(compile_function, Fcomp__compile_ctxt_to_file): Add some
	assertion.
2021-02-18 22:20:06 +01:00