Commit e049902f authored by Alexey Dejneka's avatar Alexey Dejneka
Browse files

0.7.11.10:

        Fixed some bugs revealed by Paul Dietz' test suite:
        ** BOA constructor with &AUX argument without a default value does
           not cause a type error;
        ** CONSTANTP now returns true for all self-evaluating objects.
parent 9ef324a6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ KNOWN BUGS OF NO SPECIAL CLASS:
  SBCL to wager that this (undefined in ANSI) operation would be safe.

3:
  a:
  ANSI specifies that a type mismatch in a structure slot
  initialization value should not cause a warning.
WORKAROUND:
@@ -78,6 +79,11 @@ WORKAROUND:
  Such code should compile without complaint and work correctly either
  on SBCL or on any other completely compliant Common Lisp system.

  b: &AUX argument in a boa-constructor without a default value means
     "do not initilize this slot" and does not cause type error. But
     an error may be signalled at read time and it would be good if
     SBCL did it.

6:
  bogus warnings about undefined functions for magic functions like
  SB!C::%%DEFUN and SB!C::%DEFCONSTANT when cross-compiling files
@@ -910,6 +916,11 @@ WORKAROUND:

     (see bug 203)

  c. (defun foo (x y)
       (locally (declare (type fixnum x y))
         (+ x (* 2 y))))
     (foo 1.1 2) => 5.1

194: "no error from (THE REAL '(1 2 3)) in some cases"
  fixed parts:
    a. In sbcl-0.7.7.9, 
+6 −3
Original line number Diff line number Diff line
@@ -1494,9 +1494,12 @@ changes in sbcl-0.7.12 relative to sbcl-0.7.11:
  * fixed bug 62: constraints were not propagated into a loop.
  * fixed bug in embedded calls of SORT (reported and investigated by
    Wolfgang Jenkner).
  * fixed bugs identified by Paul F. Dietz related to printing and
    reading of arrays with some dimensions having length 0.  (thanks
    to Gerd Moellmann)
  * fixed some bugs revealed by Paul Dietz' test suite:
    ** printing and reading of arrays with some dimensions having
       length 0 (thanks to Gerd Moellmann);
    ** BOA constructor with &AUX argument without a default value does
       not cause a type error;
    ** CONSTANTP now returns true for all self-evaluating objects.

planned incompatible changes in 0.7.x:
  * (not done yet, but planned:) When the profiling interface settles
+42 −3
Original line number Diff line number Diff line
@@ -42,9 +42,6 @@
    (length v)))

* IR1 does not optimize away (MAKE-LIST N).

* IR1 thinks that the type of V in (LENGTH V) is (OR LIST SIMPLE-VECTOR), not
  SIMPLE-VECTOR.
--------------------------------------------------------------------------------
(defun bar (v1 v2)
  (declare (optimize (speed 3) (safety 0) (space 2))
@@ -96,3 +93,45 @@ uses generic arithmetic
                (incf x)))))))
   (format t "~A~%" x)))
--------------------------------------------------------------------------------
(defun foo (x)
  (declare (optimize speed (debug 0)))
  (if (< x 0) x (foo (1- x))))

SBCL generates a full call of FOO (but CMUCL does not).
--------------------------------------------------------------------------------
(defun foo (d)
  (declare (optimize (speed 3) (safety 0) (debug 0)))
  (declare (type (double-float 0d0 1d0) d))
  (loop for i fixnum from 1 to 5
     for x1 double-float = (sin d) ;;; !!!
     do (loop for j fixnum from 1 to 4
             sum x1 double-float)))

Without the marked declaration Python will use boxed representation for X1.

This is equivalent to

(let ((x nil))
  (setq x 0d0)
  ;; use of X as DOUBLE-FLOAT
)

The initial binding is effectless, and without it X is of type
DOUBLE-FLOAT. Unhopefully, IR1 does not optimize away effectless
SETs/bindings, and IR2 does not perform type inference.
--------------------------------------------------------------------------------
(defun foo (x)
  (if (= (cond ((irgh x) 0)
               ((buh x) 1)
               (t 2))
         0)
      :yes
      :no))

This code could be optimized to

(defun foo (x)
  (cond ((irgh x) :yes)
        ((buh x) :no)
        (t :no)))
