1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-27 07:30:59 -08:00
Commit graph

126 commits

Author SHA1 Message Date
Andrea Corallo
e96cd4e82c Add initial nativecomp typeset and range propagation support
This commit add an initial support for a better type propagation and
integer range propagation.

Each mvar can be now characterized by a set of types, a set of values
and an integral range.

	* lisp/emacs-lisp/comp.el (comp-known-ret-types): Store into
	typeset and remove fixnum.
	(comp-known-ret-ranges, comp-type-predicates): New variables.
	(comp-ctxt): Remove supertype-memoize slot and add
	union-typesets-mem.
	(comp-mvar): Remove const-vld, constant, type slots. Add typeset,
	valset, range slots.
	(comp-mvar-value-vld-p, comp-mvar-value, comp-mvar-fixnum-p)
	(comp-mvar-symbol-p, comp-mvar-cons-p)
	(comp-mvar-type-hint-match-p, comp-func-ret-typeset)
	(comp-func-ret-range): New functions.
	(make-comp-mvar, make-comp-ssa-mvar): Update logic.
	(comp--typeof-types): New variable.
	(comp-supertypes, comp-common-supertype): Logic update.
	(comp-subtype-p, comp-union-typesets, comp-range-1+)
	(comp-range-1-, comp-range-<, comp-range-union)
	(comp-range-intersection): New functions.
	(comp-fwprop-prologue, comp-mvar-propagate)
	(comp-function-foldable-p, comp-function-call-maybe-fold)
	(comp-fwprop-insn, comp-call-optim-func, comp-finalize-relocs):
	Logic update.

	* src/comp.c (emit_mvar_rval, emit_call_with_type_hint)
	(emit_call2_with_type_hint): Logic update.

	* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Undo the add
	of fixnum and bignum as unnecessary.

	* test/src/comp-tests.el
	(comp-tests-mentioned-p-1, comp-tests-cond-rw-checker-val)
	(comp-tests-cond-rw-checker-type, cond-rw-1, cond-rw-2)
	(cond-rw-3, cond-rw-4, cond-rw-5): Update for new type interface.
	(range-simple-union, range-simple-intersection): New integer range
	tests.
	(union-types): New union type test.
2020-11-12 00:55:36 +01:00
Andrea Corallo
933fd76f8f * test/src/comp-tests.el (compile-forms): Fix missing lexical binding. 2020-11-01 15:17:00 +01:00
Andrea Corallo
e1a168f9a7 * Add some 'cond-rw' pass related tests
* test/src/comp-tests.el (comp-tests-cond-rw-checked-function):
	Declare var.
	(comp-tests-cond-rw-checker-val): New function.
	(comp-tests-cond-rw-checker-type): Declare var.
	(comp-tests-cond-rw-checker-type): New function.
	(comp-tests-cond-rw-0-var): Declare var.
	(comp-tests-cond-rw-0, comp-tests-cond-rw-1, comp-tests-cond-rw-2)
	(comp-tests-cond-rw-3, comp-tests-cond-rw-4)
	(comp-tests-cond-rw-5): New testcases.
