diff options
| author | Dave Love | 2000-05-26 10:35:38 +0000 |
|---|---|---|
| committer | Dave Love | 2000-05-26 10:35:38 +0000 |
| commit | ed62683d5a04cacdde4bc3aaefee533d1d6fdd42 (patch) | |
| tree | a36bced145618ee41f7775ea916bae1556757164 | |
| parent | de370c4cc2e6e29aecf3eb1e65b7da6c938da419 (diff) | |
| download | emacs-ed62683d5a04cacdde4bc3aaefee533d1d6fdd42.tar.gz emacs-ed62683d5a04cacdde4bc3aaefee533d1d6fdd42.zip | |
(byte-compile-callargs-warn): Use subr-arity to check primitives.
(byte-compile-flush-pending, byte-compile-file-form-progn)
(byte-compile-normal-call, byte-compile-list, byte-compile-concat)
(byte-compile-insert, byte-compile-funcall): Use mapc instead of
mapcar.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 40 |
2 files changed, 33 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 13da362979e..745729bdd8d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2000-05-26 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Use | ||
| 4 | subr-arity to check primitives. | ||
| 5 | (byte-compile-flush-pending, byte-compile-file-form-progn) | ||
| 6 | (byte-compile-normal-call, byte-compile-list, byte-compile-concat) | ||
| 7 | (byte-compile-insert, byte-compile-funcall): Use mapc instead of | ||
| 8 | mapcar. | ||
| 9 | |||
| 1 | 2000-05-26 Kenichi Handa <handa@etl.go.jp> | 10 | 2000-05-26 Kenichi Handa <handa@etl.go.jp> |
| 2 | 11 | ||
| 3 | * international/fontset.el: Set family names of non-latin charsets | 12 | * international/fontset.el: Set family names of non-latin charsets |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 28a80458c09..c16e2d80568 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ;;; This version incorporates changes up to version 2.10 of the | 11 | ;;; This version incorporates changes up to version 2.10 of the |
| 12 | ;;; Zawinski-Furuseth compiler. | 12 | ;;; Zawinski-Furuseth compiler. |
| 13 | (defconst byte-compile-version "$Revision: 2.68 $") | 13 | (defconst byte-compile-version "$Revision: 2.69 $") |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| 16 | 16 | ||
| @@ -1028,13 +1028,21 @@ Each function's symbol gets marked with the `byte-compile-noruntime' property." | |||
| 1028 | (defun byte-compile-callargs-warn (form) | 1028 | (defun byte-compile-callargs-warn (form) |
| 1029 | (let* ((def (or (byte-compile-fdefinition (car form) nil) | 1029 | (let* ((def (or (byte-compile-fdefinition (car form) nil) |
| 1030 | (byte-compile-fdefinition (car form) t))) | 1030 | (byte-compile-fdefinition (car form) t))) |
| 1031 | (sig (and def (byte-compile-arglist-signature | 1031 | (sig (if def |
| 1032 | (if (eq 'lambda (car-safe def)) | 1032 | (byte-compile-arglist-signature |
| 1033 | (nth 1 def) | 1033 | (if (eq 'lambda (car-safe def)) |
| 1034 | (if (byte-code-function-p def) | 1034 | (nth 1 def) |
| 1035 | (aref def 0) | 1035 | (if (byte-code-function-p def) |
| 1036 | '(&rest def)))))) | 1036 | (aref def 0) |
| 1037 | '(&rest def)))) | ||
| 1038 | (if (and (fboundp (car form)) | ||
| 1039 | (subrp (symbol-function (car form)))) | ||
| 1040 | (subr-arity (symbol-function (car form)))))) | ||
| 1037 | (ncall (length (cdr form)))) | 1041 | (ncall (length (cdr form)))) |
| 1042 | ;; Check many or unevalled from subr-arity. | ||
| 1043 | (if (and (cdr-safe sig) | ||
| 1044 | (not (numberp (cdr sig)))) | ||
| 1045 | (setcdr sig nil)) | ||
| 1038 | (if sig | 1046 | (if sig |
| 1039 | (if (or (< ncall (car sig)) | 1047 | (if (or (< ncall (car sig)) |
| 1040 | (and (cdr sig) (> ncall (cdr sig)))) | 1048 | (and (cdr sig) (> ncall (cdr sig)))) |
| @@ -1759,7 +1767,7 @@ list that represents a doc string reference. | |||
| 1759 | (if byte-compile-output | 1767 | (if byte-compile-output |
| 1760 | (let ((form (byte-compile-out-toplevel t 'file))) | 1768 | (let ((form (byte-compile-out-toplevel t 'file))) |
| 1761 | (cond ((eq (car-safe form) 'progn) | 1769 | (cond ((eq (car-safe form) 'progn) |
| 1762 | (mapcar 'byte-compile-output-file-form (cdr form))) | 1770 | (mapc 'byte-compile-output-file-form (cdr form))) |
| 1763 | (form | 1771 | (form |
| 1764 | (byte-compile-output-file-form form))) | 1772 | (byte-compile-output-file-form form))) |
| 1765 | (setq byte-compile-constants nil | 1773 | (setq byte-compile-constants nil |
| @@ -1852,7 +1860,7 @@ list that represents a doc string reference. | |||
| 1852 | (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn) | 1860 | (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn) |
| 1853 | (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn) | 1861 | (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn) |
| 1854 | (defun byte-compile-file-form-progn (form) | 1862 | (defun byte-compile-file-form-progn (form) |
| 1855 | (mapcar 'byte-compile-file-form (cdr form)) | 1863 | (mapc 'byte-compile-file-form (cdr form)) |
| 1856 | ;; Return nil so the forms are not output twice. | 1864 | ;; Return nil so the forms are not output twice. |
| 1857 | nil) | 1865 | nil) |
| 1858 | 1866 | ||
| @@ -2363,7 +2371,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2363 | (if byte-compile-generate-call-tree | 2371 | (if byte-compile-generate-call-tree |
| 2364 | (byte-compile-annotate-call-tree form)) | 2372 | (byte-compile-annotate-call-tree form)) |
| 2365 | (byte-compile-push-constant (car form)) | 2373 | (byte-compile-push-constant (car form)) |
| 2366 | (mapcar 'byte-compile-form (cdr form)) ; wasteful, but faster. | 2374 | (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. |
| 2367 | (byte-compile-out 'byte-call (length (cdr form)))) | 2375 | (byte-compile-out 'byte-call (length (cdr form)))) |
| 2368 | 2376 | ||
| 2369 | (defun byte-compile-variable-ref (base-op var) | 2377 | (defun byte-compile-variable-ref (base-op var) |
| @@ -2687,19 +2695,19 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2687 | (cond ((= count 0) | 2695 | (cond ((= count 0) |
| 2688 | (byte-compile-constant nil)) | 2696 | (byte-compile-constant nil)) |
| 2689 | ((< count 5) | 2697 | ((< count 5) |
| 2690 | (mapcar 'byte-compile-form (cdr form)) | 2698 | (mapc 'byte-compile-form (cdr form)) |
| 2691 | (byte-compile-out | 2699 | (byte-compile-out |
| 2692 | (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- count)) 0)) | 2700 | (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- count)) 0)) |
| 2693 | ((and (< count 256) (not (byte-compile-version-cond | 2701 | ((and (< count 256) (not (byte-compile-version-cond |
| 2694 | byte-compile-compatibility))) | 2702 | byte-compile-compatibility))) |
| 2695 | (mapcar 'byte-compile-form (cdr form)) | 2703 | (mapc 'byte-compile-form (cdr form)) |
| 2696 | (byte-compile-out 'byte-listN count)) | 2704 | (byte-compile-out 'byte-listN count)) |
| 2697 | (t (byte-compile-normal-call form))))) | 2705 | (t (byte-compile-normal-call form))))) |
| 2698 | 2706 | ||
| 2699 | (defun byte-compile-concat (form) | 2707 | (defun byte-compile-concat (form) |
| 2700 | (let ((count (length (cdr form)))) | 2708 | (let ((count (length (cdr form)))) |
| 2701 | (cond ((and (< 1 count) (< count 5)) | 2709 | (cond ((and (< 1 count) (< count 5)) |
| 2702 | (mapcar 'byte-compile-form (cdr form)) | 2710 | (mapc 'byte-compile-form (cdr form)) |
| 2703 | (byte-compile-out | 2711 | (byte-compile-out |
| 2704 | (aref [byte-concat2 byte-concat3 byte-concat4] (- count 2)) | 2712 | (aref [byte-concat2 byte-concat3 byte-concat4] (- count 2)) |
| 2705 | 0)) | 2713 | 0)) |
| @@ -2708,7 +2716,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2708 | (byte-compile-form "")) | 2716 | (byte-compile-form "")) |
| 2709 | ((and (< count 256) (not (byte-compile-version-cond | 2717 | ((and (< count 256) (not (byte-compile-version-cond |
| 2710 | byte-compile-compatibility))) | 2718 | byte-compile-compatibility))) |
| 2711 | (mapcar 'byte-compile-form (cdr form)) | 2719 | (mapc 'byte-compile-form (cdr form)) |
| 2712 | (byte-compile-out 'byte-concatN count)) | 2720 | (byte-compile-out 'byte-concatN count)) |
| 2713 | ((byte-compile-normal-call form))))) | 2721 | ((byte-compile-normal-call form))))) |
| 2714 | 2722 | ||
| @@ -2822,7 +2830,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2822 | ((and (not (byte-compile-version-cond | 2830 | ((and (not (byte-compile-version-cond |
| 2823 | byte-compile-compatibility)) | 2831 | byte-compile-compatibility)) |
| 2824 | (<= (length form) 256)) | 2832 | (<= (length form) 256)) |
| 2825 | (mapcar 'byte-compile-form (cdr form)) | 2833 | (mapc 'byte-compile-form (cdr form)) |
| 2826 | (if (cdr (cdr form)) | 2834 | (if (cdr (cdr form)) |
| 2827 | (byte-compile-out 'byte-insertN (length (cdr form))) | 2835 | (byte-compile-out 'byte-insertN (length (cdr form))) |
| 2828 | (byte-compile-out 'byte-insert 0))) | 2836 | (byte-compile-out 'byte-insert 0))) |
| @@ -3020,7 +3028,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 3020 | (setq for-effect nil))) | 3028 | (setq for-effect nil))) |
| 3021 | 3029 | ||
| 3022 | (defun byte-compile-funcall (form) | 3030 | (defun byte-compile-funcall (form) |
| 3023 | (mapcar 'byte-compile-form (cdr form)) | 3031 | (mapc 'byte-compile-form (cdr form)) |
| 3024 | (byte-compile-out 'byte-call (length (cdr (cdr form))))) | 3032 | (byte-compile-out 'byte-call (length (cdr (cdr form))))) |
| 3025 | 3033 | ||
| 3026 | 3034 | ||