0.8.15.6:
authorAlexey Dejneka <adejneka@comail.ru>
Sat, 2 Oct 2004 07:48:32 +0000 (07:48 +0000)
committerAlexey Dejneka <adejneka@comail.ru>
Sat, 2 Oct 2004 07:48:32 +0000 (07:48 +0000)
        * Fix bug from the Debian report #273606 by Gabor Melis:
          special variable *ALLOW-INSTRUMENTING* controls insertion of
          debug CATCH and stepper forms; is is enabled during IR1
          conversion (initial and inline expansion) and disabled
          otherwise (e.g. for IR1 transforms).

12 files changed:
NEWS
src/compiler/early-c.lisp
src/compiler/ir1-step.lisp
src/compiler/ir1-translators.lisp
src/compiler/ir1opt.lisp
src/compiler/ir1tran-lambda.lisp
src/compiler/ir1tran.lisp
src/compiler/ir1util.lisp
src/compiler/main.lisp
src/compiler/target-main.lisp
tests/compiler.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index aa8b1eb..eec6df0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ changes in sbcl-0.8.16 relative to sbcl-0.8.15:
   * bug fix: DEFGENERIC now works even when there's a function of the
     same name in an enclosing lexical environment.  (thanks to Zach
     Beane)
+  * fixed compiler failure, caused by instrumenting code during
+    IR1-optimization.  (Debian bug report #273606 by Gabor Melis)
   * fixed some bugs revealed by Paul Dietz' test suite:
     ** POSITION on displaced vectors with non-zero displacement
        returns the right answer.
index 43d22da..b51bf8b 100644 (file)
 (defvar *constants*)
 (declaim (type hash-table *constants*))
 
+;;; *ALLOW-INSTRUMENTING* controls whether we should allow the
+;;; insertion of instrumenting code (like a (CATCH ...)) around code
+;;; to allow the debugger RETURN and STEP commands to function (we
+;;; disallow it for internal stuff).
+(defvar *allow-instrumenting*)
+
 ;;; miscellaneous forward declarations
 (defvar *code-segment*)
 #!+sb-dyncount (defvar *collect-dynamic-statistics*)
index 2ca4af6..8f852fe 100644 (file)
@@ -64,7 +64,8 @@
                     `(locally (declare (optimize (insert-step-conditions 0)))
                       (step-variable ,form-string ,form))))
       (list
-       (let* ((*step-arguments-p* (policy *lexenv* (= insert-step-conditions 3)))
+       (let* ((*step-arguments-p* (and *allow-instrumenting*
+                                       (policy *lexenv* (= insert-step-conditions 3))))
               (step-form `(step-form ,form-string
                                      ',(source-path-original-source *current-path*)
                                      *compile-file-pathname*))
@@ -88,7 +89,8 @@
                          ;; KLUDGE: packages we're not interested in stepping.
                          (mapcar #'find-package '(sb!c sb!int sb!impl sb!kernel sb!pcl)))))))
     (let ((lexenv *lexenv*))
-      (and (policy lexenv (>= insert-step-conditions 2))
+      (and *allow-instrumenting*
+           (policy lexenv (>= insert-step-conditions 2))
            (cond ((consp form)
                   (let ((op (car form)))
                     (or (and (consp op) (eq 'lambda (car op)))
                              (step-symbol-p op)))))
                  ((symbolp form)
                   (and *step-arguments-p*
+                       *allow-instrumenting*
                        (policy lexenv (= insert-step-conditions 3))
                        (not (consp (lexenv-find form vars)))
                        (not (constantp form))
index d954575..0588565 100644 (file)
                 '(lambda named-lambda instance-lambda lambda-with-lexenv))
         (ir1-convert-lambdalike
                          thing
-                         :debug-name (debug-namify "#'" thing)
-                         :allow-debug-catch-tag t))
+                         :debug-name (debug-namify "#'" thing)))
        ((legal-fun-name-p thing)
         (find-lexically-apparent-fun
                     thing "as the argument to FUNCTION"))
                              (ir1-convert-lambda d
                                                  :source-name n
                                                  :debug-name (debug-namify
-                                                              "FLET " n)
-                                                 :allow-debug-catch-tag t))
+                                                              "FLET " n)))
                            names defs)))
         (processing-decls (decls nil fvars next result)
           (let ((*lexenv* (make-lexenv :funs (pairlis names fvars))))
                           (ir1-convert-lambda def
                                               :source-name name
                                               :debug-name (debug-namify
-                                                           "LABELS " name)
-                                              :allow-debug-catch-tag t))
+                                                           "LABELS " name)))
                         names defs))))
         
         ;; Modify all the references to the dummy function leaves so
 ;;; Note that environment analysis replaces references to escape
 ;;; functions with references to the corresponding NLX-INFO structure.
 (def-ir1-translator %escape-fun ((tag) start next result)
-  (let ((fun (ir1-convert-lambda
-             `(lambda ()
-                (return-from ,tag (%unknown-values)))
-             :debug-name (debug-namify "escape function for " tag))))
+  (let ((fun (let ((*allow-instrumenting* nil))
+               (ir1-convert-lambda
+                `(lambda ()
+                   (return-from ,tag (%unknown-values)))
+                :debug-name (debug-namify "escape function for " tag)))))
     (setf (functional-kind fun) :escape)
     (reference-leaf start next result fun)))
 
