X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=fbadfe9e11814f2a9a60d693cf7863e087d6dada;hb=a4ea3949e051d8c9248b231f175d54a20618743e;hp=7dd538f603f811b06241b64f0839337b866733d0;hpb=d76dbf51c6184eea35a98758df312ae031b24d6f;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 7dd538f..fbadfe9 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2694,6 +2694,17 @@ (assert (eq 'list type)) (assert derivedp))) +(with-test (:name :rest-list-type-derivation4) + (multiple-value-bind (type derivedp) + (funcall (funcall (compile nil `(lambda () + (lambda (&optional x &rest args) + (declare (type (or null integer) x)) + (when x (setf args x)) + (ctu:compiler-derived-type args))))) + 42) + (assert (equal '(or cons null integer) type)) + (assert derivedp))) + (with-test (:name :base-char-typep-elimination) (assert (eq (funcall (lambda (ch) (declare (type base-char ch) (optimize (speed 3) (safety 0))) @@ -3644,3 +3655,29 @@ (assert (equal (with-output-to-string (*standard-output*) (funcall fun t)) "(1 2)T")))) + +(with-test (:name :constant-concatenate-compile-time) + (flet ((make-lambda (n) + `(lambda (x) + (declare (optimize (speed 3) (space 0))) + (concatenate 'string x ,(make-string n))))) + (let* ((l0 (make-lambda 1)) + (l1 (make-lambda 10)) + (l2 (make-lambda 100)) + (l3 (make-lambda 1000)) + (t0 (get-internal-run-time)) + (f0 (compile nil l0)) + (t1 (get-internal-run-time)) + (f1 (compile nil l1)) + (t2 (get-internal-run-time)) + (f2 (compile nil l2)) + (t3 (get-internal-run-time)) + (f3 (compile nil l3)) + (t4 (get-internal-run-time)) + (d0 (- t1 t0)) + (d1 (- t2 t1)) + (d2 (- t3 t2)) + (d3 (- t4 t3)) + (short-avg (/ (+ d0 d1 d2) 3))) + (assert (and f1 f2 f3)) + (assert (< d3 (* 10 short-avg))))))