X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.impure.lisp;h=bda6fb383a6a26830cca26020299896049eb77a8;hb=58513220fcf87e161a5e0d3fbadd76c45f27d584;hp=06f52a51603237c96f5e634285a47e24aaa4a617;hpb=b402bbba90ce3b8b90683a09f36568d9dc8d7ba9;p=sbcl.git diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index 06f52a5..bda6fb3 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -618,7 +618,7 @@ (assert (equal (check-embedded-thes 3 0 2 :a) '(2 :a))) (assert (typep (check-embedded-thes 3 0 4 2.5f0) 'type-error)) -(assert (equal (check-embedded-thes 1 0 4 :b) '(4 :b))) +(assert (equal (check-embedded-thes 1 0 3 :b) '(3 :b))) (assert (typep (check-embedded-thes 1 0 1.0 2.5f0) 'type-error)) @@ -1084,6 +1084,21 @@ (assert (equal "GOOD!" (progv '(*hairy-progv-var*) (list (eval "GOOD!")) *hairy-progv-var*)))) + +(with-test (:name :fill-complex-single-float) + (assert (every (lambda (x) (eql x #c(-1.0 -2.0))) + (funcall + (lambda () + (make-array 2 + :element-type '(complex single-float) + :initial-element #c(-1.0 -2.0))))))) + +(with-test (:name :make-array-symbol-as-initial-element) + (assert (every (lambda (x) (eq x 'a)) + (funcall + (compile nil + `(lambda () + (make-array 12 :initial-element 'a))))))) ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself @@ -1835,4 +1850,27 @@ (setf *mystery* :mystery) (assert (eq :ok (test-mystery (make-thing :slot :mystery)))) +;;; optimizing make-array +(defun count-code-callees (f) + (let ((code (sb-kernel:fun-code-header f)) + (n 0)) + (loop for i from sb-vm::code-constants-offset below (sb-kernel:get-header-data code) + for c = (sb-kernel:code-header-ref code i) + do (when (typep c 'fdefn) + (print c) + (incf n))) + n)) +(assert (zerop (count-code-callees + (compile nil + `(lambda (x y z) + (make-array '(3) :initial-contents (list x y z))))))) +(assert (zerop (count-code-callees + (compile nil + `(lambda (x y z) + (make-array '3 :initial-contents (vector x y z))))))) +(assert (zerop (count-code-callees + (compile nil + `(lambda (x y z) + (make-array '3 :initial-contents `(,x ,y ,z))))))) + ;;; success