Changeset 109
- Timestamp:
- Dec 12, 2003, 1:10:26 PM (21 years ago)
- Location:
- trunk/ccl/level-1
- Files:
-
- 2 edited
-
l1-clos-boot.lisp (modified) (12 diffs)
-
l1-clos.lisp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-clos-boot.lisp
r102 r109 990 990 991 991 (defparameter dcode-proto-alist 992 (list (cons #'%%reader-dcode-no-lexpr *gf-proto-one-arg*) 993 (cons #'%%writer-dcode-no-lexpr *gf-proto-two-arg*) 994 (cons #'%%one-arg-dcode *gf-proto-one-arg*) 992 (list (cons #'%%one-arg-dcode *gf-proto-one-arg*) 995 993 (cons #'%%1st-two-arg-dcode *gf-proto-two-arg*))) 996 994 … … 1008 1006 (logbitp $lfbits-aok-bit bits))) 1009 1007 multi-method-index 1010 min-index 1011 (only-readers t) 1012 (only-writers t) 1013 (can-optimize (if *compile-definitions* t nil)) 1014 ) 1008 min-index) 1015 1009 (when methods 1016 1010 (unless 0-args? 1017 1011 (dolist (m methods) 1018 (when can-optimize1019 (let ((method-class (class-of m)))1020 (unless (or (if (eq method-class *standard-reader-method-class*)1021 (progn (setq only-writers nil)1022 t)1023 (setq only-readers nil))1024 (if (eq method-class *standard-writer-method-class*)1025 t1026 (setq only-writers nil)))1027 (setq can-optimize nil))))1028 1012 (multiple-value-bind (mm-index index) (multi-method-index m) 1029 1013 (when mm-index … … 1035 1019 (let ((dcode (if 0-args? 1036 1020 #'%%0-arg-dcode 1037 (or (and can-optimize 1038 (cond (only-readers #'%%reader-dcode-no-lexpr) 1039 (only-writers #'%%writer-dcode-no-lexpr))) 1040 (if multi-method-index 1021 (or (if multi-method-index 1041 1022 #'%%nth-arg-dcode) 1042 1023 (if (null other-args?) … … 1534 1515 )) 1535 1516 1517 (defvar *standard-effective-slot-definition-class-wrapper* 1518 (%class.own-wrapper *standard-effective-slot-definition-class*)) 1536 1519 1537 1520 … … 1985 1968 (gvector :function 1986 1969 (uvref *reader-method-function-proto* 0) 1987 ( %slot-definition-name dslotd)1988 'slot- value1970 (ensure-slot-id (%slot-definition-name dslotd)) 1971 'slot-id-value 1989 1972 nil ;method-function name 1990 1973 (dpb 1 $lfbits-numreq (ash 1 $lfbits-method-bit)))) … … 1995 1978 (gvector :function 1996 1979 (uvref *writer-method-function-proto* 0) 1997 ( %slot-definition-name dslotd)1998 'set-slot- value1980 (ensure-slot-id (%slot-definition-name dslotd)) 1981 'set-slot-id-value 1999 1982 nil 2000 1983 (dpb 2 $lfbits-numreq (ash 1 $lfbits-method-bit)))) … … 2134 2117 (find name slots :key #'%slot-definition-name)) 2135 2118 2119 (defun %std-slot-value-using-class (instance slotd) 2120 (let* ((loc (standard-effective-slot-definition.location slotd))) 2121 (typecase loc 2122 (fixnum 2123 (standard-instance-instance-location-access instance loc)) 2124 (cons 2125 (let* ((val (%cdr loc))) 2126 (if (eq val (%slot-unbound-marker)) 2127 (slot-unbound (class-of instance) instance (standard-effective-slot-definition.name slotd)) 2128 val))) 2129 (t 2130 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2131 slotd loc (slot-definition-allocation slotd)))))) 2132 2136 2133 (defmethod slot-value-using-class ((class standard-class) 2137 2134 instance 2138 2135 (slotd standard-effective-slot-definition)) 2139 (if (eql 0 (%wrapper-instance-slots (instance.class-wrapper instance))) 2140 (progn 2141 (update-obsolete-instance instance) 2142 (slot-value instance (standard-effective-slot-definition.name slotd))) 2143 (let* ((loc (standard-effective-slot-definition.location slotd))) 2144 (typecase loc 2145 (fixnum 2146 (standard-instance-instance-location-access instance loc)) 2147 (cons 2148 (let* ((val (%cdr loc))) 2149 (if (eq val (%slot-unbound-marker)) 2150 (slot-unbound class instance (standard-effective-slot-definition.name slotd)) 2151 val))) 2152 (t 2153 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2154 slotd loc (slot-definition-allocation slotd))))))) 2155 2156 2136 (%std-slot-value-using-class instance slotd)) 2137 2138 (defun %maybe-std-slot-value-using-class (class instance slotd) 2139 (if (and (eql (typecode class) ppc32::subtag-instance) 2140 (eql (typecode slotd) ppc32::subtag-instance) 2141 (eq *standard-effective-slot-definition-class-wrapper* 2142 (instance.class-wrapper slotd)) 2143 (eq *standard-class-wrapper* (instance.class-wrapper class))) 2144 (%std-slot-value-using-class instance slotd) 2145 (slot-value-using-class class instance slotd))) 2146 2147 2148 2149 (defun %std-setf-slot-value-using-class (instance slotd new) 2150 (let* ((loc (standard-effective-slot-definition.location slotd)) 2151 (type (standard-effective-slot-definition.type slotd)) 2152 (type-predicate (standard-effective-slot-definition.type-predicate slotd))) 2153 (unless (or (eq new (%slot-unbound-marker)) 2154 (funcall type-predicate new)) 2155 (setq new (require-type new type))) 2156 (typecase loc 2157 (fixnum 2158 (setf 2159 (standard-instance-instance-location-access instance loc) new)) 2160 (cons 2161 (setf (%cdr loc) new)) 2162 (t 2163 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2164 slotd loc (slot-definition-allocation slotd)))))) 2165 2157 2166 (defmethod (setf slot-value-using-class) 2158 2167 (new … … 2160 2169 instance 2161 2170 (slotd standard-effective-slot-definition)) 2162 (if (eql 0 (%wrapper-instance-slots (instance.class-wrapper instance))) 2163 (progn 2164 (update-obsolete-instance instance) 2165 (setf (slot-value instance (standard-effective-slot-definition.name slotd)) new)) 2166 (let* ((loc (standard-effective-slot-definition.location slotd)) 2167 (type (standard-effective-slot-definition.type slotd))) 2168 (if (and type (not (eq type t))) 2169 (unless (or (eq new (%slot-unbound-marker)) 2170 (typep new type)) 2171 (setq new (require-type new type)))) 2172 (typecase loc 2173 (fixnum 2174 (setf 2175 (standard-instance-instance-location-access instance loc) new)) 2176 (cons 2177 (setf (%cdr loc) new)) 2178 (t 2179 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2180 slotd loc (slot-definition-allocation slotd))))))) 2171 (%std-setf-slot-value-using-class instance slotd new)) 2172 2173 2174 (defun %maybe-std-setf-slot-value-using-class (class instance slotd new) 2175 (if (and (eql (typecode class) ppc32::subtag-instance) 2176 (eql (typecode slotd) ppc32::subtag-instance) 2177 (eq *standard-effective-slot-definition-class-wrapper* 2178 (instance.class-wrapper slotd)) 2179 (eq *standard-class-wrapper* (instance.class-wrapper class))) 2180 (%std-setf-slot-value-using-class instance slotd new) 2181 (setf (slot-value-using-class class instance slotd) new))) 2181 2182 2182 2183 (defmethod slot-value-using-class ((class funcallable-standard-class) 2183 2184 instance 2184 2185 (slotd standard-effective-slot-definition)) 2185 (if (eql 0 (%wrapper-instance-slots (gf.instance.class-wrapper instance))) 2186 (progn 2187 (update-obsolete-instance instance) 2188 (slot-value instance (standard-effective-slot-definition.name slotd))) 2189 (let* ((loc (standard-effective-slot-definition.location slotd))) 2186 (let* ((loc (standard-effective-slot-definition.location slotd))) 2190 2187 (typecase loc 2191 2188 (fixnum … … 2198 2195 (t 2199 2196 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2200 slotd loc (slot-definition-allocation slotd)))))) )2197 slotd loc (slot-definition-allocation slotd)))))) 2201 2198 2202 2199 (defmethod (setf slot-value-using-class) … … 2205 2202 instance 2206 2203 (slotd standard-effective-slot-definition)) 2207 (if (eql 0 (%wrapper-instance-slots (gf.instance.class-wrapper instance))) 2208 (progn 2209 (update-obsolete-instance instance) 2210 (setf (slot-value instance (standard-effective-slot-definition.name slotd)) new)) 2211 (let* ((loc (standard-effective-slot-definition.location slotd)) 2204 (let* ((loc (standard-effective-slot-definition.location slotd)) 2212 2205 (type (standard-effective-slot-definition.type slotd))) 2213 2206 (if (and type (not (eq type t))) … … 2222 2215 (t 2223 2216 (error "Slot definition ~s has invalid location ~s (allocation ~s)." 2224 slotd loc (slot-definition-allocation slotd)))))) )2217 slotd loc (slot-definition-allocation slotd)))))) 2225 2218 2226 2219 … … 2415 2408 (%wrapper-instance-slots wrapper) 0 2416 2409 (%wrapper-forwarding-info wrapper) forwarding-info 2417 #| (%wrapper-slot-mapping-tables wrapper) 0 |# 2410 (%wrapper-slot-id->slotd wrapper) #'%slot-id-lookup-obsolete 2411 (%wrapper-slot-id-value wrapper) #'%slot-id-ref-obsolete 2412 (%wrapper-set-slot-id-value wrapper) #'%slot-id-set-obsolete 2418 2413 )))) 2419 2414 wrapper) -
trunk/ccl/level-1/l1-clos.lisp
r103 r109 72 72 (declare (ignore ignore)) 73 73 (if foundp 74 (if (consp loc) 75 (rplacd loc new-value) 76 (setf (standard-instance-instance-location-access instance loc) new-value)) 74 (progn 75 (unless (funcall (standard-effective-slot-definition.type-predicate slotd) new-value) 76 (report-bad-arg new-value (%slot-definition-type slotd))) 77 (if (consp loc) 78 (rplacd loc new-value) 79 (setf (standard-instance-instance-location-access instance loc) 80 new-value))) 77 81 (if (or (eq slot-names t) 78 82 (member (%slot-definition-name slotd) … … 87 91 (if initfunction 88 92 (let* ((newval (funcall initfunction))) 93 (unless (funcall (standard-effective-slot-definition.type-predicate slotd) new-value) 94 (report-bad-arg new-value (%slot-definition-type slotd))) 89 95 (if (consp loc) 90 96 (rplacd loc newval) … … 128 134 (%class.own-wrapper *standard-effective-slot-definition-class*) 129 135 name type initfunction initform initargs allocation 130 documentation class nil (ensure-slot-id name) )))136 documentation class nil (ensure-slot-id name) #'true))) 131 137 132 138 (defmethod class-slots ((class class))) … … 182 188 :initargs initargs 183 189 :initfunction (if initer (%slot-definition-initfunction initer)) 184 :initform (if initer (%slot-definition-initform initer))))) 190 :initform (if initer (%slot-definition-initform initer)) 191 :type (or (%slot-definition-type first) t)))) 185 192 186 193 (defmethod compute-slots ((class slots-class)) … … 326 333 (ash -1 $lfbits-noname-bit)))) 327 334 (class (%wrapper-class wrapper)) 328 (get-cell (list #'slot-value-using-class))329 335 (get-f (gvector :function 330 336 (%svref (if small … … 334 340 table 335 341 class 336 get-cell337 '%slot-id-ref-missing342 #'%maybe-std-slot-value-using-class 343 #'%slot-id-ref-missing 338 344 (dpb 2 $lfbits-numreq 339 345 (ash -1 $lfbits-noname-bit)))) 340 (set-cell (list #'(setf slot-value-using-class)))341 346 (set-f (gvector :function 342 347 (%svref (if small … … 346 351 table 347 352 class 348 set-cell349 '%slot-id-set-missing350 (dpb 2$lfbits-numreq353 #'%maybe-std-setf-slot-value-using-class 354 #'%slot-id-set-missing 355 (dpb 3 $lfbits-numreq 351 356 (ash -1 $lfbits-noname-bit))))) 352 357 (setf (%wrapper-slot-id->slotd wrapper) lookup-f 353 (%wrapper-class-svuc-effective-method-function wrapper) get-cell354 (%wrapper-class-ssvuc-effective-method-function wrapper) set-cell355 358 (%wrapper-slot-id-value wrapper) get-f 356 359 (%wrapper-set-slot-id-value wrapper) set-f … … 987 990 :readers (slot-definition-location)) 988 991 (:name slot-id :initform nil :initfunction ,#'false 989 :readers (slot-definition-slot-id))) 992 :readers (slot-definition-slot-id)) 993 (:name type-predicate :initform #'true 994 :initfunction ,#'(lambda () #'true) 995 :readers (slot-definition-predicate)) 996 ) 990 997 991 998 :primary-p t) … … 995 1002 :direct-superclasses '(slot-definition) 996 1003 ) 1004 1005 1006 1007 997 1008 998 1009
Note:
See TracChangeset
for help on using the changeset viewer.
