X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fcheckgen.lisp;h=3441ad69af727571dd733285a7e80842de2dc057;hb=b5703d98da9ebfd688c87e14862ab4e26dc94d14;hp=2a91eda8c9b1180ff47b97c6dc69467a12381669;hpb=77360ee4a1f94c41b807be7ad0e8687199fceef1;p=sbcl.git diff --git a/src/compiler/checkgen.lisp b/src/compiler/checkgen.lisp index 2a91eda..3441ad6 100644 --- a/src/compiler/checkgen.lisp +++ b/src/compiler/checkgen.lisp @@ -52,11 +52,8 @@ (+ (function-cost found) (function-cost 'eq)) nil)))) (typecase type - (union-type - (collect ((res 0 +)) - (dolist (mem (union-type-types type)) - (res (type-test-cost mem))) - (res))) + (compound-type + (reduce #'+ (compound-type-types type) :key 'type-test-cost)) (member-type (* (length (member-type-members type)) (function-cost 'eq))) @@ -90,7 +87,9 @@ (defun maybe-weaken-check (type cont) (declare (type ctype type) (type continuation cont)) (cond ((policy (continuation-dest cont) - (<= speed safety) (<= space safety) (<= cspeed safety)) + (and (<= speed safety) + (<= space safety) + (<= compilation-speed safety))) type) (t (let ((min-cost (type-test-cost type)) @@ -215,7 +214,7 @@ (declare (type continuation cont)) (let ((type (continuation-asserted-type cont)) (dest (continuation-dest cont))) - (assert (not (eq type *wild-type*))) + (aver (not (eq type *wild-type*))) (multiple-value-bind (types count) (no-function-values-types type) (cond ((not (eq count :unknown)) (if (or (exit-p dest) @@ -228,7 +227,7 @@ (maybe-negate-check cont types nil))) ((and (mv-combination-p dest) (eq (basic-combination-kind dest) :local)) - (assert (values-type-p type)) + (aver (values-type-p type)) (maybe-negate-check cont (args-type-optional type) nil)) (t (values :too-hairy nil)))))) @@ -247,7 +246,9 @@ ;;; We must only return NIL when it is *certain* that a check will not ;;; be done, since if we pass up this chance to do the check, it will ;;; be too late. The penalty for being too conservative is duplicated -;;; type checks. +;;; type checks. The penalty for erring by being too speculative is +;;; much nastier, e.g. falling through without ever being able to find +;;; an appropriate VOP. ;;; ;;; If there is a compile-time type error, then we always return true ;;; unless the DEST is a full call. With a full call, the theory is @@ -276,7 +277,7 @@ ((function-info-ir2-convert kind) t) (t (dolist (template (function-info-templates kind) nil) - (when (eq (template-policy template) :fast-safe) + (when (eq (template-ltn-policy template) :fast-safe) (multiple-value-bind (val win) (valid-function-use dest (template-type template)) (when (or val (not win)) (return t))))))))) @@ -352,7 +353,7 @@ (ir1-convert new-start dummy (make-type-check-form types)) ;; TO DO: Why should this be true? -- WHN 19990601 - (assert (eq (continuation-block dummy) new-block)) + (aver (eq (continuation-block dummy) new-block)) ;; KLUDGE: Comments at the head of this function in CMU CL ;; said that somewhere in here we @@ -384,7 +385,7 @@ (let* ((node (continuation-use cont)) (args (basic-combination-args node)) (victim (first args))) - (assert (and (= (length args) 1) + (aver (and (= (length args) 1) (eq (constant-value (ref-leaf (continuation-use victim))) @@ -483,10 +484,10 @@ (unless (member type-check '(nil :error :deleted)) (let ((atype (continuation-asserted-type cont))) (do-uses (use cont) - (unless (values-types-intersect (node-derived-type use) - atype) + (unless (values-types-equal-or-intersect + (node-derived-type use) atype) (mark-error-continuation cont) - (unless (policy node (= brevity 3)) + (unless (policy node (= inhibit-warnings 3)) (do-type-warning use)))))) (when (and (eq type-check t) (not *byte-compiling*)) @@ -504,7 +505,7 @@ (:too-hairy (let* ((context (continuation-dest cont)) (*compiler-error-context* context)) - (when (policy context (>= safety brevity)) + (when (policy context (>= safety inhibit-warnings)) (compiler-note "type assertion too complex to check:~% ~S." (type-specifier (continuation-asserted-type cont)))))