It lives!
[sod] / class-layout.lisp
1 ;;; -*-lisp-*-
2 ;;;
3 ;;; Layout for instances and vtables
4 ;;;
5 ;;; (c) 2009 Straylight/Edgeware
6 ;;;
7
8 ;;;----- Licensing notice ---------------------------------------------------
9 ;;;
10 ;;; This file is part of the Simple Object Definition system.
11 ;;;
12 ;;; SOD is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2 of the License, or
15 ;;; (at your option) any later version.
16 ;;;
17 ;;; SOD is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with SOD; if not, write to the Free Software Foundation,
24 ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26 (cl:in-package #:sod)
27
28 ;;;--------------------------------------------------------------------------
29 ;;; Effective slot objects.
30
31 (defclass effective-slot ()
32 ((class :initarg :class :type sod-slot :reader effective-slot-class)
33 (slot :initarg :slot :type sod-slot :reader effective-slot-direct-slot)
34 (initializer :initarg :initializer :type (or sod-initializer null)
35 :reader effective-slot-initializer))
36 (:documentation
37 "Describes a slot and how it's meant to be initialized.
38
39 Effective slot objects are usually attached to layouts."))
40
41 (defgeneric find-slot-initializer (class slot)
42 (:documentation
43 "Return the most specific initializer for SLOT, starting from CLASS."))
44
45 (defgeneric compute-effective-slot (class slot)
46 (:documentation
47 "Construct an effective slot from the supplied direct slot.
48
49 SLOT is a direct slot defined on CLASS or one of its superclasses.
50 (Metaclass initializers are handled using a different mechanism.)"))
51
52 (defmethod print-object ((slot effective-slot) stream)
53 (maybe-print-unreadable-object (slot stream :type t)
54 (format stream "~A~@[ = ~@_~A~]"
55 (effective-slot-direct-slot slot)
56 (effective-slot-initializer slot))))
57
58 (defmethod find-slot-initializer ((class sod-class) (slot sod-slot))
59 (some (lambda (super)
60 (find slot
61 (sod-class-instance-initializers super)
62 :key #'sod-initializer-slot))
63 (sod-class-precedence-list class)))
64
65 (defmethod compute-effective-slot ((class sod-class) (slot sod-slot))
66 (make-instance 'effective-slot
67 :slot slot
68 :class class
69 :initializer (find-slot-initializer class slot)))
70
71 ;;;--------------------------------------------------------------------------
72 ;;; Instance layout objects.
73
74 ;;; islots
75
76 (defclass islots ()
77 ((class :initarg :class :type sod-class :reader islots-class)
78 (subclass :initarg :subclass :type sod-class :reader islots-subclass)
79 (slots :initarg :slots :type list :reader islots-slots))
80 (:documentation
81 "The collection of effective SLOTS defined by an instance of CLASS."))
82
83 (defmethod print-object ((islots islots) stream)
84 (print-unreadable-object (islots stream :type t)
85 (format stream "~A <= ~A ~_~:<~@{~S~^ ~_~}~:>"
86 (islots-subclass islots)
87 (islots-class islots)
88 (islots-slots islots))))
89
90 (defgeneric compute-islots (class subclass)
91 (:documentation
92 "Return ISLOTS containing EFFECTIVE-SLOTs for a particular CLASS.
93
94 Initializers for the slots should be taken from the most specific
95 superclass of SUBCLASS."))
96
97 ;;; vtable-pointer
98
99 (defclass vtable-pointer ()
100 ((class :initarg :class :type sod-class :reader vtable-pointer-class)
101 (chain-head :initarg :chain-head :type sod-class
102 :reader vtable-pointer-chain-head)
103 (chain-tail :initarg :chain-tail :type sod-class
104 :reader vtable-pointer-chain-tail))
105 (:documentation
106 "A pointer to the vtable for CLASS corresponding to a particular CHAIN."))
107
108 (defmethod print-object ((vtp vtable-pointer) stream)
109 (print-unreadable-object (vtp stream :type t)
110 (format stream "~A:~A"
111 (vtable-pointer-class vtp)
112 (sod-class-nickname (vtable-pointer-chain-head vtp)))))
113
114 ;;; ichain
115
116 (defclass ichain ()
117 ((class :initarg :class :type sod-class :reader ichain-class)
118 (chain-head :initarg :chain-head :type sod-class :reader ichain-head)
119 (chain-tail :initarg :chain-tail :type sod-class :reader ichain-tail)
120 (body :initarg :body :type list :reader ichain-body))
121 (:documentation
122 "All of the instance layout for CLASS corresponding to a particular CHAIN.
123
124 The BODY is a list of things to include in the finished structure. By
125 default, it contains a VTABLE-POINTER and ISLOTS for each class in the
126 chain."))
127
128 (defmethod print-object ((ichain ichain) stream)
129 (print-unreadable-object (ichain stream :type t)
130 (format stream "~A:~A ~_~:<~@{~S~^ ~_~}~:>"
131 (ichain-class ichain)
132 (sod-class-nickname (ichain-head ichain))
133 (ichain-body ichain))))
134
135 (defgeneric compute-ichain (class chain)
136 (:documentation
137 "Return an ICHAIN for a particular CHAIN of CLASS's superclasses.
138
139 The CHAIN is a list of classes, with the least specific first -- so the
140 chain head is the first element."))
141
142 ;;; ilayout
143
144 (defclass ilayout ()
145 ((class :initarg :class :type sod-class :reader ilayout-class)
146 (ichains :initarg :ichains :type list :reader ilayout-ichains))
147 (:documentation
148 "All of the instance layout for a CLASS.
149
150 Consists of an ICHAIN for each distinct chain."))
151
152 (defmethod print-object ((ilayout ilayout) stream)
153 (print-unreadable-object (ilayout stream :type t)
154 (format stream "~A ~_~:<~@{~S~^ ~_~}~:>"
155 (ilayout-class ilayout)
156 (ilayout-ichains ilayout))))
157
158 (defgeneric compute-ilayout (class)
159 (:documentation
160 "Compute and return an instance layout for CLASS."))
161
162 ;;; Standard implementation.
163
164 (defmethod compute-islots ((class sod-class) (subclass sod-class))
165 (make-instance 'islots
166 :class class
167 :subclass subclass
168 :slots (mapcar (lambda (slot)
169 (compute-effective-slot subclass slot))
170 (sod-class-slots class))))
171
172 (defmethod compute-ichain ((class sod-class) chain)
173 (let* ((chain-head (car chain))
174 (chain-tail (find chain-head (mapcar #'car (sod-class-chains class))
175 :key #'sod-class-chain-head))
176 (vtable-pointer (make-instance 'vtable-pointer
177 :class class
178 :chain-head chain-head
179 :chain-tail chain-tail))
180 (islots (remove-if-not #'islots-slots
181 (mapcar (lambda (super)
182 (compute-islots super class))
183 chain))))
184 (make-instance 'ichain
185 :class class
186 :chain-head chain-head
187 :chain-tail chain-tail
188 :body (cons vtable-pointer islots))))
189
190 (defmethod compute-ilayout ((class sod-class))
191 (make-instance 'ilayout
192 :class class
193 :ichains (mapcar (lambda (chain)
194 (compute-ichain class
195 (reverse chain)))
196 (sod-class-chains class))))
197
198 ;;;--------------------------------------------------------------------------
199 ;;; Effective methods.
200
201 (defclass effective-method ()
202 ((message :initarg :message :type sod-message
203 :reader effective-method-message)
204 (class :initarg :class :type sod-class :reader effective-method-class))
205 (:documentation
206 "The effective method invoked by sending MESSAGE to an instance of CLASS.
207
208 This is not a useful class by itself. Message classes are expected to
209 define their own effective-method classes.
210
211 An effective method class must accept a :DIRECT-METHODS initarg, which
212 will be a list of applicable methods sorted in most-to-least specific
213 order."))
214
215 (defmethod print-object ((method effective-method) stream)
216 (maybe-print-unreadable-object (method stream :type t)
217 (format stream "~A ~A"
218 (effective-method-message method)
219 (effective-method-class method))))
220
221 (defgeneric message-effective-method-class (message)
222 (:documentation
223 "Return the effective method class for the given MESSAGE."))
224
225 (defgeneric compute-sod-effective-method (message class)
226 (:documentation
227 "Return the effective method when a CLASS instance receives MESSAGE.
228
229 The default method constructs an instance of the message's chosen
230 MESSAGE-EFFECTIVE-METHOD-CLASS, passing the MESSAGE, the CLASS and the
231 list of applicable methods as initargs to MAKE-INSTANCE."))
232
233 (defmethod compute-sod-effective-method
234 ((message sod-message) (class sod-class))
235 (let ((direct-methods (mappend (lambda (super)
236 (remove message
237 (sod-class-methods super)
238 :key #'sod-method-message
239 :test-not #'eql))
240 (sod-class-precedence-list class))))
241 (make-instance (message-effective-method-class message)
242 :message message
243 :class class
244 :direct-methods direct-methods)))
245
246 ;;;--------------------------------------------------------------------------
247 ;;; Vtable layout.
248
249 ;;; method-entry
250
251 (defclass method-entry ()
252 ((method :initarg :method :type effective-method
253 :reader method-entry-effective-method)
254 (chain-head :initarg :chain-head :type sod-class
255 :reader method-entry-chain-head)
256 (chain-tail :initarg :chain-tail :type sod-class
257 :reader method-entry-chain-tail))
258 (:documentation
259 "An entry point into an effective method.
260
261 Calls to an effective method via different vtable chains will have their
262 `me' pointers pointing to different ichains within the instance layout.
263 Rather than (necessarily) duplicating the entire effective method for each
264 chain, we insert an entry veneer (the method entry) to fix up the pointer.
265 Exactly how it does this is up to the effective method -- and duplication
266 under some circumstances is probably a reasonable approach -- e.g., if the
267 effective method is just going to call a direct method immediately."))
268
269 (defmethod print-object ((entry method-entry) stream)
270 (maybe-print-unreadable-object (entry stream :type t)
271 (format stream "~A:~A"
272 (method-entry-effective-method entry)
273 (sod-class-nickname (method-entry-chain-head entry)))))
274
275 (defgeneric make-method-entry (effective-method chain-head chain-tail)
276 (:documentation
277 "Return a METHOD-ENTRY for an EFFECTIVE-METHOD called via CHAIN-HEAD.
278
279 There is no default method for this function. (Maybe when the
280 effective-method/method-entry output protocol has settled down I'll know
281 what a sensible default action would be.)"))
282
283 ;;; vtmsgs
284
285 (defclass vtmsgs ()
286 ((class :initarg :class :type sod-class :reader vtmsgs-class)
287 (subclass :initarg :subclass :type sod-class :reader vtmsgs-subclass)
288 (chain-head :initarg :chain-head :type sod-class
289 :reader vtmsgs-chain-head)
290 (chain-tail :initarg :chain-tail :type sod-class
291 :reader vtmsgs-chain-tail)
292 (entries :initarg :entries :type list :reader vtmsgs-entries))
293 (:documentation
294 "The message dispatch table for a particular CLASS.
295
296 The BODY contains a list of effective method entry objects for the
297 messages defined on CLASS, customized for calling from the chain headed by
298 CHAIN-HEAD."))
299
300 (defmethod print-object ((vtmsgs vtmsgs) stream)
301 (print-unreadable-object (vtmsgs stream :type t)
302 (format stream "~A <= ~A ~_~:<~@{~S~^ ~_~}~:>"
303 (vtmsgs-subclass vtmsgs)
304 (vtmsgs-class vtmsgs)
305 (vtmsgs-entries vtmsgs))))
306
307 (defgeneric compute-vtmsgs (class subclass chain-head chain-tail)
308 (:documentation
309 "Return a VTMSGS object containing method entries for CLASS.
310
311 The CHAIN-HEAD describes which chain the method entries should be
312 constructed for.
313
314 The default method simply calls MAKE-METHOD-ENTRY for each of the methods
315 and wraps a VTMSGS object around them. This ought to be enough for almost
316 all purposes."))
317
318 ;;; class-pointer
319
320 (defclass class-pointer ()
321 ((class :initarg :class :type sod-class :reader class-pointer-class)
322 (chain-head :initarg :chain-head :type sod-class
323 :reader class-pointer-chain-head)
324 (metaclass :initarg :metaclass :type sod-class
325 :reader class-pointer-metaclass)
326 (meta-chain-head :initarg :meta-chain-head :type sod-class
327 :reader class-pointer-meta-chain-head))
328 (:documentation
329 "Represents a pointer to a class object for the instance's class.
330
331 A class instance can have multiple chains. It may be useful to find any
332 of those chains from an instance of the class. Therefore the vtable
333 stores a pointer to each separate chain of the class instance."))
334
335 (defmethod print-object ((cptr class-pointer) stream)
336 (print-unreadable-object (cptr stream :type t)
337 (format stream "~A:~A"
338 (class-pointer-metaclass cptr)
339 (sod-class-nickname (class-pointer-meta-chain-head cptr)))))
340
341 (defgeneric make-class-pointer (class chain-head metaclass meta-chain-head)
342 (:documentation
343 "Return a class pointer to a metaclass chain."))
344
345 ;;; base-offset
346
347 (defclass base-offset ()
348 ((class :initarg :class :type sod-class :reader base-offset-class)
349 (chain-head :initarg :chain-head :type sod-class
350 :reader base-offset-chain-head))
351 (:documentation
352 "The offset of this chain to the ilayout base.
353
354 There's only one of these per vtable."))
355
356 (defmethod print-object ((boff base-offset) stream)
357 (print-unreadable-object (boff stream :type t)
358 (format stream "~A:~A"
359 (base-offset-class boff)
360 (sod-class-nickname (base-offset-chain-head boff)))))
361
362 (defgeneric make-base-offset (class chain-head)
363 (:documentation
364 "Return the base offset object for CHAIN-HEAD ichain."))
365
366 ;;; chain-offset
367
368 (defclass chain-offset ()
369 ((class :initarg :class :type sod-class :reader chain-offset-class)
370 (chain-head :initarg :chain-head :type sod-class
371 :reader chain-offset-chain-head)
372 (target-head :initarg :target-head :type sod-class
373 :reader chain-offset-target-head))
374 (:documentation
375 "The offset from the CHAIN-HEAD ichain to the TARGET-HEAD ichain."))
376
377 (defmethod print-object ((choff chain-offset) stream)
378 (print-unreadable-object (choff stream :type t)
379 (format stream "~A:~A->~A"
380 (chain-offset-class choff)
381 (sod-class-nickname (chain-offset-chain-head choff))
382 (sod-class-nickname (chain-offset-target-head choff)))))
383
384 (defgeneric make-chain-offset (class chain-head target-head)
385 (:documentation
386 "Return the offset from CHAIN-HEAD to TARGET-HEAD."))
387
388 ;;; vtable
389
390 (defclass vtable ()
391 ((class :initarg :class :type sod-class :reader vtable-class)
392 (chain-head :initarg :chain-head :type sod-class
393 :reader vtable-chain-head)
394 (chain-tail :initarg :chain-tail :type sod-class
395 :reader vtable-chain-tail)
396 (body :initarg :body :type list :reader vtable-body))
397 (:documentation
398 "VTABLEs hold all of the per-chain static information for a class.
399
400 There is one vtable for each chain of each class. The vtables for a class
401 are prefixes of the corresponding chains of its subclasses.
402
403 Vtables contain method entry pointers, pointers to class objects, and
404 the offset information used for cross-chain slot access."))
405
406 (defmethod print-object ((vtable vtable) stream)
407 (print-unreadable-object (vtable stream :type t)
408 (format stream "~A:~A ~_~:<~@{~S~^ ~_~}~:>"
409 (vtable-class vtable)
410 (sod-class-nickname (vtable-chain-head vtable))
411 (vtable-body vtable))))
412
413 (defgeneric compute-vtable (class chain)
414 (:documentation
415 "Compute the vtable layout for a chain of CLASS.
416
417 The CHAIN is a list of classes, with the least specific first."))
418
419 (defgeneric compute-vtables (class)
420 (:documentation
421 "Compute the vtable layouts for CLASS.
422
423 Returns a list of VTABLE objects in the order of CLASS's chains."))
424
425 ;;; Implementation.
426
427 (defmethod compute-vtmsgs
428 ((class sod-class)
429 (subclass sod-class)
430 (chain-head sod-class)
431 (chain-tail sod-class))
432 (flet ((make-entry (message)
433 (let ((method (find message
434 (sod-class-effective-methods subclass)
435 :key #'effective-method-message)))
436 (make-method-entry method chain-head chain-tail))))
437 (make-instance 'vtmsgs
438 :class class
439 :subclass subclass
440 :chain-head chain-head
441 :chain-tail chain-tail
442 :entries (mapcar #'make-entry
443 (sod-class-messages class)))))
444
445 (defmethod make-class-pointer
446 ((class sod-class) (chain-head sod-class)
447 (metaclass sod-class) (meta-chain-head sod-class))
448
449 ;; Slightly tricky. We don't necessarily want a pointer to the metaclass,
450 ;; but to its most specific subclass on the given chain. Fortunately, CL
451 ;; is good at this game.
452 (let* ((meta-chains (sod-class-chains metaclass))
453 (meta-chain-tails (mapcar #'car meta-chains))
454 (meta-chain-tail (find meta-chain-head meta-chain-tails
455 :key #'sod-class-chain-head)))
456 (make-instance 'class-pointer
457 :class class
458 :chain-head chain-head
459 :metaclass meta-chain-tail
460 :meta-chain-head meta-chain-head)))
461
462 (defmethod make-base-offset ((class sod-class) (chain-head sod-class))
463 (make-instance 'base-offset
464 :class class
465 :chain-head chain-head))
466
467 (defmethod make-chain-offset
468 ((class sod-class) (chain-head sod-class) (target-head sod-class))
469 (make-instance 'chain-offset
470 :class class
471 :chain-head chain-head
472 :target-head target-head))
473
474 ;; Special variables used by COMPUTE-VTABLE.
475 (defvar *done-metaclass-chains*)
476 (defvar *done-instance-chains*)
477
478 (defgeneric compute-vtable-items (class super chain-head chain-tail emit)
479 (:documentation
480 "Emit vtable items for a superclass of CLASS.
481
482 This function is called for each superclass SUPER of CLASS reached on the
483 chain headed by CHAIN-HEAD. The function should call EMIT for each
484 vtable item it wants to write.
485
486 The right way to check to see whether items have already been emitted
487 (e.g., has an offset to some other chain been emitted?) is as follows:
488
489 * In a method on COMPUTE-VTABLE, bind a special variable to an empty
490 list or hash table.
491
492 * In a method on this function, check the variable or hash table.
493
494 This function is the real business end of COMPUTE-VTABLE."))
495
496 (defmethod compute-vtable-items
497 ((class sod-class) (super sod-class) (chain-head sod-class)
498 (chain-tail sod-class) (emit function))
499
500 ;; If this class introduces new metaclass chains, then emit pointers to
501 ;; them.
502 (let* ((metasuper (sod-class-metaclass super))
503 (metasuper-chains (sod-class-chains metasuper))
504 (metasuper-chain-heads (mapcar (lambda (chain)
505 (sod-class-chain-head (car chain)))
506 metasuper-chains)))
507 (dolist (metasuper-chain-head metasuper-chain-heads)
508 (unless (member metasuper-chain-head *done-metaclass-chains*)
509 (funcall emit (make-class-pointer class
510 chain-head
511 metasuper
512 metasuper-chain-head))
513 (push metasuper-chain-head *done-metaclass-chains*))))
514
515 ;; If there are new instance chains, then emit offsets to them.
516 (let* ((chains (sod-class-chains super))
517 (chain-heads (mapcar (lambda (chain)
518 (sod-class-chain-head (car chain)))
519 chains)))
520 (dolist (head chain-heads)
521 (unless (member head *done-instance-chains*)
522 (funcall emit (make-chain-offset class chain-head head))
523 (push head *done-instance-chains*))))
524
525 ;; Finally, if there are interesting methods, emit those too.
526 (when (sod-class-messages super)
527 (funcall emit (compute-vtmsgs super class chain-head chain-tail))))
528
529 (defun find-root-superclass (class)
530 "Returns the `root' superclass of CLASS.
531
532 The root superclass is the superclass which itself has no direct
533 superclasses. In universes not based on the provided builtin module, the
534 root class may not be our beloved SodObject; however, there must be one
535 (otherwise the class graph is cyclic, which should be forbidden), and we
536 instist that it be unique."
537
538 ;; The root superclass must be a chain head since the chains partition the
539 ;; superclasses; the root has no superclasses so it can't have a link and
540 ;; must therefore be a head. This narrows the field down quite a lot.
541 ;;
542 ;; Note! This function gets called from CHECK-SOD-CLASS before the class's
543 ;; chains have been computed. Therefore we iterate over the direct
544 ;; superclass's chains rather than the class's own. This misses a chain
545 ;; only in the case where the class is its own chain head. There are two
546 ;; subcases: if there are no direct superclasses at all, then the class is
547 ;; its own root; otherwise, it clearly can't be the root and the omission
548 ;; is harmless.
549 (let* ((supers (sod-class-direct-superclasses class))
550 (roots (if supers
551 (remove-duplicates
552 (remove-if #'sod-class-direct-superclasses
553 (mappend (lambda (super)
554 (mapcar (lambda (chain)
555 (sod-class-chain-head
556 (car chain)))
557 (sod-class-chains super)))
558 supers)))
559 (list class))))
560 (cond ((null roots) (error "Class ~A has no root class!" class))
561 ((cdr roots) (error "Class ~A has multiple root classes ~
562 ~{~A~#[~; and ~;, ~]~}"
563 class roots))
564 (t (car roots)))))
565
566 (defun find-root-metaclass (class)
567 "Returns the `root' metaclass of CLASS.
568
569 The root metaclass is the metaclass of the root superclass -- see
570 FIND-ROOT-SUPERCLASS."
571 (sod-class-metaclass (find-root-superclass class)))
572
573 (defmethod compute-vtable ((class sod-class) (chain list))
574 (let* ((chain-head (car chain))
575 (chain-tail (find chain-head (mapcar #'car (sod-class-chains class))
576 :key #'sod-class-chain-head))
577 (*done-metaclass-chains* nil)
578 (*done-instance-chains* (list chain-head))
579 (done-superclasses nil)
580 (items nil))
581 (flet ((emit (item)
582 (push item items)))
583
584 ;; Find the root chain in the metaclass and write a pointer.
585 (let* ((metaclass (sod-class-metaclass class))
586 (metaclass-root (find-root-metaclass class))
587 (metaclass-root-head (sod-class-chain-head metaclass-root)))
588 (emit (make-class-pointer class chain-head metaclass
589 metaclass-root-head))
590 (push metaclass-root-head *done-metaclass-chains*))
591
592 ;; Write an offset to the instance base.
593 (emit (make-base-offset class chain-head))
594
595 ;; Now walk the chain. As we ascend the chain, scan the class
596 ;; precedence list of each class in reverse to ensure that we have
597 ;; everything interesting.
598 (dolist (super chain)
599 (dolist (sub (reverse (sod-class-precedence-list super)))
600 (unless (member sub done-superclasses)
601 (compute-vtable-items class
602 sub
603 chain-head
604 chain-tail
605 #'emit)
606 (push sub done-superclasses))))
607
608 ;; We're through.
609 (make-instance 'vtable
610 :class class
611 :chain-head chain-head
612 :chain-tail chain-tail
613 :body (nreverse items)))))
614
615 (defgeneric compute-effective-methods (class)
616 (:documentation
617 "Return a list of all of the effective methods needed for CLASS.
618
619 The list needn't be in any particular order."))
620
621 (defmethod compute-effective-methods ((class sod-class))
622 (mapcan (lambda (super)
623 (mapcar (lambda (message)
624 (compute-sod-effective-method message class))
625 (sod-class-messages super)))
626 (sod-class-precedence-list class)))
627
628 (defmethod compute-vtables ((class sod-class))
629 (mapcar (lambda (chain)
630 (compute-vtable class (reverse chain)))
631 (sod-class-chains class)))
632
633 ;;;--------------------------------------------------------------------------
634 ;;; Names of things.
635
636 (defun islots-struct-tag (class)
637 (format nil "~A__islots" class))
638
639 (defun ichain-struct-tag (class chain-head)
640 (format nil "~A__ichain_~A" class (sod-class-nickname chain-head)))
641
642 (defun ichain-union-tag (class chain-head)
643 (format nil "~A__ichainu_~A" class (sod-class-nickname chain-head)))
644
645 (defun ilayout-struct-tag (class)
646 (format nil "~A__ilayout" class))
647
648 (defun vtmsgs-struct-tag (class super)
649 (format nil "~A__vtmsgs_~A" class (sod-class-nickname super)))
650
651 (defun vtable-struct-tag (class chain-head)
652 (format nil "~A__vt_~A" class (sod-class-nickname chain-head)))
653
654 (defun vtable-name (class chain-head)
655 (format nil "~A__vtable_~A" class (sod-class-nickname chain-head)))
656
657 ;;;----- That's all, folks --------------------------------------------------