Commit graph

670 commits

Author SHA1 Message Date
Andrea Corallo
1ec7499e59 * Add a warning for missing write privilege
* lisp/emacs-lisp/comp.el (native-compile-async): Check for write
	privilege and raise a warning in case.
2020-05-03 13:37:38 +01:00
Andrea Corallo
8d37220190 * Introduce `comp-output-directory'
* lisp/emacs-lisp/comp.el (comp-output-directory): New function.
	(comp-output-base-filename): Use `comp-output-directory'.
2020-05-03 14:35:50 +01:00
Andrea Corallo
02e3ffad6d * Fix async compilation non respecting `comp-always-compile' nil value.
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Fix missing
	`comp-output-filename' usage.
2020-04-29 21:25:02 +01:00
Andrea Corallo
f8b254d195 Rework spill LAP mechanism in preparation of compiling lambdas.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): No need anymore
	to have `byte-native-compiling' bound to free-func.
	(comp-spill-lap-function): Make use of `byte-to-native-lap-h' and
	clean-up.
	(comp-spill-lap-function): Likewise.

	* lisp/emacs-lisp/bytecomp.el (byte-to-native-function): Add lap slot.
	(byte-to-native-lap): Rename into byte-to-native-lap-h.
	(byte-compile-lapcode): Spill lap after having int assembled and
	store it into `byte-to-native-lap-h'.
	(byte-compile-not-top-level): Remove.
	(byte-compile-file-form-defmumble): Fill directly lap slot.
	(byte-compile-lambda): Remove `byte-compile-not-top-level'.
	(byte-compile-out-toplevel): Restore original code.
	(byte-compile-form): Remove `byte-compile-not-top-level'.
	(byte-compile-function-form): Likewise.
	(byte-compile-flush-pending): No need anymore to set
	`byte-compile-current-form' so restore orignal code.
2020-04-26 22:17:37 +01:00
Andrea Corallo
bb4cf13c47 Convert before final function doc hash into a vector.
* lisp/emacs-lisp/comp.el (comp-finalize-relocs): Convert doc hash
	table into vector befor final.
	(comp-emit-for-top-level): Rename `comp-ctxt-doc-index-h' ->
	`comp-ctxt-function-docs'.
	(comp-ctxt): Likewise.

	* src/comp.c (native_function_doc): Update logic for documentation
	being a vector.
	(emit_ctxt_code): Update for 'comp-ctxt-doc-index-h' slot rename.

	* src/comp.h (struct Lisp_Native_Comp_Unit): Rename 'data_fdoc_h'
	into data_fdoc_v.

	* src/pdumper.c (dump_native_comp_unit): Likewise.
2020-04-26 10:10:17 +01:00
Andrea Corallo
d73e64076e Store function documentations in a hash table.
* src/pdumper.c (dump_subr): Update Lisp_Subr hash.
	(dump_subr): Update for new compilation unit layout.
	(dump_vectorlike): Update pvec_type hash.

	* src/lisp.h (struct Lisp_Subr): Remove 'native_doc' index.
	(DEFUN): Update macro for new compilation unit
	layout.

	* src/doc.c (Fdocumentation): Update for new compilation unit
	layout.

	* src/comp.h (struct Lisp_Native_Comp_Unit):
	Add 'data_fdoc_h' field.

	* src/comp.c (TEXT_FDOC_SYM): New macro.
	(emit_ctxt_code): Emit function documentations.
	(load_comp_unit): Load function documentation.
	(Fcomp__register_subr): Rename parameter.
	(Fcomp__register_subr): Update for new compilation unit
	layout.

	* src/alloc.c (mark_object): Update for new compilation unit
	layout.
	(syms_of_alloc): Likewise.

	* lisp/emacs-lisp/comp.el (comp-ctxt): Add doc-index-h slot.
	(comp-emit-for-top-level): Emit doc index as 'comp--register-subr'
	doc parameter.
