0.8.19.38:
[sbcl.git] / src / compiler / ir1tran-lambda.lisp
index c107a93..534933e 100644 (file)
                                      (rest svars))))))
   (values))
 
-;;; FIXME: this is the interface of the CMUCL WITH-DYNAMIC-EXTENT
-;;; macro.  It is slightly confusing, in that START and BODY-START are
-;;; already-existing CTRANs (and FIXME: probably deserve a ONCE-ONLY),
-;;; whereas NEXT is a variable naming a CTRAN in the body.  -- CSR,
-;;; 2004-03-30.
-(defmacro with-dynamic-extent ((start body-start next kind) &body body)
-  (declare (ignore kind))
-  (with-unique-names (cleanup next-ctran)
-    `(progn
-      (ctran-starts-block ,body-start)
-      (let ((,cleanup (make-cleanup :kind :dynamic-extent))
-           (,next-ctran (make-ctran))
-           (,next (make-ctran)))
-       (ir1-convert ,start ,next-ctran nil '(%dynamic-extent-start))
-       (setf (cleanup-mess-up ,cleanup) (ctran-use ,next-ctran))
-       (let ((*lexenv* (make-lexenv :cleanup ,cleanup)))
-         (ir1-convert ,next-ctran ,next nil '(%cleanup-point))
-         (locally ,@body))))))
-
 ;;; Create a lambda node out of some code, returning the result. The
 ;;; bindings are specified by the list of VAR structures VARS. We deal
 ;;; with adding the names to the LEXENV-VARS for the conversion. The
                   :%source-name source-name
                   :%debug-name debug-name))
         (result-ctran (make-ctran))
-         (result-lvar (make-lvar))
-        (dx-rest nil))
+         (result-lvar (make-lvar)))
 
     (awhen (lexenv-lambda *lexenv*)
       (push lambda (lambda-children it))
                (t
                  (when note-lexical-bindings
                    (note-lexical-binding (leaf-source-name var)))
-                (new-venv (cons (leaf-source-name var) var)))))
-       (let ((info (lambda-var-arg-info var)))
-         (when (and info
-                    (eq (arg-info-kind info) :rest)
-                    (leaf-dynamic-extent var))
-           (setq dx-rest t))))
+                (new-venv (cons (leaf-source-name var) var))))))
 
       (let ((*lexenv* (make-lexenv :vars (new-venv)
                                   :lambda lambda
             (ctran-starts-block prebind-ctran)
             (link-node-to-previous-ctran bind prebind-ctran)
             (use-ctran bind postbind-ctran)
-           (if dx-rest
-               (with-dynamic-extent (postbind-ctran result-ctran dx :rest)
-                 (ir1-convert-special-bindings dx result-ctran result-lvar
-                                               body aux-vars aux-vals
-                                               (svars)))
-               (ir1-convert-special-bindings postbind-ctran result-ctran
-                                             result-lvar body
-                                             aux-vars aux-vals (svars)))))))
+           (ir1-convert-special-bindings postbind-ctran result-ctran
+                                          result-lvar body
+                                          aux-vars aux-vals (svars))))))
 
     (link-blocks (component-head *current-component*) (node-block bind))
     (push lambda (component-new-functionals *current-component*))
                                 :type (leaf-type var)
                                 :where-from (leaf-where-from var))))
 
-    (let* ((n-context (gensym "N-CONTEXT-"))
+    (let* ((*allow-instrumenting* nil)
+           (n-context (gensym "N-CONTEXT-"))
           (context-temp (make-lambda-var :%source-name n-context))
           (n-count (gensym "N-COUNT-"))
           (count-temp (make-lambda-var :%source-name n-count
 
       (when rest
        (arg-vals `(%listify-rest-args
-                   ,n-context ,n-count ,(leaf-dynamic-extent rest))))
+                   ,n-context ,n-count)))
       (when morep
        (arg-vals n-context)
        (arg-vals n-count))
 
 ;;; Convert a LAMBDA form into a LAMBDA leaf or an OPTIONAL-DISPATCH leaf.
 (defun ir1-convert-lambda (form &key (source-name '.anonymous.)
-                           debug-name
-                           allow-debug-catch-tag)
+                           debug-name)
 
   (unless (consp form)
     (compiler-error "A ~S was found when expecting a lambda expression:~%  ~S"
      "The lambda expression has a missing or non-list lambda list:~%  ~S"
      form))
 
-  (let ((*allow-debug-catch-tag* (and *allow-debug-catch-tag* allow-debug-catch-tag)))
-    (multiple-value-bind (vars keyp allow-other-keys aux-vars aux-vals)
-       (make-lambda-vars (cadr form))
-      (multiple-value-bind (forms decls) (parse-body (cddr form))
-       (binding* (((*lexenv* result-type)
-                    (process-decls decls (append aux-vars vars) nil))
-                   (forms (if (and *allow-debug-catch-tag*
-                                   (policy *lexenv* (>= insert-debug-catch 2)))
-                              `((catch (make-symbol "SB-DEBUG-CATCH-TAG")
-                                  ,@forms))
-                              forms))
-                   (forms (if (eq result-type *wild-type*)
-                              forms
-                              `((the ,result-type (progn ,@forms)))))
-                   (res (if (or (find-if #'lambda-var-arg-info vars) keyp)
-                            (ir1-convert-hairy-lambda forms vars keyp
-                                                      allow-other-keys
-                                                      aux-vars aux-vals
-                                                      :source-name source-name
-                                                      :debug-name debug-name)
-                            (ir1-convert-lambda-body forms vars
-                                                     :aux-vars aux-vars
-                                                     :aux-vals aux-vals
-                                                     :source-name source-name
-                                                     :debug-name debug-name))))
-         (setf (functional-inline-expansion res) form)
-         (setf (functional-arg-documentation res) (cadr form))
-         res)))))
+  (multiple-value-bind (vars keyp allow-other-keys aux-vars aux-vals)
+      (make-lambda-vars (cadr form))
+    (multiple-value-bind (forms decls) (parse-body (cddr form))
+      (binding* (((*lexenv* result-type)
+                  (process-decls decls (append aux-vars vars) nil))
+                 (forms (if (and *allow-instrumenting*
+                                 (policy *lexenv* (>= insert-debug-catch 2)))
+                            `((catch (locally (declare (optimize (insert-step-conditions 0)))
+                                       (make-symbol "SB-DEBUG-CATCH-TAG"))
+                                ,@forms))
+                            forms))
+                 (forms (if (eq result-type *wild-type*)
+                            forms
+                            `((the ,result-type (progn ,@forms)))))
+                 (res (if (or (find-if #'lambda-var-arg-info vars) keyp)
+                          (ir1-convert-hairy-lambda forms vars keyp
+                                                    allow-other-keys
+                                                    aux-vars aux-vals
+                                                    :source-name source-name
+                                                    :debug-name debug-name)
+                          (ir1-convert-lambda-body forms vars
+                                                   :aux-vars aux-vars
+                                                   :aux-vals aux-vals
+                                                   :source-name source-name
+                                                   :debug-name debug-name))))
+        (setf (functional-inline-expansion res) form)
+        (setf (functional-arg-documentation res) (cadr form))
+        res))))
 
 ;;; helper for LAMBDA-like things, to massage them into a form
 ;;; suitable for IR1-CONVERT-LAMBDA.
 ;;; 2003-01-25
 (defun ir1-convert-lambdalike (thing &rest args
                               &key (source-name '.anonymous.)
-                              debug-name allow-debug-catch-tag)
-  (declare (ignorable source-name debug-name allow-debug-catch-tag))
+                              debug-name)
+  (declare (ignorable source-name debug-name))
   (ecase (car thing)
     ((lambda) (apply #'ir1-convert-lambda thing args))
     ((instance-lambda)
 ;;; reflect the state at the definition site.
 (defun ir1-convert-inline-lambda (fun &key
                                      (source-name '.anonymous.)
-                                     debug-name
-                                     allow-debug-catch-tag)
-  (declare (ignore allow-debug-catch-tag))
+                                     debug-name)
   (destructuring-bind (decls macros symbol-macros &rest body)
                      (if (eq (car fun) 'lambda-with-lexenv)
                          (cdr fun)
                     :policy (lexenv-policy *lexenv*))))
       (ir1-convert-lambda `(lambda ,@body)
                          :source-name source-name
-                         :debug-name debug-name
-                         :allow-debug-catch-tag nil))))
+                         :debug-name debug-name))))
 
 ;;; Get a DEFINED-FUN object for a function we are about to define. If
 ;;; the function has been forward referenced, then substitute for the
 ;;; The INLINE-EXPANSION is a LAMBDA-WITH-LEXENV, or NIL if there is
 ;;; no inline expansion.
 (defun %compiler-defun (name lambda-with-lexenv compile-toplevel)
-
   (let ((defined-fun nil)) ; will be set below if we're in the compiler
-
     (when compile-toplevel
       ;; better be in the compiler
       (aver (boundp '*lexenv*)) 
-      (when sb!xc:*compile-print*
-       (compiler-mumble "~&; recognizing DEFUN ~S~%" name))
       (remhash name *free-funs*)
       (setf defined-fun (get-defined-fun name))
-
       (aver (fasl-output-p *compile-object*))
       (if (member name *fun-names-in-this-file* :test #'equal)
          (warn 'duplicate-definition :name name)