Commit graph

846 commits

Author SHA1 Message Date
Andrea Corallo
c5de73a95a Fix native compilation for circular immediates (bug#67883)
* test/src/comp-resources/comp-test-funcs.el
(comp-test-67883-1-f): New function.

* lisp/emacs-lisp/comp.el (comp--collect-rhs)
(comp--ssa-rename-insn): Handle setimm aside to avoid unnecessary
immediate manipulation.
(comp--copy-insn-rec): Rename.
(comp--copy-insn): New function.
(comp--dead-assignments-func): Handle setimm aside to avoid
unnecessary.
2024-03-24 12:16:11 +01:00
Eli Zaretskii
ae9d8eedfd ; Minor copyedits of last change. 2024-03-20 16:08:15 +02:00
Andrea Corallo
e2fec514fd ; * lisp/emacs-lisp/comp.el: Add a simple sanitizer usage example. 2024-03-20 14:55:44 +01:00
Eli Zaretskii
1475e3c3b5 ; Fix doc strings of recent changes
* src/comp.c (syms_of_comp) <comp-sanitizer-active>:
* lisp/emacs-lisp/comp.el (comp-sanitizer-emit): Doc fixes.
2024-03-20 14:27:25 +02:00
Andrea Corallo
0b0c7da8c8 Add native compiler sanitizer
* src/comp.c (ABI_VERSION): Bump new version.
(CALL0I): Uncomment.
(helper_link_table, declare_runtime_imported_funcs): Add
'helper_sanitizer_assert'.
(Fcomp__init_ctxt): Register emitter for
'helper_sanitizer_assert'.
(helper_sanitizer_assert): New function.
(syms_of_comp): 'helper_sanitizer_assert' defsym.
(syms_of_comp): 'comp-sanitizer-error' define error.
(syms_of_comp): 'comp-sanitizer-active' defvar.

* lisp/emacs-lisp/comp.el (comp-passes): Add 'comp--sanitizer'.
(comp-sanitizer-emit): Define var.
(comp--sanitizer): Define function.

* lisp/emacs-lisp/comp-run.el (comp-run-async-workers): Forward
'comp-sanitizer-emit'.
2024-03-20 09:51:10 +01:00
Stefan Monnier
d5773276fb (comp-known-predicates): Fix overly optimistic functionp
* lisp/emacs-lisp/comp.el (comp-known-predicates): `functionp` can also
be true for `cons` objects.
2024-03-12 08:48:09 -04:00
Andrea Corallo
91b90885ac * lisp/emacs-lisp/comp.el (comp-known-predicates): Add 'symbol-with-pos-p'. 2024-02-28 20:44:24 +01:00
Mattias Engdegård
462d8ba813 Add a proper type for obarrays
The new opaque type replaces the previous use of vectors for obarrays.
`obarray-make` now returns objects of this type.  Functions that take
obarrays continue to accept vectors for compatibility, now just using
their first slot to store an actual obarray object.

obarray-size and obarray-default-size now obsolete.

* lisp/obarray.el (obarray-default-size, obarray-size):
Declare obsolete.
(obarray-make, obarrayp, obarray-clear): Remove from here.
* src/fns.c (reduce_emacs_uint_to_hash_hash): Remove from here.
* src/lisp.h (struct Lisp_Obarray, OBARRAYP, XOBARRAY, CHECK_OBARRAY)
(make_lisp_obarray, obarray_size, check_obarray)
(obarray_iter_t, make_obarray_iter, obarray_iter_at_end)
(obarray_iter_step, obarray_iter_symbol, DOOBARRAY, knuth_hash): New.
(reduce_emacs_uint_to_hash_hash): Moved here.
* src/lread.c (check_obarray): Renamed and reworked as...
(checked_obarray_slow): ...this.
(intern_sym, Funintern, oblookup, map_obarray)
(Finternal__obarray_buckets): Adapt to new type.
(obarray_index, allocate_obarray, make_obarray, grow_obarray)
(obarray_default_bits, Fobarray_make, Fobarrayp, Fobarray_clear): New.
* etc/emacs_lldb.py (Lisp_Object):
* lisp/emacs-lisp/cl-macs.el (`(,type . ,pred)):
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types):
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers):
* lisp/emacs-lisp/comp.el (comp-known-predicates):
* src/alloc.c (cleanup_vector, process_mark_stack):
* src/data.c (Ftype_of, syms_of_data):
* src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
* src/pdumper.c (dump_obarray_buckets, dump_obarray, dump_vectorlike):
* src/print.c (print_vectorlike_unreadable):
* test/lisp/abbrev-tests.el (abbrev-make-abbrev-table-test):
* test/lisp/obarray-tests.el (obarrayp-test)
(obarrayp-unchecked-content-test, obarray-make-default-test)
(obarray-make-with-size-test):
Adapt to new type.
2024-02-23 13:02:27 +01:00
Andrea Corallo
44d5c667d7 * lisp/emacs-lisp/comp.el (comp--compute-function-types): Fix missing doc. 2024-02-21 17:52:52 +01:00
Andrea Corallo
88abbf00af ; Add two comments on comp-known-predicates cl-deftype-satisfies
* lisp/emacs-lisp/comp.el (comp-known-predicates): Add comment.
* lisp/emacs-lisp/cl-macs.el: Likewise.
2024-02-21 17:42:58 +01:00
Andrea Corallo
c65a59a9e9 * Add few missing entries in 'comp-known-predicates'
* lisp/emacs-lisp/comp.el (comp-known-predicates): Add framep, markerp,
number-or-marker-p, overlayp, processp, subrp and windowp and sort it
alphabetically.
2024-02-21 17:42:58 +01:00
Andrea Corallo
1e1d3f3acd ; * lisp/emacs-lisp/comp.el (native-comp-debug): Fix spacing. 2024-02-21 17:42:58 +01:00
Andrea Corallo
7215c63fc0 * Make 'comp--compute-function-types' a pass
* lisp/emacs-lisp/comp.el (comp-passes): Add comp--compute-function-types.
(comp--compute-function-types): New function.
(comp--compute-function-type): Move it.
(comp--final): Update it.
2024-02-21 17:42:58 +01:00
Andrea Corallo
4dbc3bbcc5 ; * lisp/emacs-lisp/comp.el (comp--write-bytecode-file): Add comment. 2024-02-15 19:20:03 +01:00
Andrea Corallo
faa46eb866 Rename a number of native compiler functions
* lisp/emacs-lisp/comp.el (comp-passes): Update.
(comp-mvar): Update constructor name.
(comp--loop-insn-in-block, comp--lex-byte-func-p)
(comp--spill-decl-spec, comp--spill-speed)
(comp--decrypt-arg-list, comp--byte-frame-size)
(comp--add-func-to-ctxt, comp--spill-lap-function)
(comp--intern-func-in-ctxt, comp--spill-lap-function)
(comp--spill-lap, comp--lap-eob-p, comp--lap-fall-through-p)
(comp--sp, comp--with-sp, comp--slot-n, comp--slot, comp-slot+1)
(comp--label-to-addr, comp--mark-curr-bb-closed)
(comp--bb-maybe-add, comp--call, comp--callref, make-comp-mvar)
(comp--new-frame, comp--emit, comp--emit-set-call)
(comp--copy-slot, comp--emit-annotation, comp--emit-setimm)
(comp--make-curr-block, comp--latch-make-fill)
(comp--emit-uncond-jump, comp--emit-cond-jump)
(comp--emit-handler, comp--limplify-listn, comp--new-block-sym)
(comp--fill-label-h, comp--jump-table-optimizable)
(comp--emit-switch, comp--emit-set-call-subr, comp--op-to-fun)
(comp--body-eff, comp--op-case, comp--limplify-lap-inst)
(comp--emit-narg-prologue, comp--limplify-finalize-function)
(comp--prepare-args-for-top-level, comp--emit-for-top-level)
(comp--emit-lambda-for-top-level, comp--limplify-top-level)
(comp--addr-to-bb-name, comp--limplify-block)
(comp--limplify-function, comp--limplify, comp--mvar-used-p)
(comp--collect-mvars, comp--collect-rhs)
(comp--negate-arithm-cmp-fun, comp--reverse-arithm-fun)
(comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-new-block-between, comp--cond-cstrs-target-mvar)
(comp--add-cond-cstrs-target-block, comp--add-cond-cstrs-simple)
(comp--add-cond-cstrs, comp--insert-insn, comp--emit-call-cstr)
(comp--lambda-list-gen, comp--add-call-cstr, comp--add-cstrs)
(comp--collect-calls, comp--pure-infer-func, comp--ipa-pure)
(make--comp--ssa-mvar, comp--clean-ssa, comp--compute-edges)
(comp--collect-rev-post-order, comp--compute-dominator-tree)
(comp--compute-dominator-frontiers, comp--log-block-info)
(comp--place-phis, comp--dom-tree-walker, comp--ssa)
(comp--ssa-rename-insn, comp--ssa-rename, comp--finalize-phis)
(comp--remove-unreachable-blocks, comp--ssa)
(comp--fwprop-max-insns-scan, comp--copy-insn)
(comp--apply-in-env, comp--fwprop-prologue)
(comp--function-foldable-p, comp--function-call-maybe-fold)
(comp--fwprop-call, comp--fwprop-insn, comp--fwprop*)
(comp--rewrite-non-locals, comp--fwprop, comp--func-in-unit)
(comp--call-optim-form-call, comp--call-optim-func)
(comp--call-optim, comp--collect-mvar-ids)
(comp--dead-assignments-func, comp--dead-code)
(comp--form-tco-call-seq, comp--tco-func, comp--tco)
(comp--remove-type-hints-func, comp--remove-type-hints)
(comp--args-to-lambda-list, comp--compute-function-type)
(comp--finalize-container, comp--finalize-relocs)
(comp--compile-ctxt-to-file, comp--final1, comp--final)
(comp--make-lambda-list-from-subr, comp-trampoline-compile)
(comp--write-bytecode-file): Rename and/or update due to renaming.
* test/src/comp-resources/comp-test-funcs.el (comp-test-copy-insn-f): Update.
* src/comp.c (Fcomp__compile_ctxt_to_file0): Rename.
(syms_of_comp): Update.
2024-02-11 15:26:12 +01:00
Stefan Monnier
b2d350cfc0 * lisp/emacs-lisp/comp.el (comp--native-compile): Use error-message-string 2024-02-04 14:39:02 -05:00
Paul Eggert
17771b2a42 ; Spelling fixes 2024-01-30 17:23:25 -08:00
Mattias Engdegård
d2c3a98314 Hash-table documentation updates (bug#68244)
* doc/lispref/hash.texi (Creating Hash, Other Hash):
Manual updates for make-hash-table, hash-table-rehash-size and
hash-table-rehash-threshold.
* doc/lispref/objects.texi (Hash Table Type): Update example.
* src/fns.c (Fhash_table_rehash_size, Fhash_table_rehash_threshold):
Update doc strings.
* etc/NEWS: Announce changes.
2024-01-13 20:52:08 +01:00
Po Lu
ecf08f0621 Merge from savannah/emacs-29
dc4e6b1329 ; Update copyright years in more files
64b3777631 ; Run set-copyright from admin.el
8e1c56ae46 ; Add 2024 to copyright years

# Conflicts:
#	doc/misc/modus-themes.org
#	doc/misc/texinfo.tex
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	etc/themes/modus-operandi-theme.el
#	etc/themes/modus-themes.el
#	etc/themes/modus-vivendi-theme.el
#	lib/alloca.in.h
#	lib/binary-io.h
#	lib/c-ctype.h
#	lib/c-strcasecmp.c
#	lib/c-strncasecmp.c
#	lib/careadlinkat.c
#	lib/cloexec.c
#	lib/close-stream.c
#	lib/diffseq.h
#	lib/dup2.c
#	lib/filemode.h
#	lib/fpending.c
#	lib/fpending.h
#	lib/fsusage.c
#	lib/getgroups.c
#	lib/getloadavg.c
#	lib/gettext.h
#	lib/gettime.c
#	lib/gettimeofday.c
#	lib/group-member.c
#	lib/malloc.c
#	lib/md5-stream.c
#	lib/md5.c
#	lib/md5.h
#	lib/memmem.c
#	lib/memrchr.c
#	lib/nanosleep.c
#	lib/save-cwd.h
#	lib/sha1.c
#	lib/sig2str.c
#	lib/stdlib.in.h
#	lib/strtoimax.c
#	lib/strtol.c
#	lib/strtoll.c
#	lib/time_r.c
#	lib/xalloc-oversized.h
#	lisp/auth-source-pass.el
#	lisp/emacs-lisp/lisp-mnt.el
#	lisp/emacs-lisp/timer.el
#	lisp/info-look.el
#	lisp/jit-lock.el
#	lisp/loadhist.el
#	lisp/mail/rmail.el
#	lisp/net/ntlm.el
#	lisp/net/webjump.el
#	lisp/progmodes/asm-mode.el
#	lisp/progmodes/project.el
#	lisp/progmodes/sh-script.el
#	lisp/textmodes/flyspell.el
#	lisp/textmodes/reftex-toc.el
#	lisp/textmodes/reftex.el
#	lisp/textmodes/tex-mode.el
#	lisp/url/url-gw.el
#	m4/alloca.m4
#	m4/clock_time.m4
#	m4/d-type.m4
#	m4/dirent_h.m4
#	m4/dup2.m4
#	m4/euidaccess.m4
#	m4/fchmodat.m4
#	m4/filemode.m4
#	m4/fsusage.m4
#	m4/getgroups.m4
#	m4/getloadavg.m4
#	m4/getrandom.m4
#	m4/gettime.m4
#	m4/gettimeofday.m4
#	m4/gnulib-common.m4
#	m4/group-member.m4
#	m4/inttypes.m4
#	m4/malloc.m4
#	m4/manywarnings.m4
#	m4/mempcpy.m4
#	m4/memrchr.m4
#	m4/mkostemp.m4
#	m4/mktime.m4
#	m4/nproc.m4
#	m4/nstrftime.m4
#	m4/pathmax.m4
#	m4/pipe2.m4
#	m4/pselect.m4
#	m4/pthread_sigmask.m4
#	m4/readlink.m4
#	m4/realloc.m4
#	m4/sig2str.m4
#	m4/ssize_t.m4
#	m4/stat-time.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/stdio_h.m4
#	m4/stdlib_h.m4
#	m4/stpcpy.m4
#	m4/strnlen.m4
#	m4/strtoimax.m4
#	m4/strtoll.m4
#	m4/time_h.m4
#	m4/timegm.m4
#	m4/timer_time.m4
#	m4/timespec.m4
#	m4/unistd_h.m4
#	m4/warnings.m4
#	nt/configure.bat
#	nt/preprep.c
#	test/lisp/register-tests.el
2024-01-02 10:28:14 +08:00
Po Lu
8e1c56ae46 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
Aaron Jensen
6e2e34a5ca Avoid race condition in parallel native-compilation
* lisp/emacs-lisp/comp.el (comp-delete-or-replace-file): Avoid
race condition by relying on 'rename-file' being an atomic
operation on Posix filesystems.  (Bug#68083)
2024-01-01 22:10:27 +02:00
Eli Zaretskii
486094126b Merge from origin/emacs-29
0f361cc985 ; Minor copyedits in description of ':box' face property
46fe7a17f5 Fix dragging mode line on text terminals with a mouse (bu...
12daf386f3 ; * doc/lispref/processes.texi (Network): Fix wording and...
037d858dc1 (rust-ts-mode): Set electric-indent-chars
dc9b733ab8 js-ts-mode: Highlight function parameters inside destruct...
4a72f13bdf js-ts-mode: Highlight property shorthands in assignments
83ed9018ed (js--treesit-font-lock-settings): Highlight parameters in...
ad0f87bb4c (js--treesit-font-lock-settings): Remove some duplicates
71c5f3694f ; Another fix of doc string of 'message-mail-user-agent' ...
04a39353ba ; * lisp/gnus/message.el (message-mail-user-agent): Doc f...
82ddcf37ec ; * doc/lispref/files.texi (Changing Files): Fix last cha...
89068516b3 Don't claim to signal an error when deleting a nonexistin...
4fd254e183 * lisp/indent.el (indent-rigidly): Improve prompt (bug#67...
5f923ff1a6 ; Fix typos
a1f88963f5 rust-ts-mode--comment-docstring: Handle block doc comments
a547b0e2e8 rust-ts-mode--comment-docstring: Fix/improve the previous...
2023-12-09 07:25:21 -05:00
Jens Schmidt
e670412a3e Update handling of advices during preload
* lisp/emacs-lisp/comp-common.el
(native-comp-never-optimize-functions): Remove macroexpand and
rename-buffer from default value.
* lisp/emacs-lisp/comp.el (comp-call-optim-form-call): Document call
optimization for advised primitives.
* lisp/emacs-lisp/nadvice.el (advice-add): Remove references to TODOs
that were completed already earlier.
* lisp/loadup.el: Disallow advices during preload.  (Bug#67005)
2023-12-04 21:43:31 +01:00
Andrea Corallo
f5e4524708 comp: Fix mvar dependency chain (bug#67239)
* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs): Emit assume with
the original mvar as explicit rhs.
(comp-fwprop-insn): Add note.
* test/src/comp-tests.el (67239-1): Add new test.
* test/src/comp-resources/comp-test-funcs.el (comp-test-time)
(comp-test-67239-00-f, comp-test-67239-0-f, comp-test-67239-1-f):
Define.
2023-12-04 20:57:52 +01:00
Andrea Corallo
365114d3bd * lisp/emacs-lisp/comp.el (comp--native-compile): Better log. 2023-12-04 20:11:24 +01:00
Andrea Corallo
c8636b4635 comp: Rename some functions
* lisp/emacs-lisp/comp.el (comp--known-predicate-p)
(comp--pred-to-cstr, comp-edge, comp--edge-make)
(comp--block-preds, comp--gen-counter, comp-func)
(comp--equality-fun-p, comp--arithm-cmp-fun-p, comp--set-op-p)
(comp--assign-op-p, comp--call-op-p, comp--branch-op-p)
(comp--limple-insn-call-p, comp--type-hint-p)
(comp--func-unique-in-cu-p, comp--symbol-func-to-fun)
(comp--function-pure-p, comp--alloc-class-to-container)
(comp--add-const-to-relocs, comp--prettyformat-insn)
(comp--log-func, comp--log-edges, comp-emit-setimm)
(comp-emit-lambda-for-top-level, comp-add-cond-cstrs)
(comp-collect-calls, comp-compute-dominator-tree)
(comp-function-foldable-p, comp-function-call-maybe-fold)
(comp-func-in-unit, comp-call-optim-form-call)
(comp-dead-assignments-func, comp-tco)
(comp-remove-type-hints-func, comp-remove-type-hints)
(comp-compute-function-type, comp-finalize-relocs)
(comp-compile-ctxt-to-file): Rename and update.
2023-12-04 20:11:24 +01:00
Stefan Kangas
5f923ff1a6 ; Fix typos 2023-12-03 23:31:30 +01:00
Andrea Corallo
9c9b87639f Clean-up warnings for non native builds (this time for real)
* lisp/emacs-lisp/comp.el (comp-native-version-dir)
(comp-subr-arities-h, native-comp-eln-load-path)
(native-comp-enable-subr-trampolines): Remove warning.
(comp--compile-ctxt-to-file, comp--init-ctxt, comp--release-ctxt)
(comp-el-to-eln-filename)
(comp-el-to-eln-rel-filename, native-elisp-load): Declare.
* lisp/emacs-lisp/comp-run.el (comp--no-native-compile)
(comp-deferred-pending-h, comp-installed-trampolines-h)
(native-comp-enable-subr-trampolines): Remove warning.
(comp--install-trampoline, comp-el-to-eln-filename)
(native-elisp-load): Declare.
* lisp/emacs-lisp/comp-common.el: Update.
2023-11-09 19:27:34 +01:00
Andrea Corallo
13a1797d5b Clean-up warnings for non native builds
* lisp/emacs-lisp/comp-common.el (native-comp-enable-subr-trampolines)
(comp-installed-trampolines-h, comp-subr-arities-h)
(native-comp-eln-load-path, comp-native-version-dir)
(comp-deferred-pending-h, comp--no-native-compile): Silence
warning.
(comp-el-to-eln-rel-filename, native-elisp-load)
(comp--release-ctxt, comp--init-ctxt)
(comp--compile-ctxt-to-file, comp-el-to-eln-filename)
(comp--install-trampoline): Declare function.
* lisp/emacs-lisp/comp.el : Update.
2023-11-09 17:08:09 +01:00
Andrea Corallo
5d171d26c0 comp: Don't load.el comp when C-h f
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers)
(comp-function-type-spec): Move here.
2023-11-09 12:34:26 +01:00
Andrea Corallo
c559f4e368 comp: Add comp-common.el
* lisp/emacs-lisp/comp-common.el: New file.
(comp-common): New group.
(native-comp-verbose, native-comp-never-optimize-functions)
(native-comp-async-env-modifier-form, comp-limple-calls)
(comp-limple-sets, comp-limple-assignments)
(comp-limple-branches, comp-limple-ops)
(comp-limple-lock-keywords, comp-log-buffer-name, comp-log)
(native-comp-limple-mode, comp-log-to-buffer)
(comp-ensure-native-compiler, comp-trampoline-filename)
(comp-eln-load-path-eff): Move here
* lisp/emacs-lisp/comp-run.el (comp-common): Require.
* lisp/emacs-lisp/comp.el (comp-common): Require.
* admin/MAINTAINERS: Add comp-common.el
* lisp/Makefile.in (COMPILE_FIRST): Likewise.
* src/Makefile.in (elnlisp): Likewise.
2023-11-09 12:34:26 +01:00
Andrea Corallo
b2416d2c02 Don't load comp when installing an existing trampoline
* lisp/emacs-lisp/nadvice.el (advice--add-function): Update.
	(comp-subr-trampoline-install): Update src file.
	* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Autoload.
	* lisp/emacs-lisp/comp-run.el (comp-log-buffer-name)
	(native--compile-async, comp-warn-primitives)
	(comp-trampoline-filename, comp-eln-load-path-eff)
	(comp-trampoline-search, comp-trampoline-compile): Move here.
	* lisp/emacs-lisp/advice.el (comp-subr-trampoline-install): Update
	src file.
2023-11-09 12:34:26 +01:00
Andrea Corallo
e6a955d242 comp: split code in comp-run.el
* lisp/emacs-lisp/comp-run.el : New file.
(comp-run)
(native-comp-jit-compilation-deny-list)
(native-comp-async-jobs-number)
(native-comp-async-report-warnings-errors)
(native-comp-always-compile)
(native-comp-async-cu-done-functions)
(native-comp-async-all-done-hook)
(native-comp-async-env-modifier-form)
(native-comp-async-query-on-exit, native-comp-verbose)
(comp-log-buffer-name, comp-async-buffer-name, comp-no-spawn)
(comp-async-compilations, native-comp-limple-mode)
(comp-ensure-native-compiler, native-compile-async-skip-p)
(comp-files-queue, comp-async-compilations, comp-async-runnings)
(comp-num-cpus, comp-effective-async-max-jobs)
(comp-last-scanned-async-output)
(comp-accept-and-process-async-output, comp-valid-source-re)
(comp-run-async-workers, native--compile-async)
(native-compile-async): Move these definitions here.
* lisp/Makefile.in (COMPILE_FIRST): Update.
* src/Makefile.in (elnlisp): Likewise.
* admin/MAINTAINERS: Likewise.
2023-11-09 11:06:06 +01:00
Alan Mackenzie
06e4ebc81a With `native-compile', compile lambdas in a defun or lambda too
This fixes bug#64646.  Also refactor two functions to reduce
code duplication.

* lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol)
(comp-spill-lap-function/list): Add all functions found by the
byte compiler (including lambdas) to the native compiler's
context, thus making them be native compiled.  Refactor to use
comp-intern-func-in-ctxt.  Make comp-spill-lap-function/list
also compile closures.

* test/src/comp-resources/comp-test-funcs.el
(comp-tests-lambda-return-f2): New function

* test/src/comp-tests.el (comp-test-lambda-return2)
(comp-tests-free-fun-f2): New functions to test that internal
lambdas get native compiled.
2023-11-08 20:49:48 +00:00
Stefan Monnier
5f371ca07b * lisp/emacs-lisp/comp.el: Remove redundant requires 2023-10-31 12:24:51 -04:00
Stefan Monnier
bdec2d2d46 comp-cstr.el: The type hierarchy is a DAG, not a tree
Adjust the type operations to account for the fact that types can have
several parents.

* lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy):
Use `cl--class-allparents`.  Add FIXME.
(comp--direct-supertype): Declare obsolete.
(comp--direct-supertypes): New function.
(comp--normalize-typeset0): Rewrite to use `comp--direct-supertypes`;
adjust to account for the DAG structure; use `cl-set-difference`.
(comp--direct-subtypes): Rewrite.
(comp--intersection): New function.
(comp-supertypes): Rewrite and change return type.
(comp-subtype-p): Simplify.
(comp-union-typesets): Use `comp-supertypes` instead of iterating over
`comp-cstr-ctxt-typeof-types`.
* lisp/emacs-lisp/comp.el (comp--native-compile): Don't catch
errors if we're debugging.
* test/lisp/emacs-lisp/comp-cstr-tests.el: Adjust tests.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix mishap when we
evaluate (cl-defstruct cl-structure-object ..) during the compilation
of `cl-preloaded.el`.
* lisp/emacs-lisp/cl-preloaded.el: Add corresponding assertion.
2023-10-30 00:59:19 -04:00
Andrea Corallo
ea12230039 * lisp/emacs-lisp/comp.el (comp-compute-dominator-tree): Simplify. 2023-09-20 12:09:15 +02:00
Andrea Corallo
ea5ae08b06 * lisp/emacs-lisp/comp.el (comp-final1): Clean-up unused form. 2023-09-19 11:46:19 +02:00
Andrea Corallo
438d71e83b * lisp/emacs-lisp/comp.el (comp-op-to-fun): Use `string-replace'. 2023-09-19 11:46:19 +02:00
Andrea Corallo
991bf3f0f5 * Fix comp-function-type-spec for non symbol input (bug#66021)
* lisp/emacs-lisp/comp.el (comp-function-type-spec): Make it robust
against closures (bug#66021).
2023-09-18 10:15:38 +02:00
Eli Zaretskii
ec3ea8c036 Merge from origin/emacs-29
648a5e33e8 Update to Org 9.6.8-3-g21171d
458442fe78 Escape percent character in treesit--inspect-name (bug#65...
bc0426ce8e Don't add an extraneous slash in remote PATH list in Eshell
34f7a47c9c Fix Tramp on MS Windows
ea5fd6c96b * Fix native disassemble on Windows platforms (bug#65455)
91d2d8439b * Handle missing eln file when trying to disassble (bug#6...
e7ac50a153 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUT...
45cf3a0ced Update to Transient v0.4.3
31d3808fb9 Adapt Eshell manual
0c50af054f Fix applying patches with Git on MS-Windows

# Conflicts:
#	doc/misc/transient.texi
#	test/lisp/eshell/esh-util-tests.el
2023-09-02 04:28:17 -04:00
Andrea Corallo
e7ac50a153 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUTPUT for non abs paths 2023-08-27 16:41:35 +02:00
Eli Zaretskii
dfe68f2a42 ; Fix byte-compiler warnings in comp.el
* lisp/emacs-lisp/comp.el: Declare functions and variables defined
in comp.c, to avoid byte-compiler warnings.  (Bug#65250)
2023-08-16 16:10:55 +03:00
Eli Zaretskii
3fc9793a26 Merge from origin/emacs-29
842dbf500e * Fix `batch-byte+native-compile' target directory.
8dbd5aa1ee Avoid crashes in 'display_count_lines' when current buffe...
47b4f4cf78 ; * doc/emacs/mini.texi (Completion Commands): Fix a typo...
78999d5213 Update csharp tree-sitter support due to upstream changes
556cb01b48 Substitute command keys in 'ielm-header' at use time
99367078e5 ; * etc/PROBLEMS: Add entry about XIM problems (bug#65205).
03e897c08f Fix rare crashes in redisplay due to problems with fontsets
b1ba06a1e4 Fix a typo in 'leuven-dark-theme.el'
e80a9dcabb ; * admin/git-bisect-start: Update failing commits
9091f42784 ; * admin/git-bisect-start: Update failing commits
344ac529ca ; * etc/PROBLEMS: Fix typo.
bccf848b26 Adapt Tramp test
71bc060e40 Properly expand the JSX indentation rules in 'js-ts-mode'
889cfb42ed * Add `emacs-lisp-native-compile' to easy-menu.
4535aafa8a * lisp/progmodes/elisp-mode.el (emacs-lisp-mode-menu): Si...
173af0cad5 * Introduce `emacs-lisp-native-compile'.
063d7d89d7 Fix the -x switch in non-X builds
5a7fb0b39b Document that `set-mouse-color' does not work everywhere
d06fc72496 ; * doc/emacs/dired.texi (Misc Dired Features): Fix last ...
97b8ac376b Fix the effects and documentation of 'dired-free-space'
75c72e59f6 ; Fix typo
6d11b7b300 Fix cross-reference to eldoc in eglot manual
913e50aba6 Add native-compilation to Emacs Lisp mode menu
b93107c20b Fix emacs-lisp-native-compile-and-load eln target directo...
2023-08-12 13:50:38 -04:00
Andrea Corallo
842dbf500e * Fix `batch-byte+native-compile' target directory.
* lisp/emacs-lisp/comp.el (batch-native-compile): Don't shadow
`native-compile-target-directory' unless necessary.
2023-08-12 18:51:45 +02:00
Andrea Corallo
b93107c20b Fix emacs-lisp-native-compile-and-load eln target directory (bug#64226)
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Don't use
`byte+native-compile' to select output directory but always axpect
it explicit through `native-compile-target-directory'.
(batch-byte+native-compile): Set `native-compile-target-directory'.
* test/src/comp-tests.el (comp-tests-bootstrap): Set
`native-compile-target-directory'.
2023-08-09 15:19:26 +02:00
Alan Mackenzie
f9f9c95ab5 Fix native compilation in dynamically bound files.
This fixes bug#64642.

* lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol): Add
code for dynamically bound functions.

* test/src/comp-tests.el (comp-tests-result-lambda): New test.

* test/src/comp-resources/comp-test-funcs-dyn2.el: New test
file.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
#	modified:   lisp/emacs-lisp/comp.el
#	new file:   test/src/comp-resources/comp-test-funcs-dyn2.el
#	modified:   test/src/comp-tests.el
#
# Changes not staged for commit:
#	modified:   .gitignore
#
# Untracked files:
#	.gitignore.acm
#	.gitignore.backup
#	.timestamps.txt
#	2021-01-03.err
#	2021-01-06.err
#	2021-12-16.make
#	2021-12-30.err
#	2021-12-31.err
#	2022-01-01.err
#	2022-01-02.check.err
#	2022-01-02.err
#	2022-01-04.err
#	2022-01-05.err
#	2022-01-06.err
#	2022-01-07.err
#	2022-01-07.outerr
#	2022-01-08.err
#	2022-01-09.err
#	2022-01-09b.err
#	2022-01-10.err
#	2022-01-11
#	2022-01-11.err
#	2022-02-22.err
#	2022-02-22.outerr
#	checkout.20220228.out
#	checkout.20220301.out
#	checkout.20220302.out
#	doc/lispref/syntax.20160318.techsi
#	doc/lispref/syntax.20160318b.techsi
#	lib/.deps/
#	lisp/2022-01-09.err
#	lisp/emacs-lisp/comp.el.rej
#	src/2021-12-20.err
#	src/globals.20211124.aitch
#	src/lisp.20211127.aitch
#	test/lisp/calendar/icalendar-tests.elcr5m9Wq
#
2023-07-19 11:26:11 +00:00
Eli Zaretskii
4e8d579f3d Use 'emacs-lisp-compilation-mode' in native compilation buffers
Re-install this commit 40492581f9, now that source of
the recursive-load has been fixed (bug#64494).

* lisp/emacs-lisp/comp.el (comp-log-to-buffer)
(comp-run-async-workers): Use 'emacs-lisp-compilation-mode' in the
buffers where we log the results of native compilation.  Suggested
by No Wayman <iarchivedmywholelife@gmail.com>.  (Bug#64452)
2023-07-13 21:24:24 -04:00
Stefan Monnier
fcade74066 src/comp.c: Use pending_funcalls to fix bug#64494
Make sure `comp.el` is never loaded synchronously by simply
delaying all calls to `native--compile-async` via `pending_funcalls`.

* lisp/startup.el (comp--compilable, comp--delayed-sources): Don't declare.
(startup--require-comp-safely)
(startup--honor-delayed-native-compilations): Delete functions.
(normal-top-level): Don't call `startup--honor-delayed-native-compilations`.

* src/comp.c (maybe_defer_native_compilation): Use `pending_funcalls`.
(syms_of_comp): Delete `Vcomp__delayed_sources` and `comp__compilable`.
Define `Qnative__compile_async`.
2023-07-13 20:13:32 -04:00
Eli Zaretskii
65c90040eb Revert "Use 'emacs-lisp-compilation-mode' in native compilation buffers"
This reverts commit 40492581f9.
It caused a recursive-load error when native-compiling files.
(Bug#64391)
2023-07-06 18:00:05 +03:00