From: Paul Khuong Date: Tue, 12 Oct 2010 04:52:24 +0000 (+0000) Subject: 1.0.43.46: Simplify some type tests to EQL comparisons X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=2dfaffe8bdce30dac9b5baa4d2645d074a176b4f;p=sbcl.git 1.0.43.46: Simplify some type tests to EQL comparisons * When the type to test is a singleton type, check for EQLity against the one value inhabiting that type. --- diff --git a/src/compiler/typetran.lisp b/src/compiler/typetran.lisp index c1f818d..4f1fa05 100644 --- a/src/compiler/typetran.lisp +++ b/src/compiler/typetran.lisp @@ -81,7 +81,14 @@ ((eq type *empty-type*) nil) (t - (give-up-ir1-transform))))) + (let ((intersect (type-intersection2 type otype))) + (unless intersect + (give-up-ir1-transform)) + (multiple-value-bind (constantp value) + (type-singleton-p intersect) + (if constantp + `(eql object ',value) + (give-up-ir1-transform)))))))) ;;; Flush %TYPEP tests whose result is known at compile time. (deftransform %typep ((object type)) @@ -554,6 +561,9 @@ (or (when (not ctype) (compiler-warn "illegal type specifier for TYPEP: ~S" type) (return-from source-transform-typep (values nil t))) + (multiple-value-bind (constantp value) (type-singleton-p ctype) + (and constantp + `(eql ,object ',value))) (let ((pred (cdr (assoc ctype *backend-type-predicates* :test #'type=)))) (when pred `(,pred ,object))) diff --git a/version.lisp-expr b/version.lisp-expr index c3b6308..b1d24d0 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.43.45" +"1.0.43.46"