2020-11-01 15:17:00 +01:00
Andrea Corallo
047fe3292d * Rework some native compiler test infrastructure
* test/src/comp-tests.el (comp-tests-map-checker): New function
	returning a list holding checker results.
	(comp-tests-tco-checker, comp-tests-fw-prop-checker-1)
	(comp-tests-pure-checker-1, comp-tests-pure-checker-2): Make use
	of `comp-tests-map-checker'.
2020-11-01 14:27:42 +01:00
Andrea Corallo
fd9e9308d2 Make native compiler tollerant to redefined primitives (bug#44221).
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Rework based
	on the fact that the subr can now be redefined.
	* test/src/comp-tests.el (primitive-redefine-compile-44221):
	New testcase.
2020-10-26 16:34:20 +00:00
Andrea Corallo
5edc7aa019 Fix defsubst effectiveness (bug#44209)
* lisp/emacs-lisp/byte-run.el (defsubst): Fix macro definition.
	* test/src/comp-tests.el (comp-test-defsubst): New testcase.
	* test/src/comp-test-funcs.el (comp-test-defsubst-f): New
	function.
2020-10-25 22:56:50 +00:00
Andrea Corallo
3be93390fb Sanitize eln filename when native compiling single functions
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Fix
	temporary eln name generation.

	* test/src/comp-tests.el (free-fun-silly-name): New testcase.
2020-10-20 21:29:05 +01:00
Andrea Corallo
e9c150b5c2 * Add a test to verify form native compilation.
* test/src/comp-tests.el (comp-deftest): Fix typo.
	(compile-forms): New test.
2020-10-14 11:04:36 +02:00
Andrea Corallo
4f0e879030 Rework `native-compile' interface so it can return compiled functions
* lisp/emacs-lisp/comp.el (native-compile): Return the compiled
	function when the input is a symbol or a form.
	* test/src/comp-tests.el (free-fun, tco, fw-prop): Update tests
	for new `native-compile' interface.
2020-10-14 11:04:36 +02:00
Andrea Corallo
f43dbe65ce Add a test for primitive redefinition
* test/src/comp-tests.el (primitive-redefine): New test.
	* test/src/comp-test-funcs.el (comp-test-primitive-redefine-f):
	New function.
2020-10-05 21:32:38 +02:00
Andrea Corallo
f345622152 Clean-up testsuite for vanilla builds
Tag all native compiler tests and skip them in vanilla builds

	* test/Makefile.in (SELECTOR_DEFAULT, SELECTOR_EXPENSIVE)
	(SELECTOR_ALL): Define selectors for vanilla or nativecomp builds.
	* test/src/comp-tests.el: Do not native compile test files on
	vanilla.
	(comp-deftest): New macro to define tests tagging as :nativecomp.
2020-10-02 10:24:32 +02:00
Andrea Corallo
ddf1b1931c * test/src/comp-tests.el (comp-tests-bootstrap): Tag it as expensive. 2020-10-01 18:04:00 +02:00
Andrea Corallo
0cc1804d42 Add a test for primitive advicing effectiveness
* test/src/comp-test-funcs.el (comp-test-primitive-advice-f): New
	function.
	* test/src/comp-tests.el (comp-test-primitive-advice): New test.
2020-09-24 09:57:17 +02:00
Andrea Corallo
5f37c18581 * test/src/comp-tests.el (comp-tests-bootstrap): Print compilation time. 2020-09-14 23:06:42 +02:00
Andrea Corallo
c6f42387e3 Fix describe function arglist for native compiled lisp/d (bug#42572)
* lisp/help.el (help-function-arglist): Handle the case of native
	compiled lisp/d.

	* src/data.c (syms_of_data): Register new subrs.
	(Fsubr_native_dyn_p, Fsubr_native_lambda_list): New primitives.

	* test/src/comp-tests.el (comp-tests-dynamic-help-arglist): New test.
2020-08-31 22:36:58 +02:00
Andrea Corallo
ea35a62e6e * test/src/comp-tests.el (comp-tests-doc): Update test. 2020-08-29 16:08:03 +02:00
Andrea Corallo
114b1d8f90 * test/src/comp-tests.el (comp-tests-bootstrap): Fix test for new eln setup. 2020-08-17 18:04:23 +02:00
Andrea Corallo
2c2cc21f1b Add a testcase for bug#42360
* test/src/comp-tests.el (comp-test-42360): New testcase.

	* test/src/comp-test-funcs.el (comp-test-42360-f): New function.
2020-07-15 23:13:36 +02:00
Andrea Corallo
02bf2e08e2 * Disable ipa-pure in comp-tests-tco
* test/src/comp-tests.el (comp-tests-tco): Disable ipa-pure to
	check effectively for tail recursion elimination.
2020-07-09 16:23:34 +01:00
Andrea Corallo
a53b446cb0 Add some tests for pure function optimization
* test/src/comp-tests.el (comp-tests-fw-prop): Fix docstring.
	(comp-tests-pure-checker-1, comp-tests-pure-checker-2): New
	functions.
	(comp-tests-pure): New test testing for pure function
	optimization.
2020-07-09 16:23:31 +01:00
Andrea Corallo
e6ab4e3dfe * Add a test targeting forward propagation
* test/src/comp-tests.el (comp-tests-fw-prop-checker-1): New
	function.
	(comp-tests-fw-prop): New test.
2020-07-09 16:22:37 +01:00
Andrea Corallo
b31b0ebefe * Rework some test logic for generality
* test/src/comp-tests.el (comp-tests-make-insn-checker): New
	function splitting logic from `comp-tests-tco-checker' to have it
	more general.
	(comp-tests-tco-checker): Make use of
	`comp-tests-make-insn-checker'.
2020-07-08 17:29:24 +01:00
Andrea Corallo
7e004d24a4 * Add a test to verify tail recursion elimination
* test/src/comp-tests.el (comp-tests-tco): Compile a recursive
	functions at speed 3 and verify the tail recursion elimination.
	(comp-tests-tco-checker, comp-tests-mentioned-p)
	(comp-tests-mentioned-p-1): New support functions.
2020-07-02 22:55:42 +02:00
Andrea Corallo
0f964db327 Add a test for lambda list containing uninterned symbols
* test/src/comp-test-funcs-dyn.el
	(comp-tests-cl-uninterned-arg-parse-f): New function.

	* test/src/comp-tests.el (comp-tests-cl-uninterned-arg-parse-f):
	New test.
2020-06-30 21:30:44 +02:00
Andrea Corallo
5b8b298283 Add a test to verify CL macro expansion in dynamic scope
* test/src/comp-tests.el (comp-tests-cl-macro-exp): New test.

	* test/src/comp-test-funcs-dyn.el: Require `cl-lib'.
	(comp-tests-cl-macro-exp-f): New function.