index 55c8829..909cd1f 100644 (file)
             ;; called semi-inlining? A more descriptive name would
             ;; be nice. -- WHN 2002-01-07
             (frob ()
-              (let ((res (ir1-convert-lambda-for-defun
-                          (defined-fun-inline-expansion leaf)
-                          leaf t
-                          #'ir1-convert-inline-lambda)))
+              (let ((res (let ((*allow-instrumenting* t))
+                            (ir1-convert-lambda-for-defun
+                             (defined-fun-inline-expansion leaf)
+                             leaf t
+                             #'ir1-convert-inline-lambda))))
                 (setf (defined-fun-functional leaf) res)
                 (change-ref-leaf ref res))))
        (if ir1-converting-not-optimizing-p
                                 (block-next (node-block call)))
       (let ((new-fun (ir1-convert-inline-lambda
                      res
-                     :debug-name (debug-namify "LAMBDA-inlined " 
-                                               source-name 
+                     :debug-name (debug-namify "LAMBDA-inlined "
+                                               source-name
                                                "<unknown function>")))
            (ref (lvar-use (combination-fun call))))
        (change-ref-leaf ref new-fun)
index 632d189..4094431 100644 (file)
 
 ;;; 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 (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)))))
+  (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
index 07e2ce2..9f4a5e3 100644 (file)
   the efficiency of stable code.")
 
 (defvar *fun-names-in-this-file* nil)
-
-;;; *ALLOW-DEBUG-CATCH-TAG* controls whether we should allow the
-;;; insertion a (CATCH ...) around code to allow the debugger RETURN
-;;; command to function.
-(defvar *allow-debug-catch-tag* t)
 \f
 ;;;; namespace management utilities
 
   (declare (list path))
   (let* ((*current-path* path)
         (component (make-empty-component))
-        (*current-component* component))
+        (*current-component* component)
+         (*allow-instrumenting* t))
     (setf (component-name component) "initial component")
     (setf (component-kind component) :initial)
     (let* ((forms (if for-value `(,form) `(,form nil)))
                                                   opname
                                                   :debug-name (debug-namify
                                                                "LAMBDA CAR "
-                                                               opname)
-                                                  :allow-debug-catch-tag t)))))))))
+                                                               opname))))))))))
     (values))
 
   ;; Generate a reference to a manifest constant, creating a new leaf
index 1914d04..4e4b031 100644 (file)
         (dolist (block (block-pred old-block))
           (change-block-successor block old-block new-block))
 
-        (ir1-convert new-start ctran filtered-lvar
-                     `(locally (declare (optimize (insert-step-conditions 0))) ,form))
+        (ir1-convert new-start ctran filtered-lvar form)
 
         ;; KLUDGE: Comments at the head of this function in CMU CL
         ;; said that somewhere in here we
index b1e49c1..01d9c6f 100644 (file)
@@ -28,7 +28,8 @@
                  #!+sb-show *compiler-trace-output*
                  *last-source-context* *last-original-source*
                  *last-source-form* *last-format-string* *last-format-args*
-                 *last-message-count* *lexenv* *fun-names-in-this-file*))
+                 *last-message-count* *lexenv* *fun-names-in-this-file*
+                  *allow-instrumenting*))
 
 ;;; Whether call of a function which cannot be defined causes a full
 ;;; warning.
     (setf (component-name component)
          (debug-namify "~S initial component" name))
     (setf (component-kind component) :initial)
-    (let* ((locall-fun (ir1-convert-lambdalike
-                        definition
-                        :debug-name (debug-namify "top level local call "
-                                                 name)
-                       ;; KLUDGE: we do this so that we get to have
-                       ;; nice debug returnness in functions defined
-                       ;; from the REPL
-                       :allow-debug-catch-tag t))
+    (let* ((locall-fun (let ((*allow-instrumenting* t))
+                         (ir1-convert-lambdalike
+                          definition
+                          :debug-name (debug-namify "top level local call "
+                                                    name))))
            (fun (ir1-convert-lambda (make-xep-lambda-expression locall-fun)
                                    :source-name (or name '.anonymous.)
                                    :debug-name (unless name
                  '(original-source-start 0 0)))
   (when name
     (legal-fun-name-or-type-error name))
-  (let* ((*lexenv* (make-lexenv :policy *policy*
+  (let* (
+         (*lexenv* (make-lexenv :policy *policy*
                                :handled-conditions *handled-conditions*
                                :disabled-package-locks *disabled-package-locks*))
          (fun (make-functional-from-toplevel-lambda lambda-expression
         (*source-info* info)
         (*toplevel-lambdas* ())
         (*fun-names-in-this-file* ())
+        (*allow-instrumenting* nil)
         (*compiler-error-bailout*
          (lambda ()
            (compiler-mumble "~2&; fatal error, aborting compilation~%")
index 3217c38..5d81a45 100644 (file)
@@ -48,6 +48,7 @@
             (*source-info* (make-lisp-source-info form))
             (*toplevel-lambdas* ())
             (*block-compile* nil)
+             (*allow-instrumenting* nil)
             (*compiler-error-bailout*
              (lambda (&optional error)
                 (declare (ignore error))
index adafaf8..d3c6731 100644 (file)
        (TAGBODY (THE INTEGER (CATCH 'CT4 (LOGORC1 C -15950))) 1)
        B))))
 
+(compile nil
+  '(lambda (buffer i end)
+    (declare (optimize (debug 3)))
+    (loop (when (not (eql 0 end)) (return)))
+    (let ((s (make-string end)))
+      (setf (schar s i) (schar buffer i))
+      s)))
+
 ;;; check that constant string prefix and suffix don't cause the
 ;;; compiler to emit code deletion notes.
 (handler-bind ((sb-ext:code-deletion-note #'error))
index cf3bcc3..2b325b1 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".)
-"0.8.15.5"
+"0.8.15.6"