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
(get-instance-hash-code)))
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-funcallable-instance-slots
(wrapper &optional
56 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 (defun allocate-funcallable-instance (wrapper &optional
65 (slots-init nil slots-init-p
))
66 (let ((fin (%make-pcl-funcallable-instance nil nil
67 (get-instance-hash-code))))
68 (set-funcallable-instance-function
70 #'(instance-lambda (&rest args
)
71 (declare (ignore args
))
72 (error "The function of the funcallable-instance ~S has not been set."
74 (setf (fsc-instance-wrapper fin
) wrapper
75 (fsc-instance-slots fin
) (allocate-funcallable-instance-slots
76 wrapper slots-init-p slots-init
))
79 (defun allocate-structure-instance (wrapper &optional
80 (slots-init nil slots-init-p
))
81 (let* ((class (wrapper-class wrapper
))
82 (constructor (class-defstruct-constructor class
)))
84 (let ((instance (funcall constructor
))
85 (slots (class-slots class
)))
88 (setf (slot-value-using-class class instance slot
)
91 (error "can't allocate an instance of class ~S" (class-name class
)))))
93 ;;;; BOOTSTRAP-META-BRAID
95 ;;;; This function builds the base metabraid from the early class definitions.
97 (defmacro !initial-classes-and-wrappers
(&rest classes
)
99 ,@(mapcar (lambda (class)
100 (let ((wr (intern (format nil
"~A-WRAPPER" class
)
102 `(setf ,wr
,(if (eq class
'standard-generic-function
)
105 (early-class-size ',class
)
107 ,class
(allocate-standard-instance
108 ,(if (eq class
'standard-generic-function
)
109 'funcallable-standard-class-wrapper
110 'standard-class-wrapper
))
111 (wrapper-class ,wr
) ,class
112 (find-class ',class
) ,class
)))
115 (defun !bootstrap-meta-braid
()
116 (let* ((*create-classes-from-internal-structure-definitions-p
* nil
)
117 std-class-wrapper std-class
118 standard-class-wrapper standard-class
119 funcallable-standard-class-wrapper funcallable-standard-class
120 slot-class-wrapper slot-class
121 built-in-class-wrapper built-in-class
122 structure-class-wrapper structure-class
123 condition-class-wrapper condition-class
124 standard-direct-slot-definition-wrapper
125 standard-direct-slot-definition
126 standard-effective-slot-definition-wrapper
127 standard-effective-slot-definition
128 class-eq-specializer-wrapper class-eq-specializer
129 standard-generic-function-wrapper standard-generic-function
)
130 (!initial-classes-and-wrappers
131 standard-class funcallable-standard-class
132 slot-class built-in-class structure-class condition-class std-class
133 standard-direct-slot-definition standard-effective-slot-definition
134 class-eq-specializer standard-generic-function
)
135 ;; First, make a class metaobject for each of the early classes. For
136 ;; each metaobject we also set its wrapper. Except for the class T,
137 ;; the wrapper is always that of STANDARD-CLASS.
138 (dolist (definition *early-class-definitions
*)
139 (let* ((name (ecd-class-name definition
))
140 (meta (ecd-metaclass definition
))
142 (slot-class slot-class-wrapper
)
143 (std-class std-class-wrapper
)
144 (standard-class standard-class-wrapper
)
145 (funcallable-standard-class
146 funcallable-standard-class-wrapper
)
147 (built-in-class built-in-class-wrapper
)
148 (structure-class structure-class-wrapper
)
149 (condition-class condition-class-wrapper
)))
150 (class (or (find-class name nil
)
151 (allocate-standard-instance wrapper
))))
152 (setf (find-class name
) class
)))
153 (dolist (definition *early-class-definitions
*)
154 (let ((name (ecd-class-name definition
))
155 (meta (ecd-metaclass definition
))
156 (source (ecd-source definition
))
157 (direct-supers (ecd-superclass-names definition
))
158 (direct-slots (ecd-canonical-slots definition
))
159 (other-initargs (ecd-other-initargs definition
)))
160 (let ((direct-default-initargs
161 (getf other-initargs
:direct-default-initargs
)))
162 (multiple-value-bind (slots cpl default-initargs direct-subclasses
)
163 (early-collect-inheritance name
)
164 (let* ((class (find-class name
))
165 (wrapper (cond ((eq class slot-class
)
167 ((eq class std-class
)
169 ((eq class standard-class
)
170 standard-class-wrapper
)
171 ((eq class funcallable-standard-class
)
172 funcallable-standard-class-wrapper
)
173 ((eq class standard-direct-slot-definition
)
174 standard-direct-slot-definition-wrapper
)
176 standard-effective-slot-definition
)
177 standard-effective-slot-definition-wrapper
)
178 ((eq class built-in-class
)
179 built-in-class-wrapper
)
180 ((eq class structure-class
)
181 structure-class-wrapper
)
182 ((eq class condition-class
)
183 condition-class-wrapper
)
184 ((eq class class-eq-specializer
)
185 class-eq-specializer-wrapper
)
186 ((eq class standard-generic-function
)
187 standard-generic-function-wrapper
)
189 (boot-make-wrapper (length slots
) name
))))
191 (when (eq name t
) (setq *the-wrapper-of-t
* wrapper
))
192 (set (intern (format nil
"*THE-CLASS-~A*" (symbol-name name
))
196 (unless (eq (getf slot
:allocation
:instance
) :instance
)
197 (error "Slot allocation ~S is not supported in bootstrap."
198 (getf slot
:allocation
))))
200 (when (typep wrapper
'wrapper
)
201 (setf (wrapper-instance-slots-layout wrapper
)
202 (mapcar #'canonical-slot-name slots
))
203 (setf (wrapper-class-slots wrapper
)
206 (setq proto
(if (eq meta
'funcallable-standard-class
)
207 (allocate-funcallable-instance wrapper
)
208 (allocate-standard-instance wrapper
)))
211 (!bootstrap-make-slot-definitions
212 name class direct-slots
213 standard-direct-slot-definition-wrapper nil
))
215 (!bootstrap-make-slot-definitions
217 standard-effective-slot-definition-wrapper t
))
220 ((std-class standard-class funcallable-standard-class
)
221 (!bootstrap-initialize-class
223 class name class-eq-specializer-wrapper source
224 direct-supers direct-subclasses cpl wrapper proto
225 direct-slots slots direct-default-initargs default-initargs
))
226 (built-in-class ; *the-class-t*
227 (!bootstrap-initialize-class
229 class name class-eq-specializer-wrapper source
230 direct-supers direct-subclasses cpl wrapper proto
))
231 (slot-class ; *the-class-slot-object*
232 (!bootstrap-initialize-class
234 class name class-eq-specializer-wrapper source
235 direct-supers direct-subclasses cpl wrapper proto
))
236 (structure-class ; *the-class-structure-object*
237 (!bootstrap-initialize-class
239 class name class-eq-specializer-wrapper source
240 direct-supers direct-subclasses cpl wrapper
))
242 (!bootstrap-initialize-class
244 class name class-eq-specializer-wrapper source
245 direct-supers direct-subclasses cpl wrapper
))))))))
247 (let* ((smc-class (find-class 'standard-method-combination
))
248 (smc-wrapper (!bootstrap-get-slot
'standard-class
251 (smc (allocate-standard-instance smc-wrapper
)))
252 (flet ((set-slot (name value
)
253 (!bootstrap-set-slot
'standard-method-combination
257 (set-slot 'source
*load-pathname
*)
258 (set-slot 'type
'standard
)
259 (set-slot 'documentation
"The standard method combination.")
260 (set-slot 'options
()))
261 (setq *standard-method-combination
* smc
))))
263 ;;; Initialize a class metaobject.
264 (defun !bootstrap-initialize-class
265 (metaclass-name class name
266 class-eq-wrapper source direct-supers direct-subclasses cpl wrapper
269 direct-slots slots direct-default-initargs default-initargs
)
270 (flet ((classes (names) (mapcar #'find-class names
))
271 (set-slot (slot-name value
)
272 (!bootstrap-set-slot metaclass-name class slot-name value
)))
273 (set-slot 'name name
)
274 (set-slot 'finalized-p t
)
275 (set-slot 'source source
)
276 (set-slot 'type
(if (eq class
(find-class t
))
278 ;; FIXME: Could this just be CLASS instead
279 ;; of `(CLASS ,CLASS)? If not, why not?
280 ;; (See also similar expression in
281 ;; SHARED-INITIALIZE :BEFORE (CLASS).)
283 (set-slot 'class-eq-specializer
284 (let ((spec (allocate-standard-instance class-eq-wrapper
)))
285 (!bootstrap-set-slot
'class-eq-specializer spec
'type
287 (!bootstrap-set-slot
'class-eq-specializer spec
'object
290 (set-slot 'class-precedence-list
(classes cpl
))
291 (set-slot 'can-precede-list
(classes (cdr cpl
)))
292 (set-slot 'incompatible-superclass-list nil
)
293 (set-slot 'direct-superclasses
(classes direct-supers
))
294 (set-slot 'direct-subclasses
(classes direct-subclasses
))
295 (set-slot 'direct-methods
(cons nil nil
))
296 (set-slot 'wrapper wrapper
)
297 (set-slot 'predicate-name
(or (cadr (assoc name
*early-class-predicates
*))
298 (make-class-predicate-name name
)))
300 `(,@(and direct-default-initargs
301 `(direct-default-initargs ,direct-default-initargs
))
302 ,@(and default-initargs
303 `(default-initargs ,default-initargs
))))
304 (when (memq metaclass-name
'(standard-class funcallable-standard-class
305 structure-class condition-class
306 slot-class std-class
))
307 (set-slot 'direct-slots direct-slots
)
308 (set-slot 'slots slots
))
310 ;; For all direct superclasses SUPER of CLASS, make sure CLASS is
311 ;; a direct subclass of SUPER. Note that METACLASS-NAME doesn't
312 ;; matter here for the slot DIRECT-SUBCLASSES, since every class
313 ;; inherits the slot from class CLASS.
314 (dolist (super direct-supers
)
315 (let* ((super (find-class super
))
316 (subclasses (!bootstrap-get-slot metaclass-name super
317 'direct-subclasses
)))
318 (cond ((eq +slot-unbound
+ subclasses
)
319 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
321 ((not (memq class subclasses
))
322 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
323 (cons class subclasses
))))))
327 (let ((constructor-sym '|STRUCTURE-OBJECT class constructor|
))
328 (set-slot 'predicate-name
(or (cadr (assoc name
329 *early-class-predicates
*))
330 (make-class-predicate-name name
)))
331 (set-slot 'defstruct-form
332 `(defstruct (structure-object (:constructor
335 (set-slot 'defstruct-constructor constructor-sym
)
336 (set-slot 'from-defclass-p t
)
337 (set-slot 'plist nil
)
338 (set-slot 'prototype
(funcall constructor-sym
))))
340 (set-slot 'prototype
(make-condition name
)))
343 (if proto-p proto
(allocate-standard-instance wrapper
)))))
346 (defun !bootstrap-make-slot-definitions
(name class slots wrapper effective-p
)
348 (mapcar (lambda (slot)
350 (!bootstrap-make-slot-definition
351 name class slot wrapper effective-p index
))
354 (defun !bootstrap-make-slot-definition
355 (name class slot wrapper effective-p index
)
356 (let* ((slotd-class-name (if effective-p
357 'standard-effective-slot-definition
358 'standard-direct-slot-definition
))
359 (slotd (allocate-standard-instance wrapper
))
360 (slot-name (getf slot
:name
)))
361 (flet ((get-val (name) (getf slot name
))
363 (!bootstrap-set-slot slotd-class-name slotd name val
)))
364 (set-val 'name slot-name
)
365 (set-val 'initform
(get-val :initform
))
366 (set-val 'initfunction
(get-val :initfunction
))
367 (set-val 'initargs
(get-val :initargs
))
368 (set-val 'readers
(get-val :readers
))
369 (set-val 'writers
(get-val :writers
))
370 (set-val 'allocation
:instance
)
371 (set-val 'type
(or (get-val :type
) t
))
372 (set-val 'documentation
(or (get-val :documentation
) ""))
373 (set-val 'class class
)
375 (set-val 'location index
)
377 (set-val 'reader-function
(make-optimized-std-reader-method-function
378 fsc-p slot-name index
))
379 (set-val 'writer-function
(make-optimized-std-writer-method-function
380 fsc-p slot-name index
))
381 (set-val 'boundp-function
(make-optimized-std-boundp-method-function
382 fsc-p slot-name index
)))
383 (set-val 'accessor-flags
7)
384 (let ((table (or (gethash slot-name
*name-
>class-
>slotd-table
*)
385 (setf (gethash slot-name
*name-
>class-
>slotd-table
*)
386 (make-hash-table :test
'eq
:size
5)))))
387 (setf (gethash class table
) slotd
)))
388 (when (and (eq name
'standard-class
)
389 (eq slot-name
'slots
) effective-p
)
390 (setq *the-eslotd-standard-class-slots
* slotd
))
391 (when (and (eq name
'funcallable-standard-class
)
392 (eq slot-name
'slots
) effective-p
)
393 (setq *the-eslotd-funcallable-standard-class-slots
* slotd
))
396 (defun !bootstrap-accessor-definitions
(early-p)
397 (let ((*early-p
* early-p
))
398 (dolist (definition *early-class-definitions
*)
399 (let ((name (ecd-class-name definition
))
400 (meta (ecd-metaclass definition
)))
401 (unless (eq meta
'built-in-class
)
402 (let ((direct-slots (ecd-canonical-slots definition
)))
403 (dolist (slotd direct-slots
)
404 (let ((slot-name (getf slotd
:name
))
405 (readers (getf slotd
:readers
))
406 (writers (getf slotd
:writers
)))
407 (!bootstrap-accessor-definitions1
413 (!bootstrap-accessor-definitions1
416 (list (slot-reader-name slot-name
))
417 (list (slot-writer-name slot-name
))
418 (list (slot-boundp-name slot-name
)))))))))))
420 (defun !bootstrap-accessor-definition
(class-name accessor-name slot-name type
)
421 (multiple-value-bind (accessor-class make-method-function arglist specls doc
)
423 (reader (values 'standard-reader-method
424 #'make-std-reader-method-function
427 "automatically generated reader method"))
428 (writer (values 'standard-writer-method
429 #'make-std-writer-method-function
430 (list 'new-value class-name
)
432 "automatically generated writer method"))
433 (boundp (values 'standard-boundp-method
434 #'make-std-boundp-method-function
437 "automatically generated boundp method")))
438 (let ((gf (ensure-generic-function accessor-name
)))
439 (if (find specls
(early-gf-methods gf
)
440 :key
#'early-method-specializers
442 (unless (assoc accessor-name
*!generic-function-fixups
*
446 (make-a-method accessor-class
449 (funcall make-method-function
450 class-name slot-name
)
454 (defun !bootstrap-accessor-definitions1
(class-name
459 (flet ((do-reader-definition (reader)
460 (!bootstrap-accessor-definition class-name
464 (do-writer-definition (writer)
465 (!bootstrap-accessor-definition class-name
469 (do-boundp-definition (boundp)
470 (!bootstrap-accessor-definition class-name
474 (dolist (reader readers
) (do-reader-definition reader
))
475 (dolist (writer writers
) (do-writer-definition writer
))
476 (dolist (boundp boundps
) (do-boundp-definition boundp
))))
478 (defun !bootstrap-class-predicates
(early-p)
479 (let ((*early-p
* early-p
))
480 (dolist (definition *early-class-definitions
*)
481 (let* ((name (ecd-class-name definition
))
482 (class (find-class name
)))
483 (setf (find-class-predicate name
)
484 (make-class-predicate class
(class-predicate-name class
)))))))
486 (defun !bootstrap-built-in-classes
()
488 ;; First make sure that all the supers listed in
489 ;; *BUILT-IN-CLASS-LATTICE* are themselves defined by
490 ;; *BUILT-IN-CLASS-LATTICE*. This is just to check for typos and
491 ;; other sorts of brainos.
492 (dolist (e *built-in-classes
*)
493 (dolist (super (cadr e
))
494 (unless (or (eq super t
)
495 (assq super
*built-in-classes
*))
496 (error "in *BUILT-IN-CLASSES*: ~S has ~S as a super,~%~
497 but ~S is not itself a class in *BUILT-IN-CLASSES*."
498 (car e
) super super
))))
500 ;; In the first pass, we create a skeletal object to be bound to the
502 (let* ((built-in-class (find-class 'built-in-class
))
503 (built-in-class-wrapper (class-wrapper built-in-class
)))
504 (dolist (e *built-in-classes
*)
505 (let ((class (allocate-standard-instance built-in-class-wrapper
)))
506 (setf (find-class (car e
)) class
))))
508 ;; In the second pass, we initialize the class objects.
509 (let ((class-eq-wrapper (class-wrapper (find-class 'class-eq-specializer
))))
510 (dolist (e *built-in-classes
*)
511 (destructuring-bind (name supers subs cpl prototype
) e
512 (let* ((class (find-class name
))
513 (lclass (find-classoid name
))
514 (wrapper (classoid-layout lclass
)))
515 (set (get-built-in-class-symbol name
) class
)
516 (set (get-built-in-wrapper-symbol name
) wrapper
)
517 (setf (classoid-pcl-class lclass
) class
)
519 (!bootstrap-initialize-class
'built-in-class class
520 name class-eq-wrapper nil
523 wrapper prototype
)))))
525 (dolist (e *built-in-classes
*)
526 (let* ((name (car e
))
527 (class (find-class name
)))
528 (setf (find-class-predicate name
)
529 (make-class-predicate class
(class-predicate-name class
))))))
531 (defmacro wrapper-of-macro
(x)
535 (wrapper-class* (wrapper-of-macro x
)))
537 ;;; FIXME: We probably don't need both WRAPPER-OF and WRAPPER-OF-MACRO.
538 #-sb-fluid
(declaim (inline wrapper-of
))
539 (defun wrapper-of (x)
540 (wrapper-of-macro x
))
542 (defun eval-form (form)
543 (lambda () (eval form
)))
545 (defun ensure-non-standard-class (name &optional existing-class
)
547 ((ensure (metaclass &optional
(slots nil slotsp
))
549 (mapcar #'classoid-name
(classoid-direct-superclasses
550 (find-classoid name
)))))
552 (ensure-class-using-class existing-class name
553 :metaclass metaclass
:name name
554 :direct-superclasses supers
556 (ensure-class-using-class existing-class name
557 :metaclass metaclass
:name name
558 :direct-superclasses supers
))))
559 (slot-initargs-from-structure-slotd (slotd)
560 (let ((accessor (structure-slotd-accessor-symbol slotd
)))
561 `(:name
,(structure-slotd-name slotd
)
562 :defstruct-accessor-symbol
,accessor
563 ,@(when (fboundp accessor
)
564 `(:internal-reader-function
565 ,(structure-slotd-reader-function slotd
)
566 :internal-writer-function
567 ,(structure-slotd-writer-function name slotd
)))
568 :type
,(or (structure-slotd-type slotd
) t
)
569 :initform
,(structure-slotd-init-form slotd
)
570 :initfunction
,(eval-form (structure-slotd-init-form slotd
)))))
571 (slot-initargs-from-condition-slot (slot)
572 `(:name
,(condition-slot-name slot
)
573 :initargs
,(condition-slot-initargs slot
)
574 :readers
,(condition-slot-readers slot
)
575 :writers
,(condition-slot-writers slot
)
576 ,@(when (condition-slot-initform-p slot
)
577 (let ((form-or-fun (condition-slot-initform slot
)))
578 (if (functionp form-or-fun
)
579 `(:initfunction
,form-or-fun
)
580 `(:initform
,form-or-fun
581 :initfunction
,(lambda () form-or-fun
)))))
582 :allocation
(condition-slot-allocation slot
)
583 :documentation
(condition-slot-documentation slot
))))
584 (cond ((structure-type-p name
)
585 (ensure 'structure-class
586 (mapcar #'slot-initargs-from-structure-slotd
587 (structure-type-slot-description-list name
))))
588 ((condition-type-p name
)
589 (ensure 'condition-class
590 (mapcar #'slot-initargs-from-condition-slot
591 (condition-classoid-slots (find-classoid name
)))))
593 (error "~@<~S is not the name of a class.~@:>" name
)))))
595 (defun maybe-reinitialize-structure-class (classoid)
596 (let ((class (classoid-pcl-class classoid
)))
598 (ensure-non-standard-class (class-name class
) class
))))
600 (pushnew 'maybe-reinitialize-structure-class sb-kernel
::*defstruct-hooks
*)
602 (defun make-class-predicate (class name
)
603 (let* ((gf (ensure-generic-function name
))
604 (mlist (if (eq *boot-state
* 'complete
)
605 (generic-function-methods gf
)
606 (early-gf-methods gf
))))
608 (unless (eq class
*the-class-t
*)
609 (let* ((default-method-function #'constantly-nil
)
610 (default-method-initargs (list :function
611 default-method-function
))
612 (default-method (make-a-method
617 default-method-initargs
618 "class predicate default method")))
619 (setf (method-function-get default-method-function
:constant-value
)
621 (add-method gf default-method
)))
622 (let* ((class-method-function #'constantly-t
)
623 (class-method-initargs (list :function
624 class-method-function
))
625 (class-method (make-a-method 'standard-method
629 class-method-initargs
630 "class predicate class method")))
631 (setf (method-function-get class-method-function
:constant-value
) t
)
632 (add-method gf class-method
)))
635 ;;; Set the inherits from CPL, and register the layout. This actually
636 ;;; installs the class in the Lisp type system.
637 (defun update-lisp-class-layout (class layout
)
638 (let ((lclass (layout-classoid layout
)))
639 (unless (eq (classoid-layout lclass
) layout
)
640 (setf (layout-inherits layout
)
641 (order-layout-inherits
642 (map 'simple-vector
#'class-wrapper
643 (reverse (rest (class-precedence-list class
))))))
644 (register-layout layout
:invalidate t
)
646 ;; Subclasses of formerly forward-referenced-class may be
647 ;; unknown to CL:FIND-CLASS and also anonymous. This
648 ;; functionality moved here from (SETF FIND-CLASS).
649 (let ((name (class-name class
)))
650 (setf (find-classoid name
) lclass
651 (classoid-name lclass
) name
)))))
653 (defun set-class-type-translation (class name
)
654 (let ((classoid (find-classoid name nil
)))
658 (let ((translation (built-in-classoid-translation classoid
)))
661 (aver (ctype-p translation
))
662 (setf (info :type
:translator class
)
663 (lambda (spec) (declare (ignore spec
)) translation
)))
665 (setf (info :type
:translator class
)
666 (lambda (spec) (declare (ignore spec
)) classoid
))))))
668 (setf (info :type
:translator class
)
669 (lambda (spec) (declare (ignore spec
)) classoid
))))))
671 (clrhash *find-class
*)
672 (!bootstrap-meta-braid
)
673 (!bootstrap-accessor-definitions t
)
674 (!bootstrap-class-predicates t
)
675 (!bootstrap-accessor-definitions nil
)
676 (!bootstrap-class-predicates nil
)
677 (!bootstrap-built-in-classes
)
679 (dohash (name x
*find-class
*)
680 (let* ((class (find-class-from-cell name x
))
681 (layout (class-wrapper class
))
682 (lclass (layout-classoid layout
))
683 (lclass-pcl-class (classoid-pcl-class lclass
))
684 (olclass (find-classoid name nil
)))
686 (aver (eq class lclass-pcl-class
))
687 (setf (classoid-pcl-class lclass
) class
))
689 (update-lisp-class-layout class layout
)
692 (aver (eq lclass olclass
)))
694 (setf (find-classoid name
) lclass
)))
696 (set-class-type-translation class name
)))
698 (setq *boot-state
* 'braid
)
700 (defmethod no-applicable-method (generic-function &rest args
)
701 (error "~@<There is no applicable method for the generic function ~2I~_~S~
702 ~I~_when called with arguments ~2I~_~S.~:>"
706 (defmethod no-next-method ((generic-function standard-generic-function
)
707 (method standard-method
) &rest args
)
708 (error "~@<There is no next method for the generic function ~2I~_~S~
709 ~I~_when called from method ~2I~_~S~I~_with arguments ~2I~_~S.~:>"
714 ;;; An extension to the ANSI standard: in the presence of e.g. a
715 ;;; :BEFORE method, it would seem that going through
716 ;;; NO-APPLICABLE-METHOD is prohibited, as in fact there is an
717 ;;; applicable method. -- CSR, 2002-11-15
718 (defmethod no-primary-method (generic-function &rest args
)
719 (error "~@<There is no primary method for the generic function ~2I~_~S~
720 ~I~_when called with arguments ~2I~_~S.~:>"
724 (defmethod invalid-qualifiers ((gf generic-function
)
727 (let ((qualifiers (method-qualifiers method
)))
729 ((cdr qualifiers
) "has too many qualifiers")
730 (t (aver (not (member (car qualifiers
)
731 '(:around
:before
:after
))))
732 "has an invalid qualifier"))))
733 (invalid-method-error
735 "The method ~S on ~S ~A.~%~
736 Standard method combination requires all methods to have one~%~
737 of the single qualifiers :AROUND, :BEFORE and :AFTER or to~%~
738 have no qualifier at all."