--------------------------------------------------------------------------------
+22 −15
Original line number Diff line number Diff line
@@ -1252,7 +1252,8 @@
		     `(setf (aref ,temp ,(cdr x))  ',(car x)))
		   (find-name-indices dd))
	 ,@(mapcar (lambda (dsd value)
		     `(setf (aref ,temp ,(dsd-index dsd)) ,value))
		     (unless (eq value '.do-not-initialize-slot.)
                         `(setf (aref ,temp ,(dsd-index dsd)) ,value)))
		   (dd-slots dd) values)
	 ,temp))))
(defun create-list-constructor (dd cons-name arglist vars types values)
@@ -1260,7 +1261,8 @@
    (dolist (x (find-name-indices dd))
      (setf (elt vals (cdr x)) `',(car x)))
    (loop for dsd in (dd-slots dd) and val in values do
      (setf (elt vals (dsd-index dsd)) val))
      (setf (elt vals (dsd-index dsd))
            (if (eq val '.do-not-initialize-slot.) 0 val)))

    `(defun ,cons-name ,arglist
       (declare ,@(mapcar (lambda (var type) `(type ,type ,var)) vars types))
@@ -1284,7 +1286,8 @@
		     ;; because the slot might be :READ-ONLY, so we
		     ;; whip up new LAMBDA representations of slot
		     ;; setters for the occasion.)
		     `(,(slot-setter-lambda-form dd dsd) ,value ,instance))
                     (unless (eq value '.do-not-initialize-slot.)
                       `(,(slot-setter-lambda-form dd dsd) ,value ,instance)))
		   (dd-slots dd)
		   values)
	 ,instance))))
@@ -1313,7 +1316,8 @@
      (parse-lambda-list (second boa))
    (collect ((arglist)
	      (vars)
	      (types))
	      (types)
              (skipped-vars))
      (labels ((get-slot (name)
		 (let ((res (find name (dd-slots defstruct)
				  :test #'string=
@@ -1383,18 +1387,21 @@
	(when auxp
	  (arglist '&aux)
	  (dolist (arg aux)
	    (let* ((arg (if (consp arg) arg (list arg)))
		   (var (first arg)))
            (arglist arg)
            (if (proper-list-of-length-p arg 2)
              (let ((var (first arg)))
                (vars var)
	      (types (get-slot var))))))
                (types (get-slot var)))
              (skipped-vars (if (consp arg) (first arg) arg))))))

      (funcall creator defstruct (first boa)
	       (arglist) (vars) (types)
	       (mapcar (lambda (slot)
               (loop for slot in (dd-slots defstruct)
                     for name = (dsd-name slot)
                     collect (if (find name (skipped-vars) :test #'string=)
                                 '.do-not-initialize-slot.
                                 (or (find (dsd-name slot) (vars) :test #'string=)
			     (dsd-default slot)))
		       (dd-slots defstruct))))))
                                     (dsd-default slot))))))))

;;; Grovel the constructor options, and decide what constructors (if
;;; any) to create.
+2 −7
Original line number Diff line number Diff line
@@ -127,22 +127,17 @@
  #!+sb-doc
  "True of any Lisp object that has a constant value: types that eval to
  themselves, keywords, constants, and list whose car is QUOTE."
  ;; FIXME: Should STRUCTURE-OBJECT and/or STANDARD-OBJECT be here?
  ;; They eval to themselves..
  ;;
  ;; FIXME: Someday it would be nice to make the code recognize foldable
  ;; functions and call itself recursively on their arguments, so that
  ;; more of the examples in the ANSI CL definition are recognized.
  ;; (e.g. (+ 3 2), (SQRT PI), and (LENGTH '(A B C)))
  (declare (ignore environment))
  (typecase object
    (number t)
    (character t)
    (array t)
    ;; (Note that the following test on INFO catches KEYWORDs as well as
    ;; explicitly DEFCONSTANT symbols.)
    (symbol (eq (info :variable :kind object) :constant))
    (list (eq (car object) 'quote))))
    (list (eq (car object) 'quote))
    (t t)))

(declaim (ftype (function (symbol &optional (or null sb!c::lexenv))) sb!xc:macro-function))
(defun sb!xc:macro-function (symbol &optional env)
Loading