2020-04-25 19:55:39 +01:00
Andrea Corallo
9c4c0af89d * lisp/emacs-lisp/comp.el (comp-run-async-workers): Use `clrhash'. 2020-04-25 19:55:40 +01:00
Andrea Corallo
bab36619fb Fix deferred-compilation for double compilation (bug#40838).
* lisp/emacs-lisp/comp.el (native-compile-async): Prevent double
	compilation (bug#40838).
2020-04-25 15:12:37 +01:00
Andrea Corallo
e208de9d25 Store ongoing compilations processes as hash table.
* lisp/emacs-lisp/comp.el (comp-async-processes): Rename as
	`comp-async-compilations'.
	(comp-async-runnings): Make use as `comp-async-compilations'.
	(comp-run-async-workers): Likewise.
2020-04-25 15:12:37 +01:00
Andrea Corallo
b380451c6a * lisp/emacs-lisp/comp.el (comp-run-async-workers): Fix non late load. 2020-04-24 19:02:55 +01:00
Andrea Corallo
65cc8efa33 * lisp/emacs-lisp/comp.el (comp-never-optimize-functions): Better doc fix 2020-04-16 19:06:08 +01:00
Andrea Corallo
886ded1b70 * lisp/emacs-lisp/comp.el (comp-never-optimize-functions): Add yes-or-no-p 2020-04-16 18:59:40 +01:00
Andrea Corallo
8decfbe4d7 * lisp/emacs-lisp/comp.el (native-compile-async): Better error message. 2020-04-14 08:48:24 +01:00
Andrea Corallo
b7678cf10e * lisp/emacs-lisp/comp.el (comp-finalize-relocs): Better commentary. 2020-04-13 20:44:09 +01:00
Andrea Corallo
9f42f35418 * Fix native-compile-async for bug#40602.
* lisp/emacs-lisp/comp.el (native-compile-async): Relax coherency condition.
2020-04-13 20:44:09 +01:00
Andrea Corallo
32a079aef2 * lisp/emacs-lisp/comp.el (comp-c-func-name): Fix for M-x disassemble 2020-04-06 20:03:34 +01:00
Andrea Corallo
37a9d1e42b * lisp/emacs-lisp/comp.el (native-compile): Better documentation. 2020-04-05 21:10:49 +01:00
Andrea Corallo
530faee275 Fix free function compilation 2020-03-29 12:30:33 +01:00
Andrea Corallo
53f9bc6908 * comp.el (comp-output-base-filename): Handle src being a symbol 2020-03-29 12:30:33 +01:00
Andrea Corallo
d5f6dc131b Prevent collisions in C namespace and function shadowing
This rework make functions being indexed by their unique C symbol name
preventing multiple lisp function with the same name colliding.
2020-03-29 12:30:33 +01:00
Andrea Corallo
4acc4ac667 * comp.el (native-compile-async): Fix excessive messaging 2020-03-24 19:10:20 +00:00
Andrea Corallo
73ced8c23e * comp.el : Fix typo introduced by f8b07ff4f3 2020-03-23 22:27:17 +00:00
Andrea Corallo
f8b07ff4f3 Guard against function redefinition during deferred load 2020-03-23 20:37:59 +00:00
Andrea Corallo
ef30feb554 * comp.el: Add missing require 2020-03-22 15:57:00 +00:00
Andrea Corallo
e05a62a968 Have a fast build option triggered by env var NATIVE_FAST_BOOT 2020-03-22 15:50:58 +00:00
Andrea Corallo
64a6709f64 * comp.el (comp-async-jobs-number): Fix customize type. 2020-03-19 18:37:32 +00:00
Andrea Corallo
b070571f93 * comp.el (comp-run-async-workers): Load only if compilation succeed 2020-03-19 16:49:23 +00:00
Andrea Corallo
7565a4a117 Command late load when deferring compilation 2020-03-19 13:50:25 +00:00
Andrea Corallo
c3e640bfa6 * comp.el: Extend `native-compile-async' for load and late-load 2020-03-19 13:50:25 +00:00
Andrea Corallo
034d9b319c * comp.el: late-load support optional as `native-compile' parameter 2020-03-19 08:38:10 +00:00
Andrea Corallo
f2c437761f * comp.el: Have the compiler generates 'late_top_level_run' 2020-03-19 08:37:40 +00:00
Andrea Corallo
159f61baa9 Trigger native compilation when loading bytecode
Introduce a first mechanism to trigger compilation when lex elc files
are loaded.  This is off by default and has to be better tested.
2020-03-16 23:08:34 +00:00
Andrea Corallo
ea8864fb67 * comp.el: (native-compile-async) do not duplicate queue entries 2020-03-16 22:56:36 +00:00
Andrea Corallo
0b28bf0529 * comp.el: Estimate async worker number using system CPU number
This only when `comp-async-jobs-number' is 0 (default).
2020-03-16 22:56:36 +00:00
Andrea Corallo
92fdfa4b5a * comp.el: Make compilation logic to be dynamically controllable
Introduce `comp-async-jobs-number' to control async job number, this
can be now adjusted dynamically.

Also make `native-compile-async' able to dynamically queue new
compilations.
2020-03-16 22:56:14 +00:00
Andrea Corallo
7359f9e363 * comp.el: Fix missing rx require 2020-03-15 10:27:02 +00:00
Adam Porter
46a4ca4774 comp.el: Minor improvements
Change: (comp-start-async-worker) Refactor slightly

