[movitz-cvs] CVS update: movitz/losp/muerte/cons.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Sat Apr 17 15:34:04 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv2725

Modified Files:
	cons.lisp 
Log Message:
Added "fast" implementations of cddr and cdddr, in an effort to reduce
cal/ret run-time and code-size overhead in list processing.

Date: Sat Apr 17 11:34:03 2004
Author: ffjeld

Index: movitz/losp/muerte/cons.lisp
diff -u movitz/losp/muerte/cons.lisp:1.3 movitz/losp/muerte/cons.lisp:1.4
--- movitz/losp/muerte/cons.lisp:1.3	Mon Mar 22 09:42:31 2004
+++ movitz/losp/muerte/cons.lisp	Sat Apr 17 11:34:03 2004
@@ -9,7 +9,7 @@
 ;;;; Created at:    Fri Dec  8 15:25:45 2000
 ;;;; Distribution:  See the accompanying file COPYING.
 ;;;;                
-;;;; $Id: cons.lisp,v 1.3 2004/03/22 14:42:31 ffjeld Exp $
+;;;; $Id: cons.lisp,v 1.4 2004/04/17 15:34:03 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -53,6 +53,36 @@
     (:leal (:eax -1) :ecx)
     (:testb 3 :cl)
     (:jnz '(:sub-program () (:int 66)))
+    (:movl (:eax 3) :eax)
+    (:ret)))
+
+(define-primitive-function fast-cddr ()
+  "This is the actual CDR code."
+  (with-inline-assembly (:returns :eax)
+    (:leal (:eax -1) :ecx)
+    (:testb 3 :cl)
+    (:jnz '(:sub-program () (:int 66)))
+    (:movl (:eax 3) :eax)
+    (:leal (:eax -1) :ecx)
+    (:testb 3 :cl)
+    (:jnz '(:sub-program () (:int 66)))
+    (:movl (:eax 3) :eax)
+    (:ret)))
+
+(define-primitive-function fast-cdddr ()
+  "This is the actual CDR code."
+  (with-inline-assembly (:returns :eax)
+    (:leal (:eax -1) :ecx)
+    (:testb 3 :cl)
+    (:jnz '(:sub-program (not-cons) (:int 66)))
+    (:movl (:eax 3) :eax)
+    (:leal (:eax -1) :ecx)
+    (:testb 3 :cl)
+    (:jnz '(:sub-program (not-cons) (:int 66)))
+    (:movl (:eax 3) :eax)
+    (:leal (:eax -1) :ecx)
+    (:testb 3 :cl)
+    (:jnz '(:sub-program (not-cons) (:int 66)))
     (:movl (:eax 3) :eax)
     (:ret)))
 





More information about the Movitz-cvs mailing list