aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/comp-tests.el
diff options
context:
space:
mode:
authorStefan Monnier2024-05-22 14:45:35 -0400
committerStefan Monnier2024-05-28 20:53:25 -0400
commitfde8dc9287c0a81c6b942b5cf445f8f7aeba1207 (patch)
treedf05ec0d8c9770e6eaac7c6f3aff918c40c04933 /test/src/comp-tests.el
parent1a1170cde7e847f4eb4d736a400f7325f2265a1c (diff)
downloademacs-fde8dc9287c0a81c6b942b5cf445f8f7aeba1207.tar.gz
emacs-fde8dc9287c0a81c6b942b5cf445f8f7aeba1207.zip
Redirect calls to `subr-native-elisp-p` to `native-comp-function-p`
* test/src/comp-tests.el (comp-tests-bootstrap, lambda-return) (lambda-return2, free-fun, free-fun2, free-fun-silly-name, speed--1) (compile-forms, comp-test-defsubst, primitive-redefine-compile-44221) (48029-1, 61917-1, tco, fw-prop-1, pure): * test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): * lisp/subr.el (subr-primitive-p, primitive-function-p, symbol-file): * lisp/help-fns.el (find-lisp-object-file-name): * lisp/emacs-lisp/disass.el (disassemble-internal): * lisp/emacs-lisp/comp.el (comp--call-optim-form-call): * lisp/emacs-lisp/comp-run.el (comp-warn-primitives): * lisp/emacs-lisp/comp-common.el (comp-function-type-spec): * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): * lisp/emacs-lisp/bytecomp.el (<trailer>): Rename `subr-native-elisp-p` to `native-comp-function-p`.
Diffstat (limited to 'test/src/comp-tests.el')
-rw-r--r--test/src/comp-tests.el40
1 files changed, 20 insertions, 20 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 5deff03fd84..dffb7097a3e 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -85,13 +85,13 @@ Check that the resulting binaries do not differ."
85 (copy-file comp-src comp2-src t) 85 (copy-file comp-src comp2-src t)
86 (let ((load-no-native t)) 86 (let ((load-no-native t))
87 (load (concat comp-src "c") nil nil t t)) 87 (load (concat comp-src "c") nil nil t t))
88 (should-not (subr-native-elisp-p (symbol-function 'native-compile))) 88 (should-not (native-comp-function-p (symbol-function 'native-compile)))
89 (message "Compiling stage1...") 89 (message "Compiling stage1...")
90 (let* ((t0 (current-time)) 90 (let* ((t0 (current-time))
91 (comp1-eln (native-compile comp1-src))) 91 (comp1-eln (native-compile comp1-src)))
92 (message "Done in %d secs" (float-time (time-since t0))) 92 (message "Done in %d secs" (float-time (time-since t0)))
93 (load comp1-eln nil nil t t) 93 (load comp1-eln nil nil t t)
94 (should (subr-native-elisp-p (symbol-function 'native-compile))) 94 (should (native-comp-function-p (symbol-function 'native-compile)))
95 (message "Compiling stage2...") 95 (message "Compiling stage2...")
96 (let ((t0 (current-time)) 96 (let ((t0 (current-time))
97 (comp2-eln (native-compile comp2-src))) 97 (comp2-eln (native-compile comp2-src)))
@@ -325,15 +325,15 @@ Check that the resulting binaries do not differ."
325 325
326(comp-deftest lambda-return () 326(comp-deftest lambda-return ()
327 (let ((f (comp-tests-lambda-return-f))) 327 (let ((f (comp-tests-lambda-return-f)))
328 (should (subr-native-elisp-p f)) 328 (should (native-comp-function-p f))
329 (should (= (funcall f 3) 4)))) 329 (should (= (funcall f 3) 4))))
330 330
331(comp-deftest lambda-return2 () 331(comp-deftest lambda-return2 ()
332 "Check a nested lambda function gets native compiled." 332 "Check a nested lambda function gets native compiled."
333 (let ((f (comp-tests-lambda-return-f2))) 333 (let ((f (comp-tests-lambda-return-f2)))
334 (should (subr-native-elisp-p f)) 334 (should (native-comp-function-p f))
335 (let ((f2 (funcall f))) 335 (let ((f2 (funcall f)))
336 (should (subr-native-elisp-p f2)) 336 (should (native-comp-function-p f2))
337 (should (= (funcall f2 3) 4))))) 337 (should (= (funcall f2 3) 4)))))
338 338
339(comp-deftest recursive () 339(comp-deftest recursive ()
@@ -391,7 +391,7 @@ Check that the resulting binaries do not differ."
391 t) 391 t)
392 (native-compile #'comp-tests-free-fun-f) 392 (native-compile #'comp-tests-free-fun-f)
393 393
394 (should (subr-native-elisp-p (symbol-function 'comp-tests-free-fun-f))) 394 (should (native-comp-function-p (symbol-function 'comp-tests-free-fun-f)))
395 (should (= (comp-tests-free-fun-f) 3)) 395 (should (= (comp-tests-free-fun-f) 3))
396 (should (string= (documentation #'comp-tests-free-fun-f) 396 (should (string= (documentation #'comp-tests-free-fun-f)
397 "Some doc.")) 397 "Some doc."))
@@ -412,8 +412,8 @@ Check that the resulting binaries do not differ."
412 412
413 (let* ((f (symbol-function 'comp-tests-free-fun-f2)) 413 (let* ((f (symbol-function 'comp-tests-free-fun-f2))
414 (f2 (funcall f))) 414 (f2 (funcall f)))
415 (should (subr-native-elisp-p f)) 415 (should (native-comp-function-p f))
416 (should (subr-native-elisp-p f2)) 416 (should (native-comp-function-p f2))
417 (should (string= (documentation f2) "Some doc.")) 417 (should (string= (documentation f2) "Some doc."))
418 (should (commandp f2)) 418 (should (commandp f2))
419 (should (equal (interactive-form f2) '(interactive nil))) 419 (should (equal (interactive-form f2) '(interactive nil)))
@@ -425,7 +425,7 @@ Check that the resulting binaries do not differ."
425 "Check we are able to compile a single function." 425 "Check we are able to compile a single function."
426 (eval '(defun comp-tests/free\fun-f ()) t) 426 (eval '(defun comp-tests/free\fun-f ()) t)
427 (native-compile #'comp-tests/free\fun-f) 427 (native-compile #'comp-tests/free\fun-f)
428 (should (subr-native-elisp-p (symbol-function 'comp-tests/free\fun-f)))) 428 (should (native-comp-function-p (symbol-function 'comp-tests/free\fun-f))))
429 429
430(comp-deftest bug-40187 () 430(comp-deftest bug-40187 ()
431 "Check function name shadowing. 431 "Check function name shadowing.
@@ -436,7 +436,7 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
436(comp-deftest speed--1 () 436(comp-deftest speed--1 ()
437 "Check that at speed -1 we do not native compile." 437 "Check that at speed -1 we do not native compile."
438 (should (= (comp-test-speed--1-f) 3)) 438 (should (= (comp-test-speed--1-f) 3))
439 (should-not (subr-native-elisp-p (symbol-function 'comp-test-speed--1-f)))) 439 (should-not (native-comp-function-p (symbol-function 'comp-test-speed--1-f))))
440 440
441(comp-deftest bug-42360 () 441(comp-deftest bug-42360 ()
442 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-07/msg00418.html>." 442 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-07/msg00418.html>."
@@ -497,22 +497,22 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
497 (should-error (native-compile '(+ 1 foo))) 497 (should-error (native-compile '(+ 1 foo)))
498 (let ((lexical-binding t) 498 (let ((lexical-binding t)
499 (f (native-compile '(lambda (x) (1+ x))))) 499 (f (native-compile '(lambda (x) (1+ x)))))
500 (should (subr-native-elisp-p f)) 500 (should (native-comp-function-p f))
501 (should (= (funcall f 2) 3))) 501 (should (= (funcall f 2) 3)))
502 (let* ((lexical-binding nil) 502 (let* ((lexical-binding nil)
503 (f (native-compile '(lambda (x) (1+ x))))) 503 (f (native-compile '(lambda (x) (1+ x)))))
504 (should (subr-native-elisp-p f)) 504 (should (native-comp-function-p f))
505 (should (= (funcall f 2) 3)))) 505 (should (= (funcall f 2) 3))))
506 506
507(comp-deftest comp-test-defsubst () 507(comp-deftest comp-test-defsubst ()
508 ;; Bug#42664, Bug#43280, Bug#44209. 508 ;; Bug#42664, Bug#43280, Bug#44209.
509 (should-not (subr-native-elisp-p (symbol-function 'comp-test-defsubst-f)))) 509 (should-not (native-comp-function-p (symbol-function 'comp-test-defsubst-f))))
510 510
511(comp-deftest primitive-redefine-compile-44221 () 511(comp-deftest primitive-redefine-compile-44221 ()
512 "Test the compiler still works while primitives are redefined (bug#44221)." 512 "Test the compiler still works while primitives are redefined (bug#44221)."
513 (cl-letf (((symbol-function 'delete-region) 513 (cl-letf (((symbol-function 'delete-region)
514 (lambda (_ _)))) 514 (lambda (_ _))))
515 (should (subr-native-elisp-p 515 (should (native-comp-function-p
516 (native-compile 516 (native-compile
517 '(lambda () 517 '(lambda ()
518 (delete-region (point-min) (point-max)))))))) 518 (delete-region (point-min) (point-max))))))))
@@ -564,7 +564,7 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
564 564
565(comp-deftest 48029-1 () 565(comp-deftest 48029-1 ()
566 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-07/msg00666.html>" 566 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-07/msg00666.html>"
567 (should (subr-native-elisp-p 567 (should (native-comp-function-p
568 (symbol-function 'comp-test-48029-nonascii-žžž-f)))) 568 (symbol-function 'comp-test-48029-nonascii-žžž-f))))
569 569
570(comp-deftest 61917-1 () 570(comp-deftest 61917-1 ()
@@ -578,7 +578,7 @@ dedicated byte-op code."
578 (setf x (native-compile 578 (setf x (native-compile
579 '(lambda () 579 '(lambda ()
580 (delete-region 1 2)))) 580 (delete-region 1 2))))
581 (should (subr-native-elisp-p x)) 581 (should (native-comp-function-p x))
582 (funcall x) 582 (funcall x)
583 (advice-remove #'delete-region f) 583 (advice-remove #'delete-region f)
584 (should (equal comp-test-primitive-redefine-args '(1 2)))))) 584 (should (equal comp-test-primitive-redefine-args '(1 2))))))
@@ -874,7 +874,7 @@ Return a list of results."
874 (comp-tests-tco-f (+ a b) a (- count 1)))) 874 (comp-tests-tco-f (+ a b) a (- count 1))))
875 t) 875 t)
876 (native-compile #'comp-tests-tco-f) 876 (native-compile #'comp-tests-tco-f)
877 (should (subr-native-elisp-p (symbol-function 'comp-tests-tco-f))) 877 (should (native-comp-function-p (symbol-function 'comp-tests-tco-f)))
878 (should (= (comp-tests-tco-f 1 0 10) 55)))) 878 (should (= (comp-tests-tco-f 1 0 10) 55))))
879 879
880(defun comp-tests-fw-prop-checker-1 (_) 880(defun comp-tests-fw-prop-checker-1 (_)
@@ -901,7 +901,7 @@ Return a list of results."
901 (length c))) ; <= has to optimize 901 (length c))) ; <= has to optimize
902 t) 902 t)
903 (native-compile #'comp-tests-fw-prop-1-f) 903 (native-compile #'comp-tests-fw-prop-1-f)
904 (should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f))) 904 (should (native-comp-function-p (symbol-function 'comp-tests-fw-prop-1-f)))
905 (should (= (comp-tests-fw-prop-1-f) 6)))) 905 (should (= (comp-tests-fw-prop-1-f) 6))))
906 906
907(defun comp-tests--type-lists-equal (l1 l2) 907(defun comp-tests--type-lists-equal (l1 l2)
@@ -1556,10 +1556,10 @@ folded."
1556 (declare-function comp-tests-pure-caller-f nil) 1556 (declare-function comp-tests-pure-caller-f nil)
1557 (declare-function comp-tests-pure-fibn-entry-f nil) 1557 (declare-function comp-tests-pure-fibn-entry-f nil)
1558 1558
1559 (should (subr-native-elisp-p (symbol-function 'comp-tests-pure-caller-f))) 1559 (should (native-comp-function-p (symbol-function 'comp-tests-pure-caller-f)))
1560 (should (= (comp-tests-pure-caller-f) 4)) 1560 (should (= (comp-tests-pure-caller-f) 4))
1561 1561
1562 (should (subr-native-elisp-p (symbol-function 'comp-tests-pure-fibn-entry-f))) 1562 (should (native-comp-function-p (symbol-function 'comp-tests-pure-fibn-entry-f)))
1563 (should (= (comp-tests-pure-fibn-entry-f) 6765)))) 1563 (should (= (comp-tests-pure-fibn-entry-f) 6765))))
1564 1564
1565(defvar comp-tests-cond-rw-checked-function nil 1565(defvar comp-tests-cond-rw-checked-function nil