Change: (comp-start-async-worker) Inline (comp-to-file-p)

Change: (comp-source-files) Rename from comp-src-pool

Add: (comp-start-async-worker) Assertion

Change: (comp-async-processes) Rename from comp-prc-pool

Tidy: (native-compile)

Rename variables, improve docstring, adjust log message, simplify
filename code.

Tidy: (batch-native-compile) Docstring

Tidy: whitespace-cleanup

Tidy: (comp-start-async-worker) Use () instead of nil

Tidy: (comp-files-queue) Rename from comp-source-files

Change: (native-compile-async) Improve paths support

Tidy: Comment

Save a line for one word.  :)

Change: (comp-log) Rewrite without macro, follow tail

Change: (native-compile-async) Use end-of-string in filename regexps

Change: (native-compile-async) Use cl-loop instead of dotimes

Add/Change: (comp-log-to-buffer) And use in comp-log

Comment: Tidy comment

Fix: (configure.ac) Option description

Fix: (comp-log) Argument

Fix: (comp-start-async-worker) Variable name

Change: Undo whitespace changes

Some of them included incorrect indentation because the
macros' (declare (indent)) forms were not loaded.  The
whitespace-cleanup should be run from Emacs 27+ with the file loaded.
2020-03-15 10:24:08 +00:00
Andrea Corallo
144e8f64b6 Prefix native compilation folders with "eln-" 2020-03-13 22:21:08 +00:00
Andrea Corallo
ab8fed0a96 * Do not produce .eln files when a byte compilation error happen
Have the byte compiler signal an error when compilation fails to stop
native compilation too.
2020-03-13 08:22:29 +00:00
AndreaCorallo
f21e1dfc9f * Set relocation class as ephemeral in `comp-limplify-top-level' 2020-03-10 10:42:56 +00:00
AndreaCorallo
1f3ba658fc * Do not crash if the output directory is created in the meanwhile 2020-03-03 23:06:46 +00:00
AndreaCorallo
43b6f05dfb Hash eln ABI once and add it to the output compilation path 2020-03-03 22:23:41 +00:00
AndreaCorallo
bf4f620b2f * ; Clean-up out of date comment 2020-03-01 21:10:49 +00:00
AndreaCorallo
2dae7e1b69 Add system-configuration in the compilation output path 2020-02-06 20:23:14 +00:00
Andrea Corallo
0cef208cc3 * Reorganize passes
- Make propagate responsible for keeping SSA up to date.

- Run propagate-alloc as very last before final not to risk bothering
  with mvar array allocation during previous tranformations.

- Fix SSA if TCO modify the CFG.
2020-03-01 19:22:27 +00:00
Andrea Corallo
f60cb02cdf * Allow for multiple SSA runs
Add function ssa-status as `comp-func' slot and have `comp-clean-ssa'
to run when necessary.
2020-03-01 19:22:27 +00:00
AndreaCorallo
b41d76fa5e Remove relocation index form LIMPLE setimm
Given that every object identify a relocation class simplify setimm too.
2020-03-01 19:22:27 +00:00
Andrea Corallo
5543338b0c Optimize relocation classes for object duplication
Merge duplicated  objects during final. Precendece is:
1 d-default
2 d-impure
3 d-ephemeral

Now every object identify uniquely a relocation class.  Because of
this there's no need to keep the reloc class into m-var.
2020-03-01 19:22:27 +00:00
Andrea Corallo
b7f3624924 * Rename comp-emit-set-const -> comp-emit-setimm 2020-03-01 19:22:27 +00:00
AndreaCorallo
86cc9377ce * ; Add a TODO for a future optimization 2020-02-26 12:57:45 +00:00