2 * Garbage Collection common functions for scavenging, moving and sizing
3 * objects. These are for use with both GC (stop & copy GC) and GENCGC
7 * This software is part of the SBCL system. See the README file for
10 * This software is derived from the CMU CL system, which was
11 * written at Carnegie Mellon University and released into the
12 * public domain. The software is in the public domain and is
13 * provided with absolutely no warranty. See the COPYING and CREDITS
14 * files for more information.
18 * GENerational Conservative Garbage Collector for SBCL x86
22 * This software is part of the SBCL system. See the README file for
25 * This software is derived from the CMU CL system, which was
26 * written at Carnegie Mellon University and released into the
27 * public domain. The software is in the public domain and is
28 * provided with absolutely no warranty. See the COPYING and CREDITS
29 * files for more information.
33 * For a review of garbage collection techniques (e.g. generational
34 * GC) and terminology (e.g. "scavenging") see Paul R. Wilson,
35 * "Uniprocessor Garbage Collection Techniques". As of 20000618, this
36 * had been accepted for _ACM Computing Surveys_ and was available
37 * as a PostScript preprint through
38 * <http://www.cs.utexas.edu/users/oops/papers.html>
40 * <ftp://ftp.cs.utexas.edu/pub/garbage/bigsurv.ps>.
50 #include "interrupt.h"
55 #include "gc-internal.h"
57 #ifdef LISP_FEATURE_SPARC
58 #define LONG_FLOAT_SIZE 4
60 #ifdef LISP_FEATURE_X86
61 #define LONG_FLOAT_SIZE 3
66 forwarding_pointer_p(lispobj *pointer) {
67 lispobj first_word=*pointer;
68 #ifdef LISP_FEATURE_GENCGC
69 return (first_word == 0x01);
71 return (is_lisp_pointer(first_word)
72 && new_space_p(first_word));
76 static inline lispobj *
77 forwarding_pointer_value(lispobj *pointer) {
78 #ifdef LISP_FEATURE_GENCGC
79 return (lispobj *) ((pointer_sized_uint_t) pointer[1]);
81 return (lispobj *) ((pointer_sized_uint_t) pointer[0]);
85 set_forwarding_pointer(lispobj * pointer, lispobj newspace_copy) {
86 #ifdef LISP_FEATURE_GENCGC
88 pointer[1]=newspace_copy;
90 pointer[0]=newspace_copy;
95 int (*scavtab[256])(lispobj *where, lispobj object);
96 lispobj (*transother[256])(lispobj object);
97 int (*sizetab[256])(lispobj *where);
98 struct weak_pointer *weak_pointers;
104 /* to copy a boxed object */
106 copy_object(lispobj object, int nwords)
110 lispobj *source, *dest;
112 gc_assert(is_lisp_pointer(object));
113 gc_assert(from_space_p(object));
114 gc_assert((nwords & 0x01) == 0);
116 /* Get tag of object. */
117 tag = lowtag_of(object);
119 /* Allocate space. */
120 new = gc_general_alloc(nwords*4,ALLOC_BOXED,ALLOC_QUICK);
123 source = (lispobj *) native_pointer(object);
125 /* Copy the object. */
134 return make_lispobj(new,tag);
137 static int scav_lose(lispobj *where, lispobj object); /* forward decl */
139 /* FIXME: Most calls end up going to some trouble to compute an
140 * 'n_words' value for this function. The system might be a little
141 * simpler if this function used an 'end' parameter instead. */
144 scavenge(lispobj *start, long n_words)
146 lispobj *end = start + n_words;
148 int n_words_scavenged;
150 for (object_ptr = start;
152 object_ptr += n_words_scavenged) {
154 lispobj object = *object_ptr;
155 #ifdef LISP_FEATURE_GENCGC
156 gc_assert(!forwarding_pointer_p(object_ptr));
158 if (is_lisp_pointer(object)) {
159 if (from_space_p(object)) {
160 /* It currently points to old space. Check for a
161 * forwarding pointer. */
162 lispobj *ptr = native_pointer(object);
163 if (forwarding_pointer_p(ptr)) {
164 /* Yes, there's a forwarding pointer. */
165 *object_ptr = LOW_WORD(forwarding_pointer_value(ptr));
166 n_words_scavenged = 1;
168 /* Scavenge that pointer. */
170 (scavtab[widetag_of(object)])(object_ptr, object);
173 /* It points somewhere other than oldspace. Leave it
175 n_words_scavenged = 1;
178 #ifndef LISP_FEATURE_GENCGC
179 /* this workaround is probably not necessary for gencgc; at least, the
180 * behaviour it describes has never been reported */
181 else if (n_words==1) {
182 /* there are some situations where an
183 other-immediate may end up in a descriptor
184 register. I'm not sure whether this is
185 supposed to happen, but if it does then we
186 don't want to (a) barf or (b) scavenge over the
187 data-block, because there isn't one. So, if
188 we're checking a single word and it's anything
189 other than a pointer, just hush it up */
190 int type=widetag_of(object);
193 if ((scavtab[type]==scav_lose) ||
194 (((scavtab[type])(start,object))>1)) {
195 fprintf(stderr,"warning: attempted to scavenge non-descriptor value %x at %p. If you can\nreproduce this warning, send a bug report (see manual page for details)\n",
200 else if ((object & 3) == 0) {
201 /* It's a fixnum: really easy.. */
202 n_words_scavenged = 1;
204 /* It's some sort of header object or another. */
206 (scavtab[widetag_of(object)])(object_ptr, object);
209 gc_assert(object_ptr == end);
212 static lispobj trans_fun_header(lispobj object); /* forward decls */
213 static lispobj trans_boxed(lispobj object);
216 scav_fun_pointer(lispobj *where, lispobj object)
218 lispobj *first_pointer;
221 gc_assert(is_lisp_pointer(object));
223 /* Object is a pointer into from_space - not a FP. */
224 first_pointer = (lispobj *) native_pointer(object);
226 /* must transport object -- object may point to either a function
227 * header, a closure function header, or to a closure header. */
229 switch (widetag_of(*first_pointer)) {
230 case SIMPLE_FUN_HEADER_WIDETAG:
231 case CLOSURE_FUN_HEADER_WIDETAG:
232 copy = trans_fun_header(object);
235 copy = trans_boxed(object);
239 if (copy != object) {
240 /* Set forwarding pointer */
241 set_forwarding_pointer(first_pointer,copy);
244 gc_assert(is_lisp_pointer(copy));
245 gc_assert(!from_space_p(copy));
254 trans_code(struct code *code)
256 struct code *new_code;
257 lispobj first, l_code, l_new_code;
258 int nheader_words, ncode_words, nwords;
259 unsigned long displacement;
260 lispobj fheaderl, *prev_pointer;
262 /* if object has already been transported, just return pointer */
263 first = code->header;
264 if (forwarding_pointer_p((lispobj *)code)) {
266 printf("Was already transported\n");
268 return (struct code *) forwarding_pointer_value
269 ((lispobj *)((pointer_sized_uint_t) code));
272 gc_assert(widetag_of(first) == CODE_HEADER_WIDETAG);
274 /* prepare to transport the code vector */
275 l_code = (lispobj) LOW_WORD(code) | OTHER_POINTER_LOWTAG;
277 ncode_words = fixnum_value(code->code_size);
278 nheader_words = HeaderValue(code->header);
279 nwords = ncode_words + nheader_words;
280 nwords = CEILING(nwords, 2);
282 l_new_code = copy_object(l_code, nwords);
283 new_code = (struct code *) native_pointer(l_new_code);
285 #if defined(DEBUG_CODE_GC)
286 printf("Old code object at 0x%08x, new code object at 0x%08x.\n",
287 (unsigned long) code, (unsigned long) new_code);
288 printf("Code object is %d words long.\n", nwords);
291 #ifdef LISP_FEATURE_GENCGC
292 if (new_code == code)
296 displacement = l_new_code - l_code;
298 set_forwarding_pointer((lispobj *)code, l_new_code);
300 /* set forwarding pointers for all the function headers in the */
301 /* code object. also fix all self pointers */
303 fheaderl = code->entry_points;
304 prev_pointer = &new_code->entry_points;
306 while (fheaderl != NIL) {
307 struct simple_fun *fheaderp, *nfheaderp;
310 fheaderp = (struct simple_fun *) native_pointer(fheaderl);
311 gc_assert(widetag_of(fheaderp->header) == SIMPLE_FUN_HEADER_WIDETAG);
313 /* Calculate the new function pointer and the new */
314 /* function header. */
315 nfheaderl = fheaderl + displacement;
316 nfheaderp = (struct simple_fun *) native_pointer(nfheaderl);
319 printf("fheaderp->header (at %x) <- %x\n",
320 &(fheaderp->header) , nfheaderl);
322 set_forwarding_pointer((lispobj *)fheaderp, nfheaderl);
324 /* fix self pointer. */
326 #ifdef LISP_FEATURE_GENCGC /* GENCGC? Maybe x86 is better conditional */
327 FUN_RAW_ADDR_OFFSET +
331 *prev_pointer = nfheaderl;
333 fheaderl = fheaderp->next;
334 prev_pointer = &nfheaderp->next;
336 os_flush_icache((os_vm_address_t) (((int *)new_code) + nheader_words),
337 ncode_words * sizeof(int));
338 #ifdef LISP_FEATURE_GENCGC
339 gencgc_apply_code_fixups(code, new_code);
345 scav_code_header(lispobj *where, lispobj object)
348 int n_header_words, n_code_words, n_words;
349 lispobj entry_point; /* tagged pointer to entry point */
350 struct simple_fun *function_ptr; /* untagged pointer to entry point */
352 code = (struct code *) where;
353 n_code_words = fixnum_value(code->code_size);
354 n_header_words = HeaderValue(object);
355 n_words = n_code_words + n_header_words;
356 n_words = CEILING(n_words, 2);
358 /* Scavenge the boxed section of the code data block. */
359 scavenge(where + 1, n_header_words - 1);
361 /* Scavenge the boxed section of each function object in the
362 * code data block. */
363 for (entry_point = code->entry_points;
365 entry_point = function_ptr->next) {
367 gc_assert(is_lisp_pointer(entry_point));
369 function_ptr = (struct simple_fun *) native_pointer(entry_point);
370 gc_assert(widetag_of(function_ptr->header)==SIMPLE_FUN_HEADER_WIDETAG);
372 scavenge(&function_ptr->name, 1);
373 scavenge(&function_ptr->arglist, 1);
374 scavenge(&function_ptr->type, 1);
381 trans_code_header(lispobj object)
385 ncode = trans_code((struct code *) native_pointer(object));
386 return (lispobj) LOW_WORD(ncode) | OTHER_POINTER_LOWTAG;
391 size_code_header(lispobj *where)
394 int nheader_words, ncode_words, nwords;
396 code = (struct code *) where;
398 ncode_words = fixnum_value(code->code_size);
399 nheader_words = HeaderValue(code->header);
400 nwords = ncode_words + nheader_words;
401 nwords = CEILING(nwords, 2);
407 scav_return_pc_header(lispobj *where, lispobj object)
409 lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x",
410 (unsigned long) where,
411 (unsigned long) object);
412 return 0; /* bogus return value to satisfy static type checking */
416 trans_return_pc_header(lispobj object)
418 struct simple_fun *return_pc;
419 unsigned long offset;
420 struct code *code, *ncode;
422 return_pc = (struct simple_fun *) native_pointer(object);
423 offset = HeaderValue(return_pc->header) * 4 ;
425 /* Transport the whole code object */
426 code = (struct code *) ((unsigned long) return_pc - offset);
427 ncode = trans_code(code);
429 return ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG;
432 /* On the 386, closures hold a pointer to the raw address instead of the
433 * function object, so we can use CALL [$FDEFN+const] to invoke
434 * the function without loading it into a register. Given that code
435 * objects don't move, we don't need to update anything, but we do
436 * have to figure out that the function is still live. */
438 #ifdef LISP_FEATURE_X86
440 scav_closure_header(lispobj *where, lispobj object)
442 struct closure *closure;
445 closure = (struct closure *)where;
446 fun = closure->fun - FUN_RAW_ADDR_OFFSET;
448 #ifdef LISP_FEATURE_GENCGC
449 /* The function may have moved so update the raw address. But
450 * don't write unnecessarily. */
451 if (closure->fun != fun + FUN_RAW_ADDR_OFFSET)
452 closure->fun = fun + FUN_RAW_ADDR_OFFSET;
459 scav_fun_header(lispobj *where, lispobj object)
461 lose("attempted to scavenge a function header where=0x%08x object=0x%08x",
462 (unsigned long) where,
463 (unsigned long) object);
464 return 0; /* bogus return value to satisfy static type checking */
468 trans_fun_header(lispobj object)
470 struct simple_fun *fheader;
471 unsigned long offset;
472 struct code *code, *ncode;
474 fheader = (struct simple_fun *) native_pointer(object);
475 offset = HeaderValue(fheader->header) * 4;
477 /* Transport the whole code object */
478 code = (struct code *) ((unsigned long) fheader - offset);
479 ncode = trans_code(code);
481 return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG;
490 scav_instance_pointer(lispobj *where, lispobj object)
492 lispobj copy, *first_pointer;
494 /* Object is a pointer into from space - not a FP. */
495 copy = trans_boxed(object);
497 #ifdef LISP_FEATURE_GENCGC
498 gc_assert(copy != object);
501 first_pointer = (lispobj *) native_pointer(object);
502 set_forwarding_pointer(first_pointer,copy);
513 static lispobj trans_list(lispobj object);
516 scav_list_pointer(lispobj *where, lispobj object)
518 lispobj first, *first_pointer;
520 gc_assert(is_lisp_pointer(object));
522 /* Object is a pointer into from space - not FP. */
523 first_pointer = (lispobj *) native_pointer(object);
525 first = trans_list(object);
526 gc_assert(first != object);
528 /* Set forwarding pointer */
529 set_forwarding_pointer(first_pointer, first);
531 gc_assert(is_lisp_pointer(first));
532 gc_assert(!from_space_p(first));
540 trans_list(lispobj object)
542 lispobj new_list_pointer;
543 struct cons *cons, *new_cons;
546 cons = (struct cons *) native_pointer(object);
549 new_cons = (struct cons *)
550 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
551 new_cons->car = cons->car;
552 new_cons->cdr = cons->cdr; /* updated later */
553 new_list_pointer = make_lispobj(new_cons,lowtag_of(object));
555 /* Grab the cdr: set_forwarding_pointer will clobber it in GENCGC */
558 set_forwarding_pointer((lispobj *)cons, new_list_pointer);
560 /* Try to linearize the list in the cdr direction to help reduce
564 struct cons *cdr_cons, *new_cdr_cons;
566 if(lowtag_of(cdr) != LIST_POINTER_LOWTAG ||
567 !from_space_p(cdr) ||
568 forwarding_pointer_p((lispobj *)native_pointer(cdr)))
571 cdr_cons = (struct cons *) native_pointer(cdr);
574 new_cdr_cons = (struct cons*)
575 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
576 new_cdr_cons->car = cdr_cons->car;
577 new_cdr_cons->cdr = cdr_cons->cdr;
578 new_cdr = make_lispobj(new_cdr_cons, lowtag_of(cdr));
580 /* Grab the cdr before it is clobbered. */
582 set_forwarding_pointer((lispobj *)cdr_cons, new_cdr);
584 /* Update the cdr of the last cons copied into new space to
585 * keep the newspace scavenge from having to do it. */
586 new_cons->cdr = new_cdr;
588 new_cons = new_cdr_cons;
591 return new_list_pointer;
596 * scavenging and transporting other pointers
600 scav_other_pointer(lispobj *where, lispobj object)
602 lispobj first, *first_pointer;
604 gc_assert(is_lisp_pointer(object));
606 /* Object is a pointer into from space - not FP. */
607 first_pointer = (lispobj *) native_pointer(object);
608 first = (transother[widetag_of(*first_pointer)])(object);
610 if (first != object) {
611 set_forwarding_pointer(first_pointer, first);
612 #ifdef LISP_FEATURE_GENCGC
616 #ifndef LISP_FEATURE_GENCGC
619 gc_assert(is_lisp_pointer(first));
620 gc_assert(!from_space_p(first));
626 * immediate, boxed, and unboxed objects
630 size_pointer(lispobj *where)
636 scav_immediate(lispobj *where, lispobj object)
642 trans_immediate(lispobj object)
644 lose("trying to transport an immediate");
645 return NIL; /* bogus return value to satisfy static type checking */
649 size_immediate(lispobj *where)
656 scav_boxed(lispobj *where, lispobj object)
662 trans_boxed(lispobj object)
665 unsigned long length;
667 gc_assert(is_lisp_pointer(object));
669 header = *((lispobj *) native_pointer(object));
670 length = HeaderValue(header) + 1;
671 length = CEILING(length, 2);
673 return copy_object(object, length);
678 size_boxed(lispobj *where)
681 unsigned long length;
684 length = HeaderValue(header) + 1;
685 length = CEILING(length, 2);
690 /* Note: on the sparc we don't have to do anything special for fdefns, */
691 /* 'cause the raw-addr has a function lowtag. */
692 #ifndef LISP_FEATURE_SPARC
694 scav_fdefn(lispobj *where, lispobj object)
698 fdefn = (struct fdefn *)where;
700 /* FSHOW((stderr, "scav_fdefn, function = %p, raw_addr = %p\n",
701 fdefn->fun, fdefn->raw_addr)); */
703 if ((char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET)
704 == (char *)((unsigned long)(fdefn->raw_addr))) {
705 scavenge(where + 1, sizeof(struct fdefn)/sizeof(lispobj) - 1);
707 /* Don't write unnecessarily. */
708 if (fdefn->raw_addr != (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET))
709 fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
710 /* gc.c has more casts here, which may be relevant or alternatively
711 may be compiler warning defeaters. try
713 (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
715 return sizeof(struct fdefn) / sizeof(lispobj);
723 scav_unboxed(lispobj *where, lispobj object)
725 unsigned long length;
727 length = HeaderValue(object) + 1;
728 length = CEILING(length, 2);
734 trans_unboxed(lispobj object)
737 unsigned long length;
740 gc_assert(is_lisp_pointer(object));
742 header = *((lispobj *) native_pointer(object));
743 length = HeaderValue(header) + 1;
744 length = CEILING(length, 2);
746 return copy_unboxed_object(object, length);
750 size_unboxed(lispobj *where)
753 unsigned long length;
756 length = HeaderValue(header) + 1;
757 length = CEILING(length, 2);
763 /* vector-like objects */
765 #define NWORDS(x,y) (CEILING((x),(y)) / (y))
767 scav_string(lispobj *where, lispobj object)
769 struct vector *vector;
772 /* NOTE: Strings contain one more byte of data than the length */
773 /* slot indicates. */
775 vector = (struct vector *) where;
776 length = fixnum_value(vector->length) + 1;
777 nwords = CEILING(NWORDS(length, 4) + 2, 2);
782 trans_string(lispobj object)
784 struct vector *vector;
787 gc_assert(is_lisp_pointer(object));
789 /* NOTE: A string contains one more byte of data (a terminating
790 * '\0' to help when interfacing with C functions) than indicated
791 * by the length slot. */
793 vector = (struct vector *) native_pointer(object);
794 length = fixnum_value(vector->length) + 1;
795 nwords = CEILING(NWORDS(length, 4) + 2, 2);
797 return copy_large_unboxed_object(object, nwords);
801 size_string(lispobj *where)
803 struct vector *vector;
806 /* NOTE: A string contains one more byte of data (a terminating
807 * '\0' to help when interfacing with C functions) than indicated
808 * by the length slot. */
810 vector = (struct vector *) where;
811 length = fixnum_value(vector->length) + 1;
812 nwords = CEILING(NWORDS(length, 4) + 2, 2);
818 trans_vector(lispobj object)
820 struct vector *vector;
823 gc_assert(is_lisp_pointer(object));
825 vector = (struct vector *) native_pointer(object);
827 length = fixnum_value(vector->length);
828 nwords = CEILING(length + 2, 2);
830 return copy_large_object(object, nwords);
834 size_vector(lispobj *where)
836 struct vector *vector;
839 vector = (struct vector *) where;
840 length = fixnum_value(vector->length);
841 nwords = CEILING(length + 2, 2);
847 scav_vector_bit(lispobj *where, lispobj object)
849 struct vector *vector;
852 vector = (struct vector *) where;
853 length = fixnum_value(vector->length);
854 nwords = CEILING(NWORDS(length, 32) + 2, 2);
860 trans_vector_bit(lispobj object)
862 struct vector *vector;
865 gc_assert(is_lisp_pointer(object));
867 vector = (struct vector *) native_pointer(object);
868 length = fixnum_value(vector->length);
869 nwords = CEILING(NWORDS(length, 32) + 2, 2);
871 return copy_large_unboxed_object(object, nwords);
875 size_vector_bit(lispobj *where)
877 struct vector *vector;
880 vector = (struct vector *) where;
881 length = fixnum_value(vector->length);
882 nwords = CEILING(NWORDS(length, 32) + 2, 2);
888 scav_vector_unsigned_byte_2(lispobj *where, lispobj object)
890 struct vector *vector;
893 vector = (struct vector *) where;
894 length = fixnum_value(vector->length);
895 nwords = CEILING(NWORDS(length, 16) + 2, 2);
901 trans_vector_unsigned_byte_2(lispobj object)
903 struct vector *vector;
906 gc_assert(is_lisp_pointer(object));
908 vector = (struct vector *) native_pointer(object);
909 length = fixnum_value(vector->length);
910 nwords = CEILING(NWORDS(length, 16) + 2, 2);
912 return copy_large_unboxed_object(object, nwords);
916 size_vector_unsigned_byte_2(lispobj *where)
918 struct vector *vector;
921 vector = (struct vector *) where;
922 length = fixnum_value(vector->length);
923 nwords = CEILING(NWORDS(length, 16) + 2, 2);
929 scav_vector_unsigned_byte_4(lispobj *where, lispobj object)
931 struct vector *vector;
934 vector = (struct vector *) where;
935 length = fixnum_value(vector->length);
936 nwords = CEILING(NWORDS(length, 8) + 2, 2);
942 trans_vector_unsigned_byte_4(lispobj object)
944 struct vector *vector;
947 gc_assert(is_lisp_pointer(object));
949 vector = (struct vector *) native_pointer(object);
950 length = fixnum_value(vector->length);
951 nwords = CEILING(NWORDS(length, 8) + 2, 2);
953 return copy_large_unboxed_object(object, nwords);
956 size_vector_unsigned_byte_4(lispobj *where)
958 struct vector *vector;
961 vector = (struct vector *) where;
962 length = fixnum_value(vector->length);
963 nwords = CEILING(NWORDS(length, 8) + 2, 2);
970 scav_vector_unsigned_byte_8(lispobj *where, lispobj object)
972 struct vector *vector;
975 vector = (struct vector *) where;
976 length = fixnum_value(vector->length);
977 nwords = CEILING(NWORDS(length, 4) + 2, 2);
982 /*********************/
987 trans_vector_unsigned_byte_8(lispobj object)
989 struct vector *vector;
992 gc_assert(is_lisp_pointer(object));
994 vector = (struct vector *) native_pointer(object);
995 length = fixnum_value(vector->length);
996 nwords = CEILING(NWORDS(length, 4) + 2, 2);
998 return copy_large_unboxed_object(object, nwords);
1002 size_vector_unsigned_byte_8(lispobj *where)
1004 struct vector *vector;
1007 vector = (struct vector *) where;
1008 length = fixnum_value(vector->length);
1009 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1016 scav_vector_unsigned_byte_16(lispobj *where, lispobj object)
1018 struct vector *vector;
1021 vector = (struct vector *) where;
1022 length = fixnum_value(vector->length);
1023 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1029 trans_vector_unsigned_byte_16(lispobj object)
1031 struct vector *vector;
1034 gc_assert(is_lisp_pointer(object));
1036 vector = (struct vector *) native_pointer(object);
1037 length = fixnum_value(vector->length);
1038 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1040 return copy_large_unboxed_object(object, nwords);
1044 size_vector_unsigned_byte_16(lispobj *where)
1046 struct vector *vector;
1049 vector = (struct vector *) where;
1050 length = fixnum_value(vector->length);
1051 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1057 scav_vector_unsigned_byte_32(lispobj *where, lispobj object)
1059 struct vector *vector;
1062 vector = (struct vector *) where;
1063 length = fixnum_value(vector->length);
1064 nwords = CEILING(length + 2, 2);
1070 trans_vector_unsigned_byte_32(lispobj object)
1072 struct vector *vector;
1075 gc_assert(is_lisp_pointer(object));
1077 vector = (struct vector *) native_pointer(object);
1078 length = fixnum_value(vector->length);
1079 nwords = CEILING(length + 2, 2);
1081 return copy_large_unboxed_object(object, nwords);
1085 size_vector_unsigned_byte_32(lispobj *where)
1087 struct vector *vector;
1090 vector = (struct vector *) where;
1091 length = fixnum_value(vector->length);
1092 nwords = CEILING(length + 2, 2);
1098 scav_vector_single_float(lispobj *where, lispobj object)
1100 struct vector *vector;
1103 vector = (struct vector *) where;
1104 length = fixnum_value(vector->length);
1105 nwords = CEILING(length + 2, 2);
1111 trans_vector_single_float(lispobj object)
1113 struct vector *vector;
1116 gc_assert(is_lisp_pointer(object));
1118 vector = (struct vector *) native_pointer(object);
1119 length = fixnum_value(vector->length);
1120 nwords = CEILING(length + 2, 2);
1122 return copy_large_unboxed_object(object, nwords);
1126 size_vector_single_float(lispobj *where)
1128 struct vector *vector;
1131 vector = (struct vector *) where;
1132 length = fixnum_value(vector->length);
1133 nwords = CEILING(length + 2, 2);
1139 scav_vector_double_float(lispobj *where, lispobj object)
1141 struct vector *vector;
1144 vector = (struct vector *) where;
1145 length = fixnum_value(vector->length);
1146 nwords = CEILING(length * 2 + 2, 2);
1152 trans_vector_double_float(lispobj object)
1154 struct vector *vector;
1157 gc_assert(is_lisp_pointer(object));
1159 vector = (struct vector *) native_pointer(object);
1160 length = fixnum_value(vector->length);
1161 nwords = CEILING(length * 2 + 2, 2);
1163 return copy_large_unboxed_object(object, nwords);
1167 size_vector_double_float(lispobj *where)
1169 struct vector *vector;
1172 vector = (struct vector *) where;
1173 length = fixnum_value(vector->length);
1174 nwords = CEILING(length * 2 + 2, 2);
1179 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1181 scav_vector_long_float(lispobj *where, lispobj object)
1183 struct vector *vector;
1186 vector = (struct vector *) where;
1187 length = fixnum_value(vector->length);
1188 nwords = CEILING(length *
1195 trans_vector_long_float(lispobj object)
1197 struct vector *vector;
1200 gc_assert(is_lisp_pointer(object));
1202 vector = (struct vector *) native_pointer(object);
1203 length = fixnum_value(vector->length);
1204 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1206 return copy_large_unboxed_object(object, nwords);
1210 size_vector_long_float(lispobj *where)
1212 struct vector *vector;
1215 vector = (struct vector *) where;
1216 length = fixnum_value(vector->length);
1217 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1224 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1226 scav_vector_complex_single_float(lispobj *where, lispobj object)
1228 struct vector *vector;
1231 vector = (struct vector *) where;
1232 length = fixnum_value(vector->length);
1233 nwords = CEILING(length * 2 + 2, 2);
1239 trans_vector_complex_single_float(lispobj object)
1241 struct vector *vector;
1244 gc_assert(is_lisp_pointer(object));
1246 vector = (struct vector *) native_pointer(object);
1247 length = fixnum_value(vector->length);
1248 nwords = CEILING(length * 2 + 2, 2);
1250 return copy_large_unboxed_object(object, nwords);
1254 size_vector_complex_single_float(lispobj *where)
1256 struct vector *vector;
1259 vector = (struct vector *) where;
1260 length = fixnum_value(vector->length);
1261 nwords = CEILING(length * 2 + 2, 2);
1267 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1269 scav_vector_complex_double_float(lispobj *where, lispobj object)
1271 struct vector *vector;
1274 vector = (struct vector *) where;
1275 length = fixnum_value(vector->length);
1276 nwords = CEILING(length * 4 + 2, 2);
1282 trans_vector_complex_double_float(lispobj object)
1284 struct vector *vector;
1287 gc_assert(is_lisp_pointer(object));
1289 vector = (struct vector *) native_pointer(object);
1290 length = fixnum_value(vector->length);
1291 nwords = CEILING(length * 4 + 2, 2);
1293 return copy_large_unboxed_object(object, nwords);
1297 size_vector_complex_double_float(lispobj *where)
1299 struct vector *vector;
1302 vector = (struct vector *) where;
1303 length = fixnum_value(vector->length);
1304 nwords = CEILING(length * 4 + 2, 2);
1311 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1313 scav_vector_complex_long_float(lispobj *where, lispobj object)
1315 struct vector *vector;
1318 vector = (struct vector *) where;
1319 length = fixnum_value(vector->length);
1320 nwords = CEILING(length * (2* LONG_FLOAT_SIZE) + 2, 2);
1326 trans_vector_complex_long_float(lispobj object)
1328 struct vector *vector;
1331 gc_assert(is_lisp_pointer(object));
1333 vector = (struct vector *) native_pointer(object);
1334 length = fixnum_value(vector->length);
1335 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1337 return copy_large_unboxed_object(object, nwords);
1341 size_vector_complex_long_float(lispobj *where)
1343 struct vector *vector;
1346 vector = (struct vector *) where;
1347 length = fixnum_value(vector->length);
1348 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1354 #define WEAK_POINTER_NWORDS \
1355 CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2)
1358 trans_weak_pointer(lispobj object)
1361 #ifndef LISP_FEATURE_GENCGC
1362 struct weak_pointer *wp;
1364 gc_assert(is_lisp_pointer(object));
1366 #if defined(DEBUG_WEAK)
1367 printf("Transporting weak pointer from 0x%08x\n", object);
1370 /* Need to remember where all the weak pointers are that have */
1371 /* been transported so they can be fixed up in a post-GC pass. */
1373 copy = copy_object(object, WEAK_POINTER_NWORDS);
1374 #ifndef LISP_FEATURE_GENCGC
1375 wp = (struct weak_pointer *) native_pointer(copy);
1377 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1378 /* Push the weak pointer onto the list of weak pointers. */
1379 wp->next = LOW_WORD(weak_pointers);
1386 size_weak_pointer(lispobj *where)
1388 return WEAK_POINTER_NWORDS;
1392 void scan_weak_pointers(void)
1394 struct weak_pointer *wp;
1395 for (wp = weak_pointers; wp != NULL;
1396 wp=(struct weak_pointer *)native_pointer(wp->next)) {
1397 lispobj value = wp->value;
1398 lispobj *first_pointer;
1399 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1400 if (!(is_lisp_pointer(value) && from_space_p(value)))
1403 /* Now, we need to check whether the object has been forwarded. If
1404 * it has been, the weak pointer is still good and needs to be
1405 * updated. Otherwise, the weak pointer needs to be nil'ed
1408 first_pointer = (lispobj *)native_pointer(value);
1410 if (forwarding_pointer_p(first_pointer)) {
1412 (lispobj)LOW_WORD(forwarding_pointer_value(first_pointer));
1428 scav_lose(lispobj *where, lispobj object)
1430 lose("no scavenge function for object 0x%08x (widetag 0x%x)",
1431 (unsigned long)object,
1432 widetag_of(*(lispobj*)native_pointer(object)));
1433 return 0; /* bogus return value to satisfy static type checking */
1437 trans_lose(lispobj object)
1439 lose("no transport function for object 0x%08x (widetag 0x%x)",
1440 (unsigned long)object,
1441 widetag_of(*(lispobj*)native_pointer(object)));
1442 return NIL; /* bogus return value to satisfy static type checking */
1446 size_lose(lispobj *where)
1448 lose("no size function for object at 0x%08x (widetag 0x%x)",
1449 (unsigned long)where,
1450 widetag_of(LOW_WORD(where)));
1451 return 1; /* bogus return value to satisfy static type checking */
1460 gc_init_tables(void)
1464 /* Set default value in all slots of scavenge table. FIXME
1465 * replace this gnarly sizeof with something based on
1467 for (i = 0; i < ((sizeof scavtab)/(sizeof scavtab[0])); i++) {
1468 scavtab[i] = scav_lose;
1471 /* For each type which can be selected by the lowtag alone, set
1472 * multiple entries in our widetag scavenge table (one for each
1473 * possible value of the high bits).
1476 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1477 scavtab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1478 scavtab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_fun_pointer;
1479 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1480 scavtab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_list_pointer;
1481 scavtab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1482 scavtab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_instance_pointer;
1483 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1484 scavtab[OTHER_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_other_pointer;
1487 /* Other-pointer types (those selected by all eight bits of the
1488 * tag) get one entry each in the scavenge table. */
1489 scavtab[BIGNUM_WIDETAG] = scav_unboxed;
1490 scavtab[RATIO_WIDETAG] = scav_boxed;
1491 scavtab[SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1492 scavtab[DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1493 #ifdef LONG_FLOAT_WIDETAG
1494 scavtab[LONG_FLOAT_WIDETAG] = scav_unboxed;
1496 scavtab[COMPLEX_WIDETAG] = scav_boxed;
1497 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1498 scavtab[COMPLEX_SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1500 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1501 scavtab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1503 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1504 scavtab[COMPLEX_LONG_FLOAT_WIDETAG] = scav_unboxed;
1506 scavtab[SIMPLE_ARRAY_WIDETAG] = scav_boxed;
1507 scavtab[SIMPLE_STRING_WIDETAG] = scav_string;
1508 scavtab[SIMPLE_BIT_VECTOR_WIDETAG] = scav_vector_bit;
1509 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1510 scav_vector_unsigned_byte_2;
1511 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1512 scav_vector_unsigned_byte_4;
1513 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1514 scav_vector_unsigned_byte_8;
1515 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1516 scav_vector_unsigned_byte_16;
1517 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1518 scav_vector_unsigned_byte_32;
1519 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1520 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = scav_vector_unsigned_byte_8;
1522 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1523 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1524 scav_vector_unsigned_byte_16;
1526 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1527 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1528 scav_vector_unsigned_byte_32;
1530 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1531 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1532 scav_vector_unsigned_byte_32;
1534 scavtab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = scav_vector_single_float;
1535 scavtab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = scav_vector_double_float;
1536 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1537 scavtab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = scav_vector_long_float;
1539 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1540 scavtab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1541 scav_vector_complex_single_float;
1543 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1544 scavtab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1545 scav_vector_complex_double_float;
1547 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1548 scavtab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1549 scav_vector_complex_long_float;
1551 scavtab[COMPLEX_STRING_WIDETAG] = scav_boxed;
1552 scavtab[COMPLEX_BIT_VECTOR_WIDETAG] = scav_boxed;
1553 scavtab[COMPLEX_VECTOR_WIDETAG] = scav_boxed;
1554 scavtab[COMPLEX_ARRAY_WIDETAG] = scav_boxed;
1555 scavtab[CODE_HEADER_WIDETAG] = scav_code_header;
1556 #ifndef LISP_FEATURE_GENCGC /* FIXME ..._X86 ? */
1557 scavtab[SIMPLE_FUN_HEADER_WIDETAG] = scav_fun_header;
1558 scavtab[CLOSURE_FUN_HEADER_WIDETAG] = scav_fun_header;
1559 scavtab[RETURN_PC_HEADER_WIDETAG] = scav_return_pc_header;
1561 #ifdef LISP_FEATURE_X86
1562 scavtab[CLOSURE_HEADER_WIDETAG] = scav_closure_header;
1563 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_closure_header;
1565 scavtab[CLOSURE_HEADER_WIDETAG] = scav_boxed;
1566 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_boxed;
1568 scavtab[VALUE_CELL_HEADER_WIDETAG] = scav_boxed;
1569 scavtab[SYMBOL_HEADER_WIDETAG] = scav_boxed;
1570 scavtab[BASE_CHAR_WIDETAG] = scav_immediate;
1571 scavtab[SAP_WIDETAG] = scav_unboxed;
1572 scavtab[UNBOUND_MARKER_WIDETAG] = scav_immediate;
1573 scavtab[INSTANCE_HEADER_WIDETAG] = scav_boxed;
1574 #ifdef LISP_FEATURE_SPARC
1575 scavtab[FDEFN_WIDETAG] = scav_boxed;
1577 scavtab[FDEFN_WIDETAG] = scav_fdefn;
1580 /* transport other table, initialized same way as scavtab */
1581 for (i = 0; i < ((sizeof transother)/(sizeof transother[0])); i++)
1582 transother[i] = trans_lose;
1583 transother[BIGNUM_WIDETAG] = trans_unboxed;
1584 transother[RATIO_WIDETAG] = trans_boxed;
1585 transother[SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1586 transother[DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1587 #ifdef LONG_FLOAT_WIDETAG
1588 transother[LONG_FLOAT_WIDETAG] = trans_unboxed;
1590 transother[COMPLEX_WIDETAG] = trans_boxed;
1591 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1592 transother[COMPLEX_SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1594 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1595 transother[COMPLEX_DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1597 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1598 transother[COMPLEX_LONG_FLOAT_WIDETAG] = trans_unboxed;
1600 transother[SIMPLE_ARRAY_WIDETAG] = trans_boxed; /* but not GENCGC */
1601 transother[SIMPLE_STRING_WIDETAG] = trans_string;
1602 transother[SIMPLE_BIT_VECTOR_WIDETAG] = trans_vector_bit;
1603 transother[SIMPLE_VECTOR_WIDETAG] = trans_vector;
1604 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1605 trans_vector_unsigned_byte_2;
1606 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1607 trans_vector_unsigned_byte_4;
1608 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1609 trans_vector_unsigned_byte_8;
1610 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1611 trans_vector_unsigned_byte_16;
1612 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1613 trans_vector_unsigned_byte_32;
1614 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1615 transother[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] =
1616 trans_vector_unsigned_byte_8;
1618 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1619 transother[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1620 trans_vector_unsigned_byte_16;
1622 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1623 transother[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1624 trans_vector_unsigned_byte_32;
1626 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1627 transother[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1628 trans_vector_unsigned_byte_32;
1630 transother[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] =
1631 trans_vector_single_float;
1632 transother[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] =
1633 trans_vector_double_float;
1634 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1635 transother[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] =
1636 trans_vector_long_float;
1638 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1639 transother[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1640 trans_vector_complex_single_float;
1642 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1643 transother[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1644 trans_vector_complex_double_float;
1646 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1647 transother[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1648 trans_vector_complex_long_float;
1650 transother[COMPLEX_STRING_WIDETAG] = trans_boxed;
1651 transother[COMPLEX_BIT_VECTOR_WIDETAG] = trans_boxed;
1652 transother[COMPLEX_VECTOR_WIDETAG] = trans_boxed;
1653 transother[COMPLEX_ARRAY_WIDETAG] = trans_boxed;
1654 transother[CODE_HEADER_WIDETAG] = trans_code_header;
1655 transother[SIMPLE_FUN_HEADER_WIDETAG] = trans_fun_header;
1656 transother[CLOSURE_FUN_HEADER_WIDETAG] = trans_fun_header;
1657 transother[RETURN_PC_HEADER_WIDETAG] = trans_return_pc_header;
1658 transother[CLOSURE_HEADER_WIDETAG] = trans_boxed;
1659 transother[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = trans_boxed;
1660 transother[VALUE_CELL_HEADER_WIDETAG] = trans_boxed;
1661 transother[SYMBOL_HEADER_WIDETAG] = trans_boxed;
1662 transother[BASE_CHAR_WIDETAG] = trans_immediate;
1663 transother[SAP_WIDETAG] = trans_unboxed;
1664 transother[UNBOUND_MARKER_WIDETAG] = trans_immediate;
1665 transother[WEAK_POINTER_WIDETAG] = trans_weak_pointer;
1666 transother[INSTANCE_HEADER_WIDETAG] = trans_boxed;
1667 transother[FDEFN_WIDETAG] = trans_boxed;
1669 /* size table, initialized the same way as scavtab */
1670 for (i = 0; i < ((sizeof sizetab)/(sizeof sizetab[0])); i++)
1671 sizetab[i] = size_lose;
1672 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1673 sizetab[EVEN_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1674 sizetab[FUN_POINTER_LOWTAG|(i<<3)] = size_pointer;
1675 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1676 sizetab[LIST_POINTER_LOWTAG|(i<<3)] = size_pointer;
1677 sizetab[ODD_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1678 sizetab[INSTANCE_POINTER_LOWTAG|(i<<3)] = size_pointer;
1679 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1680 sizetab[OTHER_POINTER_LOWTAG|(i<<3)] = size_pointer;
1682 sizetab[BIGNUM_WIDETAG] = size_unboxed;
1683 sizetab[RATIO_WIDETAG] = size_boxed;
1684 sizetab[SINGLE_FLOAT_WIDETAG] = size_unboxed;
1685 sizetab[DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1686 #ifdef LONG_FLOAT_WIDETAG
1687 sizetab[LONG_FLOAT_WIDETAG] = size_unboxed;
1689 sizetab[COMPLEX_WIDETAG] = size_boxed;
1690 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1691 sizetab[COMPLEX_SINGLE_FLOAT_WIDETAG] = size_unboxed;
1693 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1694 sizetab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1696 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1697 sizetab[COMPLEX_LONG_FLOAT_WIDETAG] = size_unboxed;
1699 sizetab[SIMPLE_ARRAY_WIDETAG] = size_boxed;
1700 sizetab[SIMPLE_STRING_WIDETAG] = size_string;
1701 sizetab[SIMPLE_BIT_VECTOR_WIDETAG] = size_vector_bit;
1702 sizetab[SIMPLE_VECTOR_WIDETAG] = size_vector;
1703 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1704 size_vector_unsigned_byte_2;
1705 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1706 size_vector_unsigned_byte_4;
1707 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1708 size_vector_unsigned_byte_8;
1709 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1710 size_vector_unsigned_byte_16;
1711 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1712 size_vector_unsigned_byte_32;
1713 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1714 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = size_vector_unsigned_byte_8;
1716 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1717 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1718 size_vector_unsigned_byte_16;
1720 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1721 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1722 size_vector_unsigned_byte_32;
1724 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1725 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1726 size_vector_unsigned_byte_32;
1728 sizetab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = size_vector_single_float;
1729 sizetab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = size_vector_double_float;
1730 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1731 sizetab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = size_vector_long_float;
1733 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1734 sizetab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1735 size_vector_complex_single_float;
1737 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1738 sizetab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1739 size_vector_complex_double_float;
1741 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1742 sizetab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1743 size_vector_complex_long_float;
1745 sizetab[COMPLEX_STRING_WIDETAG] = size_boxed;
1746 sizetab[COMPLEX_BIT_VECTOR_WIDETAG] = size_boxed;
1747 sizetab[COMPLEX_VECTOR_WIDETAG] = size_boxed;
1748 sizetab[COMPLEX_ARRAY_WIDETAG] = size_boxed;
1749 sizetab[CODE_HEADER_WIDETAG] = size_code_header;
1751 /* We shouldn't see these, so just lose if it happens. */
1752 sizetab[SIMPLE_FUN_HEADER_WIDETAG] = size_function_header;
1753 sizetab[CLOSURE_FUN_HEADER_WIDETAG] = size_function_header;
1754 sizetab[RETURN_PC_HEADER_WIDETAG] = size_return_pc_header;
1756 sizetab[CLOSURE_HEADER_WIDETAG] = size_boxed;
1757 sizetab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = size_boxed;
1758 sizetab[VALUE_CELL_HEADER_WIDETAG] = size_boxed;
1759 sizetab[SYMBOL_HEADER_WIDETAG] = size_boxed;
1760 sizetab[BASE_CHAR_WIDETAG] = size_immediate;
1761 sizetab[SAP_WIDETAG] = size_unboxed;
1762 sizetab[UNBOUND_MARKER_WIDETAG] = size_immediate;
1763 sizetab[WEAK_POINTER_WIDETAG] = size_weak_pointer;
1764 sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed;
1765 sizetab[FDEFN_WIDETAG] = size_boxed;