1.0.28.35: compiler notes for failure to stack allocate
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 11 May 2009 10:21:20 +0000 (10:21 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 11 May 2009 10:21:20 +0000 (10:21 +0000)
 * Emit a compiler note when stack allocation was requested, but could
   not be provided.

NEWS
src/compiler/ir2tran.lisp
src/compiler/physenvanal.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 2e4ae83..c332724 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@
     the symbol, prohibits both lexical and dynamic binding. This is mainly an
     efficiency measure for threaded platforms, but also valueable in
     expressing intent.
+  * improvement: SBCL now emits a compiler note where stack allocation was
+    requested but could not be provided.
   * optimization: compiler now generates faster array typechecking code.
   * optimization: ARRAY-DIMENSION is now faster for multidimensional and
     non-simple arrays.
index cc74cca..cb1126a 100644 (file)
 (defevent make-value-cell-event "Allocate heap value cell for lexical var.")
 (defun emit-make-value-cell (node block value res)
   (event make-value-cell-event node)
-  (let ((leaf (tn-leaf res)))
+  (let* ((leaf (tn-leaf res))
+         (dx (when leaf (leaf-dynamic-extent leaf))))
+    (when (and dx (neq :truly dx) (leaf-has-source-name-p leaf))
+      (compiler-notify "cannot stack allocate value cell for ~S" (leaf-source-name leaf)))
     (vop make-value-cell node block value
          ;; FIXME: See bug 419
-         (and leaf (eq :truly (leaf-dynamic-extent leaf)))
+         (eq :truly dx)
          res)))
 \f
 ;;;; leaf reference
index 592c002..0b92341 100644 (file)
                        do (etypecase what
                             (cons
                              (let ((lvar (cdr what)))
-                               (if (lvar-good-for-dx-p lvar (car what) component)
-                                   (let ((real (principal-lvar lvar)))
-                                     (setf (lvar-dynamic-extent real) cleanup)
-                                     (real-dx-lvars real))
-                                   (setf (lvar-dynamic-extent lvar) nil))))
+                               (cond ((lvar-good-for-dx-p lvar (car what) component)
+                                      (let ((real (principal-lvar lvar)))
+                                        (setf (lvar-dynamic-extent real) cleanup)
+                                        (real-dx-lvars real)))
+                                     (t
+                                      (do-uses (use lvar)
+                                        (let ((source (find-original-source (node-source-path use))))
+                                          (unless (symbolp source)
+                                            (compiler-notify "could not stack allocate the result of ~S"
+                                                             source))))
+                                      (setf (lvar-dynamic-extent lvar) nil)))))
                             (node       ; DX closure
                              (let* ((call what)
                                     (arg (first (basic-combination-args call)))
index 3465bb7..81d5744 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.28.34"
+"1.0.28.35"