From f36b002a5f8a4e4bba40bca8143cc1c0bf5ff21f Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 18 Mar 2012 13:24:35 +0100 Subject: [PATCH] Slight optimization of the function that searches closure boundaries in CLOS --- src/clos/method.lsp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/clos/method.lsp b/src/clos/method.lsp index 4da6f4936..9a234b478 100644 --- a/src/clos/method.lsp +++ b/src/clos/method.lsp @@ -132,16 +132,18 @@ (defun environment-contains-closure (env) ;; - ;; As explained in compiler.d (make_lambda()), we use a symbol with name - ;; "FUNCTION" to mark the beginning of a function. If we find that symbol - ;; twice, it is quite likely that this form will end up in a closure. + ;; As explained in compiler.d (make_lambda()), we use a symbol with + ;; name "FUNCTION-BOUNDARY" to mark the beginning of a function. If + ;; we find that symbol twice, it is quite likely that this form will + ;; end up in a closure. ;; - (flet ((function-boundary (s) - (and (consp s) - (symbolp (setf s (first s))) - (null (symbol-package s)) - (equal (symbol-name s) "FUNCTION")))) - (> (count-if #'function-boundary (car env)) 1))) + (let ((counter 0)) + (declare (fixnum counter)) + (dolist (item (car env)) + (when (and (consp item) + (eq (first (the cons item)) 'si::function-boundary) + (> (incf counter) 1)) + (return t))))) (defun walk-method-lambda (method-lambda required-parameters env) (declare (si::c-local)