1 ;;;; bootstrapping the meta-braid
3 ;;;; The code in this file takes the early definitions that have been
4 ;;;; saved up and actually builds those class objects. This work is
5 ;;;; largely driven off of those class definitions, but the fact that
6 ;;;; STANDARD-CLASS is the class of all metaclasses in the braid is
7 ;;;; built into this code pretty deeply.
9 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; more information.
12 ;;;; This software is derived from software originally released by Xerox
13 ;;;; Corporation. Copyright and release statements follow. Later modifications
14 ;;;; to the software are in the public domain and are provided with
15 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
18 ;;;; copyright information from original PCL sources:
20 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
21 ;;;; All rights reserved.
23 ;;;; Use and copying of this software and preparation of derivative works based
24 ;;;; upon this software are permitted. Any distribution of this software or
25 ;;;; derivative works must comply with all applicable United States export
28 ;;;; This software is made available AS IS, and Xerox Corporation makes no
29 ;;;; warranty about the software, its performance or its conformity to any
34 (defun allocate-standard-instance (wrapper
35 &optional
(slots-init nil slots-init-p
))
36 (let ((instance (%make-standard-instance nil
0))
37 (no-of-slots (wrapper-no-of-instance-slots wrapper
)))
38 (setf (std-instance-wrapper instance
) wrapper
)
39 (setf (std-instance-slots instance
)
41 ;; Inline the slots vector allocation and initialization.
42 (let ((slots (make-array no-of-slots
:initial-element
0)))
43 (do ((rem-slots slots-init
(rest rem-slots
))
45 ((>= i no-of-slots
)) ;endp rem-slots))
46 (declare (list rem-slots
)
48 (setf (aref slots i
) (first rem-slots
)))
51 (make-array no-of-slots
52 :initial-element
+slot-unbound
+))))
55 (defmacro allocate-standard-funcallable-instance-slots
56 (wrapper &optional slots-init-p slots-init
)
57 `(let ((no-of-slots (wrapper-no-of-instance-slots ,wrapper
)))
60 (make-array no-of-slots
:initial-contents
,slots-init
)
61 (make-array no-of-slots
:initial-element
+slot-unbound
+))
62 `(make-array no-of-slots
:initial-element
+slot-unbound
+))))
64 (define-condition unset-funcallable-instance-function
65 (reference-condition simple-error
)
68 :references
(list '(:amop
:generic-function allocate-instance
)
69 '(:amop
:function set-funcallable-instance-function
))))
71 (defun allocate-standard-funcallable-instance
72 (wrapper &optional
(slots-init nil slots-init-p
))
73 (let ((fin (%make-standard-funcallable-instance
74 nil
(sb-impl::new-instance-hash-code
))))
75 (set-funcallable-instance-function
77 #'(lambda (&rest args
)
78 (declare (ignore args
))
79 (error 'unset-funcallable-instance-function
80 :format-control
"~@<The function of funcallable instance ~
81 ~S has not been set.~@:>"
82 :format-arguments
(list fin
))))
83 (setf (fsc-instance-wrapper fin
) wrapper
84 (fsc-instance-slots fin
)
85 (allocate-standard-funcallable-instance-slots
86 wrapper slots-init-p slots-init
))
89 (defun classify-slotds (slotds)
90 (let (instance-slots class-slots custom-slots bootp
)
91 (dolist (slotd slotds
)
92 (let ((alloc (cond ((consp slotd
) ; bootstrap
96 (slot-definition-allocation slotd
)))))
99 (push slotd instance-slots
))
101 (push slotd class-slots
))
103 (push slotd custom-slots
)))))
105 (nreverse instance-slots
)
107 (sort instance-slots
#'< :key
#'slot-definition-location
)))
111 ;;;; BOOTSTRAP-META-BRAID
113 ;;;; This function builds the base metabraid from the early class definitions.
115 (defmacro !initial-classes-and-wrappers
(&rest classes
)
117 ,@(mapcar (lambda (class)
118 (let ((wr (format-symbol *pcl-package
* "~A-WRAPPER" class
)))
119 `(setf ,wr
,(if (eq class
'standard-generic-function
)
122 (early-class-size ',class
)
124 ,class
(allocate-standard-instance
125 ,(if (eq class
'standard-generic-function
)
126 'funcallable-standard-class-wrapper
127 'standard-class-wrapper
))
128 (wrapper-class ,wr
) ,class
129 (find-class ',class
) ,class
)))
132 (defun !wrapper-p
(x) (and (sb-kernel::layout-p x
) (layout-for-std-class-p x
)))
134 (defun !bootstrap-meta-braid
()
135 (let* ((*create-classes-from-internal-structure-definitions-p
* nil
)
136 standard-class-wrapper standard-class
137 funcallable-standard-class-wrapper funcallable-standard-class
138 slot-class-wrapper slot-class
139 system-class-wrapper system-class
140 built-in-class-wrapper built-in-class
141 structure-class-wrapper structure-class
142 condition-class-wrapper condition-class
143 standard-direct-slot-definition-wrapper
144 standard-direct-slot-definition
145 standard-effective-slot-definition-wrapper
146 standard-effective-slot-definition
147 class-eq-specializer-wrapper class-eq-specializer
148 standard-generic-function-wrapper standard-generic-function
)
149 (!initial-classes-and-wrappers
150 standard-class funcallable-standard-class
151 slot-class system-class built-in-class structure-class condition-class
152 standard-direct-slot-definition standard-effective-slot-definition
153 class-eq-specializer standard-generic-function
)
154 ;; First, make a class metaobject for each of the early classes. For
155 ;; each metaobject we also set its wrapper. Except for the class T,
156 ;; the wrapper is always that of STANDARD-CLASS.
157 (dolist (definition *early-class-definitions
*)
158 (let* ((name (ecd-class-name definition
))
159 (meta (ecd-metaclass definition
))
161 (slot-class slot-class-wrapper
)
162 (standard-class standard-class-wrapper
)
163 (funcallable-standard-class
164 funcallable-standard-class-wrapper
)
165 (built-in-class built-in-class-wrapper
)
166 (system-class system-class-wrapper
)
167 (structure-class structure-class-wrapper
)
168 (condition-class condition-class-wrapper
)))
169 (class (or (find-class name nil
)
170 (allocate-standard-instance wrapper
))))
171 (setf (find-class name
) class
)))
172 (dolist (definition *early-class-definitions
*)
173 (let ((name (ecd-class-name definition
))
174 (meta (ecd-metaclass definition
))
175 (source (ecd-source-location definition
))
176 (direct-supers (ecd-superclass-names definition
))
177 (direct-slots (ecd-canonical-slots definition
))
178 (other-initargs (ecd-other-initargs definition
)))
179 (let ((direct-default-initargs
180 (getf other-initargs
:direct-default-initargs
)))
181 (multiple-value-bind (slots cpl default-initargs direct-subclasses
)
182 (early-collect-inheritance name
)
183 (let* ((class (find-class name
))
184 (wrapper (cond ((eq class slot-class
)
186 ((eq class standard-class
)
187 standard-class-wrapper
)
188 ((eq class funcallable-standard-class
)
189 funcallable-standard-class-wrapper
)
190 ((eq class standard-direct-slot-definition
)
191 standard-direct-slot-definition-wrapper
)
193 standard-effective-slot-definition
)
194 standard-effective-slot-definition-wrapper
)
195 ((eq class system-class
) system-class-wrapper
)
196 ((eq class built-in-class
)
197 built-in-class-wrapper
)
198 ((eq class structure-class
)
199 structure-class-wrapper
)
200 ((eq class condition-class
)
201 condition-class-wrapper
)
202 ((eq class class-eq-specializer
)
203 class-eq-specializer-wrapper
)
204 ((eq class standard-generic-function
)
205 standard-generic-function-wrapper
)
207 (!boot-make-wrapper
(length slots
) name
))))
209 (set (make-class-symbol name
) class
)
211 (unless (eq (getf slot
:allocation
:instance
) :instance
)
212 (error "Slot allocation ~S is not supported in bootstrap."
213 (getf slot
:allocation
))))
215 (when (!wrapper-p wrapper
)
216 (setf (layout-slot-list wrapper
) slots
))
218 (setq proto
(if (eq meta
'funcallable-standard-class
)
219 (allocate-standard-funcallable-instance wrapper
)
220 (allocate-standard-instance wrapper
)))
223 (!bootstrap-make-slot-definitions
224 name class direct-slots
225 standard-direct-slot-definition-wrapper nil
))
227 (!bootstrap-make-slot-definitions
229 standard-effective-slot-definition-wrapper t
))
231 (setf (layout-slot-table wrapper
) (make-slot-table class slots t
))
232 (when (!wrapper-p wrapper
)
233 (setf (layout-slot-list wrapper
) slots
))
236 ((standard-class funcallable-standard-class
)
237 (!bootstrap-initialize-class
239 class name class-eq-specializer-wrapper source
240 direct-supers direct-subclasses cpl wrapper proto
241 direct-slots slots direct-default-initargs default-initargs
))
242 (built-in-class ; *the-class-t*
243 (!bootstrap-initialize-class
245 class name class-eq-specializer-wrapper source
246 direct-supers direct-subclasses cpl wrapper proto
))
248 (!bootstrap-initialize-class
250 class name class-eq-specializer-wrapper source
251 direct-supers direct-subclasses cpl wrapper proto
))
252 (slot-class ; *the-class-slot-object*
253 (!bootstrap-initialize-class
255 class name class-eq-specializer-wrapper source
256 direct-supers direct-subclasses cpl wrapper proto
))
257 (structure-class ; *the-class-structure-object*
258 (!bootstrap-initialize-class
260 class name class-eq-specializer-wrapper source
261 direct-supers direct-subclasses cpl wrapper
))
263 (!bootstrap-initialize-class
265 class name class-eq-specializer-wrapper source
266 direct-supers direct-subclasses cpl wrapper
))))))))
268 (setq **standard-method-classes
**
269 (mapcar (lambda (name)
270 (symbol-value (make-class-symbol name
)))
271 *standard-method-class-names
*))
273 (let* ((smc-class (find-class 'standard-method-combination
))
274 (smc-wrapper (!bootstrap-get-slot
'standard-class
277 (smc (allocate-standard-instance smc-wrapper
)))
278 (flet ((set-slot (name value
)
279 (!bootstrap-set-slot
'standard-method-combination
283 (set-slot 'source nil
)
284 (set-slot 'type-name
'standard
)
285 (set-slot '%documentation
"The standard method combination.")
286 (set-slot 'options
()))
287 (setq *standard-method-combination
* smc
))))
289 ;;; Initialize a class metaobject.
290 (defun !bootstrap-initialize-class
291 (metaclass-name class name
292 class-eq-wrapper source direct-supers direct-subclasses cpl wrapper
295 direct-slots slots direct-default-initargs default-initargs
)
296 (flet ((classes (names) (mapcar #'find-class names
))
297 (set-slot (slot-name value
)
298 (!bootstrap-set-slot metaclass-name class slot-name value
)))
299 (set-slot 'name name
)
300 (set-slot 'finalized-p t
)
301 (set-slot 'source source
)
302 (set-slot 'safe-p nil
)
303 (set-slot '%type
(if (eq class
(find-class t
))
305 ;; FIXME: Could this just be CLASS instead
306 ;; of `(CLASS ,CLASS)? If not, why not?
307 ;; (See also similar expression in
308 ;; SHARED-INITIALIZE :BEFORE (CLASS).)
310 (set-slot 'class-eq-specializer
311 (let ((spec (allocate-standard-instance class-eq-wrapper
)))
312 (!bootstrap-set-slot
'class-eq-specializer spec
'%type
314 (!bootstrap-set-slot
'class-eq-specializer spec
'object
317 (set-slot '%class-precedence-list
(classes cpl
))
318 (set-slot 'cpl-available-p t
)
319 (set-slot 'can-precede-list
(classes (cdr cpl
)))
320 (set-slot 'incompatible-superclass-list nil
)
321 (set-slot 'direct-superclasses
(classes direct-supers
))
322 (set-slot 'direct-subclasses
(classes direct-subclasses
))
323 (set-slot 'direct-methods
(cons nil nil
))
324 (set-slot 'wrapper wrapper
)
325 (set-slot '%documentation nil
)
327 `(,@(and direct-default-initargs
328 `(direct-default-initargs ,direct-default-initargs
))
329 ,@(and default-initargs
330 `(default-initargs ,default-initargs
))))
331 (when (memq metaclass-name
'(standard-class funcallable-standard-class
332 structure-class condition-class
334 (set-slot 'direct-slots direct-slots
)
335 (set-slot 'slots slots
)
336 (setf (layout-slot-table wrapper
)
337 (make-slot-table class slots
338 (member metaclass-name
339 '(standard-class funcallable-standard-class
))))
340 (when (!wrapper-p wrapper
)
341 (setf (layout-slot-list wrapper
) slots
)))
343 ;; For all direct superclasses SUPER of CLASS, make sure CLASS is
344 ;; a direct subclass of SUPER. Note that METACLASS-NAME doesn't
345 ;; matter here for the slot DIRECT-SUBCLASSES, since every class
346 ;; inherits the slot from class CLASS.
347 (dolist (super direct-supers
)
348 (let* ((super (find-class super
))
349 (subclasses (!bootstrap-get-slot metaclass-name super
350 'direct-subclasses
)))
351 (cond ((eq +slot-unbound
+ subclasses
)
352 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
354 ((not (memq class subclasses
))
355 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
356 (cons class subclasses
))))))
360 (let ((constructor-sym '|STRUCTURE-OBJECT class constructor|
))
361 (set-slot 'defstruct-form
362 `(defstruct (structure-object (:constructor
365 (set-slot 'defstruct-constructor constructor-sym
)
366 (set-slot 'from-defclass-p t
)
367 (set-slot 'plist nil
)
368 (set-slot 'prototype
(funcall constructor-sym
))))
370 (set-slot 'prototype
(make-condition name
)))
373 (if proto-p proto
(allocate-standard-instance wrapper
)))))
376 (defun !bootstrap-make-slot-definitions
(name class slots wrapper effective-p
)
378 (mapcar (lambda (slot)
380 (!bootstrap-make-slot-definition
381 name class slot wrapper effective-p index
))
384 (defun !bootstrap-make-slot-definition
385 (name class slot wrapper effective-p index
)
386 (let* ((slotd-class-name (if effective-p
387 'standard-effective-slot-definition
388 'standard-direct-slot-definition
))
389 (slotd (allocate-standard-instance wrapper
))
390 (slot-name (getf slot
:name
)))
391 (flet ((get-val (name) (getf slot name
))
393 (!bootstrap-set-slot slotd-class-name slotd name val
)))
394 (set-val 'name slot-name
)
395 (set-val 'initform
(get-val :initform
))
396 (set-val 'initfunction
(get-val :initfunction
))
397 (set-val 'initargs
(get-val :initargs
))
399 (set-val 'readers
(get-val :readers
))
400 (set-val 'writers
(get-val :writers
)))
401 (set-val 'allocation
:instance
)
402 (set-val '%type
(or (get-val :type
) t
))
403 (set-val '%documentation
(or (get-val :documentation
) ""))
404 (set-val '%class class
)
406 (set-val 'location index
)
407 (set-val 'accessor-flags
7)
412 (make-optimized-std-reader-method-function nil nil slot-name index
)
414 (make-optimized-std-writer-method-function nil nil slot-name index
)
416 (make-optimized-std-boundp-method-function nil nil slot-name index
))))
417 (when (and (eq name
'standard-class
)
418 (eq slot-name
'slots
) effective-p
)
419 (setq *the-eslotd-standard-class-slots
* slotd
))
420 (when (and (eq name
'funcallable-standard-class
)
421 (eq slot-name
'slots
) effective-p
)
422 (setq *the-eslotd-funcallable-standard-class-slots
* slotd
))
425 (defun !bootstrap-accessor-definitions
(early-p)
426 (let ((*early-p
* early-p
))
427 (dolist (definition *early-class-definitions
*)
428 (let ((name (ecd-class-name definition
))
429 (meta (ecd-metaclass definition
)))
430 (unless (or (eq meta
'built-in-class
) (eq meta
'system-class
))
431 (let ((direct-slots (ecd-canonical-slots definition
)))
432 (dolist (slotd direct-slots
)
433 (let ((slot-name (getf slotd
:name
))
434 (readers (getf slotd
:readers
))
435 (writers (getf slotd
:writers
)))
436 (!bootstrap-accessor-definitions1
442 (ecd-source-location definition
))))))))))
444 (defun !bootstrap-accessor-definition
(class-name accessor-name slot-name type source-location
)
445 (multiple-value-bind (accessor-class make-method-function arglist specls doc
)
447 (reader (values 'standard-reader-method
448 #'make-std-reader-method-function
451 "automatically generated reader method"))
452 (writer (values 'standard-writer-method
453 #'make-std-writer-method-function
454 (list 'new-value class-name
)
456 "automatically generated writer method"))
457 (boundp (values 'standard-boundp-method
458 #'make-std-boundp-method-function
461 "automatically generated boundp method")))
462 (let ((gf (ensure-generic-function accessor-name
:lambda-list arglist
)))
463 (if (find specls
(early-gf-methods gf
)
464 :key
#'early-method-specializers
466 (unless (assoc accessor-name
*!generic-function-fixups
*
470 (make-a-method accessor-class
473 (funcall make-method-function
474 class-name slot-name
)
477 :object-class class-name
478 :method-class-function
(constantly (find-class accessor-class
))
479 :definition-source source-location
))))))
481 (defun !bootstrap-accessor-definitions1
(class-name
487 (flet ((do-reader-definition (reader)
488 (!bootstrap-accessor-definition class-name
493 (do-writer-definition (writer)
494 (!bootstrap-accessor-definition class-name
499 (do-boundp-definition (boundp)
500 (!bootstrap-accessor-definition class-name
505 (dolist (reader readers
) (do-reader-definition reader
))
506 (dolist (writer writers
) (do-writer-definition writer
))
507 (dolist (boundp boundps
) (do-boundp-definition boundp
))))
509 (defun !bootstrap-built-in-classes
()
511 ;; First make sure that all the supers listed in
512 ;; *BUILT-IN-CLASS-LATTICE* are themselves defined by
513 ;; *BUILT-IN-CLASS-LATTICE*. This is just to check for typos and
514 ;; other sorts of brainos. (The exceptions, T and SEQUENCE, are
515 ;; those classes which are SYSTEM-CLASSes which nevertheless have
516 ;; BUILT-IN-CLASS subclasses.)
517 (dolist (e *built-in-classes
*)
518 (dolist (super (cadr e
))
519 (unless (or (eq super t
)
521 (assq super
*built-in-classes
*))
522 (error "in *BUILT-IN-CLASSES*: ~S has ~S as a super,~%~
523 but ~S is not itself a class in *BUILT-IN-CLASSES*."
524 (car e
) super super
))))
526 ;; In the first pass, we create a skeletal object to be bound to the
528 (let* ((built-in-class (find-class 'built-in-class
))
529 (built-in-class-wrapper (class-wrapper built-in-class
)))
530 (dolist (e *built-in-classes
*)
531 (let ((class (allocate-standard-instance built-in-class-wrapper
)))
532 (setf (find-class (car e
)) class
))))
534 ;; In the second pass, we initialize the class objects.
535 (let ((class-eq-wrapper (class-wrapper (find-class 'class-eq-specializer
))))
536 (dolist (e *built-in-classes
*)
537 (destructuring-bind (name supers subs cpl prototype
) e
538 (let* ((class (find-class name
))
539 (lclass (find-classoid name
))
540 (wrapper (classoid-layout lclass
)))
541 (set (get-built-in-class-symbol name
) class
)
542 (setf (classoid-pcl-class lclass
) class
)
544 (!bootstrap-initialize-class
'built-in-class class
545 name class-eq-wrapper nil
548 wrapper prototype
))))))
551 (declare (explicit-check))
552 (wrapper-class* (layout-of x
)))
554 (defun eval-form (form)
555 (lambda () (eval form
)))
557 (defun ensure-non-standard-class (name classoid
&optional existing-class
)
559 ((ensure (metaclass slots
)
560 (let ((supers (mapcar #'classoid-name
(classoid-direct-superclasses classoid
))))
561 (ensure-class-using-class existing-class name
562 :metaclass metaclass
:name name
563 :direct-superclasses supers
564 :direct-slots slots
)))
565 (slot-initargs-from-structure-slotd (slotd)
566 (let ((accessor (structure-slotd-accessor-symbol slotd
)))
567 `(:name
,(structure-slotd-name slotd
)
568 :defstruct-accessor-symbol
,accessor
569 :internal-reader-function
,(structure-slotd-reader-function slotd
)
570 :internal-writer-function
,(structure-slotd-writer-function name slotd
)
571 :type
,(or (structure-slotd-type slotd
) t
)
572 :initform
,(structure-slotd-init-form slotd
)
573 :initfunction
,(eval-form (structure-slotd-init-form slotd
)))))
574 (slot-initargs-from-condition-slot (slot)
575 `(:name
,(condition-slot-name slot
)
576 :initargs
,(condition-slot-initargs slot
)
577 :readers
,(condition-slot-readers slot
)
578 :writers
,(condition-slot-writers slot
)
579 ,@(when (condition-slot-initform-p slot
)
580 (let ((initform (condition-slot-initform slot
))
581 (initfun (condition-slot-initfunction slot
)))
582 `(:initform
',initform
:initfunction
,initfun
)))
583 :allocation
,(condition-slot-allocation slot
)
584 :documentation
,(condition-slot-documentation slot
))))
585 (cond ((structure-type-p name
)
586 (ensure 'structure-class
587 (mapcar #'slot-initargs-from-structure-slotd
588 (structure-type-slot-description-list name
))))
589 ((condition-type-p name
)
590 (ensure 'condition-class
591 (mapcar #'slot-initargs-from-condition-slot
592 (condition-classoid-slots classoid
))))
594 (error "~@<~S is not the name of a class.~@:>" name
)))))
596 (defun ensure-deffoo-class (classoid)
597 (let ((class (classoid-pcl-class classoid
)))
599 (ensure-non-standard-class (class-name class
) classoid class
))
600 ((eq 'complete
**boot-state
**)
601 (ensure-non-standard-class (classoid-name classoid
) classoid
)))))
603 (pushnew 'ensure-deffoo-class sb-kernel
::*defstruct-hooks
*)
604 (pushnew 'ensure-deffoo-class sb-kernel
::*define-condition-hooks
*)
606 (defun !make-class-predicate
(class name source-location
)
607 (let* ((gf (ensure-generic-function name
:lambda-list
'(object)
608 :definition-source source-location
))
609 (mlist (if (eq **boot-state
** 'complete
)
610 (early-gf-methods gf
)
611 (generic-function-methods gf
))))
613 (unless (eq class
*the-class-t
*)
614 (let* ((default-method-function #'constantly-nil
)
615 (default-method-initargs (list :function default-method-function
616 'plist
'(:constant-value nil
)))
617 (default-method (make-a-method
622 default-method-initargs
623 "class predicate default method")))
624 (add-method gf default-method
)))
625 (let* ((class-method-function #'constantly-t
)
626 (class-method-initargs (list :function class-method-function
627 'plist
'(:constant-value t
)))
628 (class-method (make-a-method 'standard-method
632 class-method-initargs
633 "class predicate class method")))
634 (add-method gf class-method
)))
637 ;;; Set the inherits from CPL, and register the layout. This actually
638 ;;; installs the class in the Lisp type system.
639 (defun %update-lisp-class-layout
(class layout
)
640 ;; Protected by *world-lock* in callers.
641 (let ((classoid (layout-classoid layout
)))
642 (unless (eq (classoid-layout classoid
) layout
)
643 (setf (layout-inherits layout
)
644 (order-layout-inherits
645 (map 'simple-vector
#'class-wrapper
646 (reverse (rest (class-precedence-list class
))))))
647 (register-layout layout
:invalidate t
)
649 ;; FIXME: I don't think this should be necessary, but without it
650 ;; we are unable to compile (TYPEP foo '<class-name>) in the
651 ;; same file as the class is defined. If we had environments,
652 ;; then I think the classsoid whould only be associated with the
653 ;; name in that environment... Alternatively, fix the compiler
654 ;; so that TYPEP foo '<class-name> is slow but compileable.
655 (let ((name (class-name class
)))
656 (when (and name
(symbolp name
) (eq name
(classoid-name classoid
)))
657 (setf (find-classoid name
) classoid
))))))
659 (!bootstrap-meta-braid
)
660 (!bootstrap-accessor-definitions t
)
661 (!bootstrap-accessor-definitions nil
)
662 (!bootstrap-built-in-classes
)
665 in
(let (classoid-cells)
666 (do-all-symbols (s classoid-cells
)
667 (let ((cell (sb-int:info
:type
:classoid-cell s
)))
669 (push (cons s cell
) classoid-cells
)))))
671 (when (classoid-cell-pcl-class x
)
672 (let* ((class (find-class-from-cell name x
))
673 (layout (class-wrapper class
))
674 (lclass (layout-classoid layout
))
675 (lclass-pcl-class (classoid-pcl-class lclass
))
676 (olclass (find-classoid name nil
)))
678 (aver (eq class lclass-pcl-class
))
679 (setf (classoid-pcl-class lclass
) class
))
681 (%update-lisp-class-layout class layout
)
684 (aver (eq lclass olclass
)))
686 (setf (find-classoid name
) lclass
)))
690 (setq **boot-state
** 'braid
)
692 (defmethod no-applicable-method (generic-function &rest args
)
693 (error "~@<There is no applicable method for the generic function ~2I~_~S~
694 ~I~_when called with arguments ~2I~_~S.~:>"
698 (defmethod no-next-method ((generic-function standard-generic-function
)
699 (method standard-method
) &rest args
)
700 (error "~@<There is no next method for the generic function ~2I~_~S~
701 ~I~_when called from method ~2I~_~S~I~_with arguments ~2I~_~S.~:>"
706 ;;; An extension to the ANSI standard: in the presence of e.g. a
707 ;;; :BEFORE method, it would seem that going through
708 ;;; NO-APPLICABLE-METHOD is prohibited, as in fact there is an
709 ;;; applicable method. -- CSR, 2002-11-15
710 (define-condition no-primary-method
(reference-condition error
)
711 ((generic-function :initarg
:generic-function
:reader no-primary-method-generic-function
)
712 (args :initarg
:args
:reader no-primary-method-args
))
715 (format s
"~@<There is no primary method for the generic function ~2I~_~S~
716 ~I~_when called with arguments ~2I~_~S.~:>"
717 (no-primary-method-generic-function c
)
718 (no-primary-method-args c
))))
719 (:default-initargs
:references
(list '(:ansi-cl
:section
(7 6 6 2)))))
720 (defmethod no-primary-method (generic-function &rest args
)
721 (error 'no-primary-method
:generic-function generic-function
:args args
))
723 (defmethod invalid-qualifiers ((gf generic-function
)
726 (let ((qualifiers (method-qualifiers method
)))
728 ((cdr qualifiers
) "has too many qualifiers")
729 (t (aver (not (member (car qualifiers
)
730 '(:around
:before
:after
))))
731 "has an invalid qualifier"))))
732 (invalid-method-error
734 "The method ~S on ~S ~A.~%~
735 Standard method combination requires all methods to have one~%~
736 of the single qualifiers :AROUND, :BEFORE and :AFTER or to~%~
737 have no qualifier at all."