comparison lisp/bytecomp.el @ 4888:c27efc9acb5a

merge
author Ben Wing <ben@xemacs.org>
date Wed, 27 Jan 2010 00:37:59 -0600
parents 6772ce4d982b
children 755ae5b97edb 8431b52e43b1
comparison
equal deleted inserted replaced
4887:a47abe9c47f2 4888:c27efc9acb5a
732 (byte-defop 163 0 byte-cdr-safe) 732 (byte-defop 163 0 byte-cdr-safe)
733 (byte-defop 164 -1 byte-nconc) 733 (byte-defop 164 -1 byte-nconc)
734 (byte-defop 165 -1 byte-quo) 734 (byte-defop 165 -1 byte-quo)
735 (byte-defop 166 -1 byte-rem) 735 (byte-defop 166 -1 byte-rem)
736 (byte-defop 167 0 byte-numberp) 736 (byte-defop 167 0 byte-numberp)
737 (byte-defop 168 0 byte-integerp) 737 (byte-defop 168 0 byte-fixnump)
738 738
739 ;; unused: 169 739 ;; unused: 169
740 740
741 ;; These are not present in FSF. 741 ;; These are not present in FSF.
742 ;; 742 ;;
3099 (byte-defop-compiler char-syntax 1+1) 3099 (byte-defop-compiler char-syntax 1+1)
3100 (byte-defop-compiler nreverse 1) 3100 (byte-defop-compiler nreverse 1)
3101 (byte-defop-compiler car-safe 1) 3101 (byte-defop-compiler car-safe 1)
3102 (byte-defop-compiler cdr-safe 1) 3102 (byte-defop-compiler cdr-safe 1)
3103 (byte-defop-compiler numberp 1) 3103 (byte-defop-compiler numberp 1)
3104 (byte-defop-compiler integerp 1) 3104 (byte-defop-compiler fixnump 1)
3105 (byte-defop-compiler skip-chars-forward 1-2+1) 3105 (byte-defop-compiler skip-chars-forward 1-2+1)
3106 (byte-defop-compiler skip-chars-backward 1-2+1) 3106 (byte-defop-compiler skip-chars-backward 1-2+1)
3107 (byte-defop-compiler (eql byte-eq) 2) 3107 (byte-defop-compiler (eql byte-eq) 2)
3108 (byte-defop-compiler20 old-eq 2) 3108 (byte-defop-compiler20 old-eq 2)
3109 (byte-defop-compiler20 old-memq 2) 3109 (byte-defop-compiler20 old-memq 2)
3815 (byte-defop-compiler-1 mapcar-extents byte-compile-funarg-1-2) 3815 (byte-defop-compiler-1 mapcar-extents byte-compile-funarg-1-2)
3816 3816
3817 (byte-defop-compiler-1 let) 3817 (byte-defop-compiler-1 let)
3818 (byte-defop-compiler-1 let*) 3818 (byte-defop-compiler-1 let*)
3819 3819
3820 (byte-defop-compiler-1 integerp)
3821
3820 (defun byte-compile-progn (form) 3822 (defun byte-compile-progn (form)
3821 (byte-compile-body-do-effect (cdr form))) 3823 (byte-compile-body-do-effect (cdr form)))
3822 3824
3823 (defun byte-compile-prog1 (form) 3825 (defun byte-compile-prog1 (form)
3824 (setq form (cdr form)) 3826 (setq form (cdr form))
3997 (if (memq 'unused-vars byte-compile-warnings) 3999 (if (memq 'unused-vars byte-compile-warnings)
3998 ;; done compiling in this scope, warn now. 4000 ;; done compiling in this scope, warn now.
3999 (byte-compile-warn-about-unused-variables)) 4001 (byte-compile-warn-about-unused-variables))
4000 (byte-compile-out 'byte-unbind (length (car (cdr form)))))) 4002 (byte-compile-out 'byte-unbind (length (car (cdr form))))))
4001 4003
4004 ;; We've renamed the integerp bytecode to fixnump, and changed its semantics
4005 ;; accordingly. This means #'integerp itself can't be as fast as it used to
4006 ;; be, since it no longer has a bytecode to itself. As it happens, though,
4007 ;; most of the non-core calls to #'integerp are in contexts where it is
4008 ;; either going to receive a fixnum, or something non-numeric entirely; the
4009 ;; contexts where it needs to distinguish between an integer and a float are
4010 ;; very rare. So, we can have (integerp X) compile to:
4011 ;;
4012 ;; (or (fixnump X) (and (numberp X) (funcall #'integerp X)))
4013 ;;
4014 ;; without the multiple evaluation of X, and where #'fixnump and #'numberp
4015 ;; both have bytecodes. We ignore for-effect, because byte-optimize.el will
4016 ;; delete this call in its presence.
4017 ;;
4018 ;; This approach is byte-code compatible with 21.4 and with earlier 21.5
4019 ;; (except that earlier 21.5 with bignum support will confuse Bfixnump and
4020 ;; Bintegerp; which it did in dealing with byte-compiled code from 21.4
4021 ;; anyway).
4022
4023 (defun byte-compile-integerp (form)
4024 (if (/= 2 (length form))
4025 (byte-compile-subr-wrong-args form 1)
4026 (let ((donetag (byte-compile-make-tag))
4027 (wintag (byte-compile-make-tag))
4028 (failtag (byte-compile-make-tag)))
4029 (byte-compile-constant 'integerp)
4030 (byte-compile-form (second form))
4031 (byte-compile-out 'byte-dup 0)
4032 (byte-compile-out 'byte-fixnump 0)
4033 (byte-compile-goto 'byte-goto-if-not-nil wintag)
4034 (byte-compile-out 'byte-dup 0)
4035 (byte-compile-out 'byte-numberp 0)
4036 (byte-compile-goto 'byte-goto-if-nil failtag)
4037 (byte-compile-out 'byte-call 1)
4038 ;; At this point, the only thing from this function remaining on the
4039 ;; stack is the return value of the called #'integerp, which reflects
4040 ;; exactly what we want. Go directly to donetag, do not discard
4041 ;; anything.
4042 (byte-compile-goto 'byte-goto donetag)
4043 (byte-compile-out-tag failtag)
4044 (byte-compile-discard)
4045 (byte-compile-discard)
4046 (byte-compile-constant nil)
4047 (byte-compile-goto 'byte-goto donetag)
4048 (byte-compile-out-tag wintag)
4049 (byte-compile-discard)
4050 (byte-compile-discard)
4051 (byte-compile-constant t)
4052 (byte-compile-out-tag donetag))))
4002 4053
4003 ;;(byte-defop-compiler-1 /= byte-compile-negated) 4054 ;;(byte-defop-compiler-1 /= byte-compile-negated)
4004 (byte-defop-compiler-1 atom byte-compile-negated) 4055 (byte-defop-compiler-1 atom byte-compile-negated)
4005 (byte-defop-compiler-1 nlistp byte-compile-negated) 4056 (byte-defop-compiler-1 nlistp byte-compile-negated)
4006 4057