diff options
| author | Richard M. Stallman | 1992-07-31 02:30:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-07-31 02:30:04 +0000 |
| commit | 3315a6a3a47cda493e7d95ce433498c7fc467609 (patch) | |
| tree | 415090df8646196ec5074e50d5fa360ae4dc349a | |
| parent | 643f763f7d8eaeec9d7a86c915fff68e010b4592 (diff) | |
| download | emacs-3315a6a3a47cda493e7d95ce433498c7fc467609.tar.gz emacs-3315a6a3a47cda493e7d95ce433498c7fc467609.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 62a112debca..008a9967322 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -604,7 +604,10 @@ | |||
| 604 | (condition-case () | 604 | (condition-case () |
| 605 | (eval form) | 605 | (eval form) |
| 606 | (error form))) | 606 | (error form))) |
| 607 | ((null (cdr (cdr form))) (nth 1 form)) | 607 | ;;; It is not safe to delete the function entirely |
| 608 | ;;; (actually, it would be safe if we know the sole arg | ||
| 609 | ;;; is not a marker). | ||
| 610 | ;; ((null (cdr (cdr form))) (nth 1 form)) | ||
| 608 | (t form))) | 611 | (t form))) |
| 609 | 612 | ||
| 610 | (defun byte-optimize-minus (form) | 613 | (defun byte-optimize-minus (form) |
| @@ -621,19 +624,27 @@ | |||
| 621 | (numberp last)) | 624 | (numberp last)) |
| 622 | (setq form (nconc (list '- (- (nth 1 form) last) (nth 2 form)) | 625 | (setq form (nconc (list '- (- (nth 1 form) last) (nth 2 form)) |
| 623 | (delq last (copy-sequence (nthcdr 3 form)))))))) | 626 | (delq last (copy-sequence (nthcdr 3 form)))))))) |
| 624 | (if (eq (nth 2 form) 0) | 627 | ;;; It is not safe to delete the function entirely |
| 625 | (nth 1 form) ; (- x 0) --> x | 628 | ;;; (actually, it would be safe if we know the sole arg |
| 629 | ;;; is not a marker). | ||
| 630 | ;;; (if (eq (nth 2 form) 0) | ||
| 631 | ;;; (nth 1 form) ; (- x 0) --> x | ||
| 626 | (byte-optimize-predicate | 632 | (byte-optimize-predicate |
| 627 | (if (and (null (cdr (cdr (cdr form)))) | 633 | (if (and (null (cdr (cdr (cdr form)))) |
| 628 | (eq (nth 1 form) 0)) ; (- 0 x) --> (- x) | 634 | (eq (nth 1 form) 0)) ; (- 0 x) --> (- x) |
| 629 | (cons (car form) (cdr (cdr form))) | 635 | (cons (car form) (cdr (cdr form))) |
| 630 | form)))) | 636 | form)) |
| 637 | ;;; ) | ||
| 638 | ) | ||
| 631 | 639 | ||
| 632 | (defun byte-optimize-multiply (form) | 640 | (defun byte-optimize-multiply (form) |
| 633 | (setq form (byte-optimize-delay-constants-math form 1 '*)) | 641 | (setq form (byte-optimize-delay-constants-math form 1 '*)) |
| 634 | ;; If there is a constant in FORM, it is now the last element. | 642 | ;; If there is a constant in FORM, it is now the last element. |
| 635 | (cond ((null (cdr form)) 1) | 643 | (cond ((null (cdr form)) 1) |
| 636 | ((null (cdr (cdr form))) (nth 1 form)) | 644 | ;;; It is not safe to delete the function entirely |
| 645 | ;;; (actually, it would be safe if we know the sole arg | ||
| 646 | ;;; is not a marker or if it appears in other arithmetic). | ||
| 647 | ;;; ((null (cdr (cdr form))) (nth 1 form)) | ||
| 637 | ((let ((last (car (reverse form)))) | 648 | ((let ((last (car (reverse form)))) |
| 638 | (cond ((eq 0 last) (list 'progn (cdr form))) | 649 | (cond ((eq 0 last) (list 'progn (cdr form))) |
| 639 | ((eq 1 last) (delq 1 (copy-sequence form))) | 650 | ((eq 1 last) (delq 1 (copy-sequence form))) |
| @@ -659,8 +670,9 @@ | |||
| 659 | (cons (/ (nth 1 form) last) | 670 | (cons (/ (nth 1 form) last) |
| 660 | (byte-compile-butlast (cdr (cdr form))))) | 671 | (byte-compile-butlast (cdr (cdr form))))) |
| 661 | last nil)))) | 672 | last nil)))) |
| 662 | (cond ((null (cdr (cdr form))) | 673 | (cond |
| 663 | (nth 1 form)) | 674 | ;;; ((null (cdr (cdr form))) |
| 675 | ;;; (nth 1 form)) | ||
| 664 | ((eq (nth 1 form) 0) | 676 | ((eq (nth 1 form) 0) |
| 665 | (append '(progn) (cdr (cdr form)) '(0))) | 677 | (append '(progn) (cdr (cdr form)) '(0))) |
| 666 | ((eq last -1) | 678 | ((eq last -1) |