Changeset 297


Ignore:
Timestamp:
Jan 15, 2004, 12:18:32 AM (21 years ago)
Author:
Gary Byers
Message:

Bump up the (global) type-cache size. Fixes in CLASS type methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-typesys.lisp

    r279 r297  
    13661366
    13671367(eval-when (:compile-toplevel :execute)
    1368   (defconstant type-cache-size (ash 1 7))
     1368  (defconstant type-cache-size (ash 1 12))
    13691369  (defconstant type-cache-mask (1- type-cache-size)))
    13701370
     
    32233223      (values nil t))))
    32243224
     3225(defun find-class-intersection (c1 c2)
     3226  (labels ((walk-subclasses (class f)
     3227             (dolist (sub (class-direct-subclasses class))
     3228               (walk-subclasses sub f))
     3229             (funcall f class)))
     3230    (let* ((intersection nil))
     3231      (walk-subclasses c1 #'(lambda (c)
     3232                              (when (subclassp c c2)
     3233                                (pushnew (%class.ctype c) intersection))))
     3234      (when intersection
     3235        (%type-union intersection)))))
     3236
    32253237(define-type-method (class :simple-intersection) (type1 type2)
    32263238  (assert (not (eq type1 type2)))
     
    32293241    (if (and class1 class2)
    32303242      (cond ((subclassp class1 class2)
    3231              (values type1 t))
     3243             type1)
    32323244            ((subclassp class2 class1)
    3233              (values type2 t))
    3234             (t (values nil t)))
    3235       (values nil t))))
     3245             type2)
     3246            ;;; In the STANDARD-CLASS case where neither's
     3247            ;;; a subclass of the other, there may be
     3248            ;;; one or mor classes that're a subclass of both.  We
     3249            ;;; -could- try to find all such classes, but
     3250            ;;; punt instead.
     3251            (t (if (and (typep class1 'standard-class)
     3252                        (typep class2 'standard-class))
     3253                 (find-class-intersection class1 class2)
     3254                 *empty-type*)))
     3255      nil)))
     3256
     3257(define-type-method (class :complex-subtypep-arg2) (type1 class2)
     3258  (if (and (intersection-ctype-p type1)
     3259           (> (count-if #'class-ctype-p (intersection-ctype-types type1)) 1))
     3260      (values nil nil)
     3261      (invoke-complex-subtypep-arg1-method type1 class2 nil t)))
     3262
     3263(define-type-method (class :complex-subtypep-arg1) (type1 type2)
     3264  (if (and (function-ctype-p type2)
     3265           (eq type1 (specifier-type 'function))
     3266           (function-ctype-wild-args type2)
     3267           (eq *wild-type* (function-ctype-returns type2)))
     3268      (values t t)
     3269      (values nil t)))
    32363270
    32373271(define-type-method (class :unparse) (type)
Note: See TracChangeset for help on using the changeset viewer.