2020-06-28 15:53:08 +01:00
Andrea Corallo
1179a1c748 * Add a func-arity test for dynamic functions
* test/src/comp-tests.el (comp-tests-dynamic-arity): New test.
2020-06-22 00:13:18 +02:00
Andrea Corallo
34117dea77 Add a test for speed -1
* test/src/comp-tests.el (comp-test-speed--1): New test

	* test/src/comp-test-funcs.el (comp-test-speed--1-f): New
	function.
2020-06-22 00:11:40 +02:00
Andrea Corallo
47ab6c237e Add some testing for dynamic scope
* test/src/comp-test-funcs-dyn.el: New file.

	* test/src/comp-tests.el (comp-tests-dynamic-ffuncall): Add
	new tests.
2020-06-22 00:02:57 +02:00
Andrea Corallo
3fa73fa0fb Add a compiler hint test
Test that compiler hints are executed transparently.

* test/src/comp-tests.el (comp-tests-type-hints): New test.

* test/src/comp-test-funcs.el (comp-tests-hint-fixnum-f)
(comp-tests-hint-cons-f): New functions.
2020-05-25 22:24:53 +01:00
Andrea Corallo
e5b24b85a2 * Native compiler test update
* test/src/comp-tests.el (comp-tests-lambda-return): Add a test
	verifying that the returned lambda is actually native compiled.
2020-05-15 20:06:49 +01:00
Andrea Corallo
28df049b8d * test/src/comp-tests.el (comp-tests-bootstrap): Fix test. 2020-05-14 07:14:27 +01:00
Andrea Corallo
c69c185109 Add comp-test-40187 checking function shadowing. 2020-03-29 12:30:33 +01:00
Andrea Corallo
89cbff32e4 * test/src/comp-tests.el (comp-tests-doc): Fix 2020-03-29 12:30:33 +01:00
Andrea Corallo
3130690882 Fix `comp-tests-free-fun'
Address the case were comp-tests.el is byte-compiled.
2020-02-22 10:45:33 +00:00
Andrea Corallo
93f86a2378 Test 'comp-eq' should not assume any string hashing policy 2020-02-21 19:00:59 +00:00
Andrea Corallo
81c34a35aa Update copyright years plus two style nits 2020-02-16 18:34:22 +01:00
AndreaCorallo
0c6f4caeb3 Clean-up old gc disable refuse in comp-tests-non-locals 2020-02-14 23:26:20 +01:00
Andrea Corallo
a0c6ee6fc5 Do no force speed while running the testsuite 2020-01-20 21:59:40 +00:00
Andrea Corallo
e83bc2503b Always force debug 0 for bootstrap test
Debug symbols would make it fail otherwise.
2020-01-20 21:57:11 +00:00
Andrea Corallo
6c9acd13d0 single function native compilation doc + interactive support + tests 2020-01-01 11:38:12 +01:00
Andrea Corallo
b3db331e8c add native interactive support test 2020-01-01 11:38:12 +01:00
Andrea Corallo
3345399e87 add native documentation support test 2020-01-01 11:38:12 +01:00
Andrea Corallo
0c94e69fa6 add comp-tests-free-fun 2020-01-01 11:38:09 +01:00
Andrea Corallo
c039822082 better style into comp-tests-bootstrap 2020-01-01 11:38:09 +01:00
Andrea Corallo
d0e6a27664 better ert usage into tests 2020-01-01 11:38:08 +01:00
Andrea Corallo
0c60b3bae7 fix comp-tests-bootstrap 2020-01-01 11:38:07 +01:00
Andrea Corallo
16fe8a4678 allow for pure function call removal optimization 2020-01-01 11:38:07 +01:00
Andrea Corallo
41bfb91f5d add comp-tests-jump-table-2-f 2020-01-01 11:38:07 +01:00
Andrea Corallo
77c9236957 add comp-tests-signal 2020-01-01 11:38:07 +01:00
Andrea Corallo
f7c52087b2 do not force compiler settings within the testsuite 2020-01-01 11:38:06 +01:00