1.0.21.27: no more &OPTIONAL-DISPATCH debug names
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 18 Oct 2008 10:27:58 +0000 (10:27 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 18 Oct 2008 10:27:58 +0000 (10:27 +0000)
 * IR1-CONVERT-HAIRY-LAMBDA used to give optional dispatch entry points
   `(&OPTIONAL-DISPATCH ,(OR <DEBUG-NAME> <SOURCE-NAME>)) as debug-name.

   Don't do that -- just use the provided DEBUG-NAME directly (it's
   NIL in the cases we most care about, leaving the functional with
   just a source-name). This fixes two issues:

   1. Functions with non-required arguments didn't get the derived
      type information saved in the infodb. FINALIZE-XEP-DEFINITION
      didn't set the INFO entries properly because
        (eq (leaf-source-name leaf) (functional-debug-name leaf))
      was false -- it's true only if there is no separate debug-name.

   2. Functions with non-required arguments printed as
        #<FUNCTION (SB-C::&OPTIONAL-DISPATCH READ-LINE) {10AD8345}>
      because non-NIL debug-name is preferred over the source-name.

 * Test-cases.

NEWS
src/compiler/ir1tran-lambda.lisp
tests/compiler.impure.lisp
tests/compiler.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 918e282..14b6595 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,10 @@ changes in sbcl-1.0.22 relative to 1.0.21:
   * bug fix: COMPILE-FILE did not warn about undefined variable
     references at toplevel, and LOAD of the resulting fasl did
     not signal an error.
+  * bug fix: functions with non-required arguments used to end up with
+    (SB-C::&OPTIONAL-DISPATCH ...) as their name.
+  * bug fix: redefining a function with non-required arguments didn't
+    update the system's knowledge about its call signature properly.
 
 changes in sbcl-1.0.21 relative to 1.0.20:
   * new feature: the compiler is able to track the effective type of a
index ee321c0..f157019 100644 (file)
                                      :allowp allowp
                                      :keyp keyp
                                      :%source-name source-name
-                                     :%debug-name (debug-name '&optional-dispatch
-                                                              (or debug-name source-name))
+                                     :%debug-name debug-name
                                      :plist `(:ir1-environment
                                               (,*lexenv*
                                                ,*current-path*))))
index dad96e8..6c8ed83 100644 (file)
 (with-test (:name :complex-call-doesnt-warn)
   (handler-bind ((warning #'error))
     (compile nil '(lambda (x) (complex-function-signature x :z1 1 :z2 2)))))
+
+(with-test (:name :non-required-args-update-info)
+  (let ((name (gensym "NON-REQUIRE-ARGS-TEST"))
+        (*evaluator-mode* :compile))
+    (eval `(defun ,name (x) x))
+    (assert (equal '(function (t) (values t &optional))
+                   (sb-kernel:type-specifier (sb-int:info :function :type name))))
+    (eval `(defun ,name (x &optional y) (or x y)))
+    (assert (equal '(function (t &optional t) (values t &optional))
+                   (sb-kernel:type-specifier (sb-int:info :function :type name))))))
+
 \f
 ;;;; tests not in the problem domain, but of the consistency of the
 ;;;; compiler machinery itself
index 0623c1f..6f48dad 100644 (file)
                                (destructuring-bind (a (b c) d) '(1 "foo" 4)
                                  (+ a b c d)))))
                    :feh))))))
+
+;;; Functions with non-required arguments used to end up with
+;;; (&OPTIONAL-DISPATCH ...) as their names.
+(with-test (:name :hairy-function-name)
+  (assert (eq 'read-line (nth-value 2 (function-lambda-expression #'read-line))))
+  (assert (equal "#<FUNCTION READ-LINE>" (princ-to-string #'read-line))))
index c129002..7434eb8 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.21.26"
+"1.0.21.27"