From 75e0a7ccf136a8275c91b37ad72f33d053c025b0 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 21 Jul 2013 00:24:38 +0200 Subject: LAMBDA: DYNAMIC-EXTENT-declare ITER helper. This improves performance of the recursive, PROGV-based approach to dynamic binding to be on par with non-recursive binding based on SBCL primitives. --- sb-eval2.lisp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sb-eval2.lisp b/sb-eval2.lisp index f5fb4dd..db4ded3 100644 --- a/sb-eval2.lisp +++ b/sb-eval2.lisp @@ -468,6 +468,12 @@ ,@body)) (,loop-var ,@(mapcar #'second bindings)))) +(defmacro dnlet (loop-var bindings &body body) + `(labels ((,loop-var ,(mapcar #'first bindings) + ,@body)) + (declare (dynamic-extent #',loop-var)) + (,loop-var ,@(mapcar #'second bindings)))) + (declaim (ftype (function * eval-closure) prepare-lambda)) (defun prepare-lambda (lambda-form context &key (name nil namep)) (destructuring-bind (lambda-list &rest exprs) lambda-form @@ -536,7 +542,7 @@ ;; All this ELT and LENGTH stuff is not as ;; inefficient as it looks. SBCL transforms ;; &rest into &more here. - (nlet iter + (dnlet iter ((rest (when (or restp keyp) (loop for i -- cgit v1.2.3