changeset 4228:ce594b233b20

[xemacs-hg @ 2007-10-15 10:55:49 by aidan] Add a correct version of the (featurep 'xemacs) optimisation.
author aidan
date Mon, 15 Oct 2007 10:55:49 +0000
parents dd9c1d5f5319
children 8e0cf7ddb7b3
files lisp/ChangeLog lisp/byte-optimize.el
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Oct 15 10:53:34 2007 +0000
+++ b/lisp/ChangeLog	Mon Oct 15 10:55:49 2007 +0000
@@ -1,3 +1,14 @@
+2007-10-01  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* byte-optimize.el:
+	* byte-optimize.el (byte-optimize-ever-present-features): New.
+	* byte-optimize.el (byte-optimize-featurep): New.
+	Optimise calls to (featurep 'xemacs) to t, since our byte code
+	refuses to run on GNU Emacs. Also optimises away checks for cl,
+	cl-extra, cl-19 and backquote, a conservative list of those
+	features that have been available in every XEmacs build since the
+	last time our opcodes changed. 
+
 2007-10-14  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* coding.el:
--- a/lisp/byte-optimize.el	Mon Oct 15 10:53:34 2007 +0000
+++ b/lisp/byte-optimize.el	Mon Oct 15 10:55:49 2007 +0000
@@ -1169,6 +1169,21 @@
 	(eval form)
       form)))
 
+(defvar byte-optimize-ever-present-features 
+  '(xemacs cl cl-extra cl-19 backquote))
+
+(put 'featurep 'byte-optimizer 'byte-optimize-featurep)
+(defun byte-optimize-featurep (form)
+  (let ((to-check (cdr-safe form)))
+    (if (memq (car-safe
+	       (cdr-safe
+		(car-safe
+		 (cdr-safe 
+		  form))))
+	      byte-optimize-ever-present-features)
+	t
+      form)))
+
 
 ;;; enumerating those functions which need not be called if the returned
 ;;; value is not used.  That is, something like