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 "genesis/primitive-objects.h"
56 #include "genesis/static-symbols.h"
57 #include "gc-internal.h"
59 #ifdef LISP_FEATURE_SPARC
60 #define LONG_FLOAT_SIZE 4
62 #ifdef LISP_FEATURE_X86
63 #define LONG_FLOAT_SIZE 3
68 forwarding_pointer_p(lispobj *pointer) {
69 lispobj first_word=*pointer;
70 #ifdef LISP_FEATURE_GENCGC
71 return (first_word == 0x01);
73 return (is_lisp_pointer(first_word)
74 && new_space_p(first_word));
78 static inline lispobj *
79 forwarding_pointer_value(lispobj *pointer) {
80 #ifdef LISP_FEATURE_GENCGC
81 return (lispobj *) ((pointer_sized_uint_t) pointer[1]);
83 return (lispobj *) ((pointer_sized_uint_t) pointer[0]);
87 set_forwarding_pointer(lispobj * pointer, lispobj newspace_copy) {
88 #ifdef LISP_FEATURE_GENCGC
90 pointer[1]=newspace_copy;
92 pointer[0]=newspace_copy;
97 int (*scavtab[256])(lispobj *where, lispobj object);
98 lispobj (*transother[256])(lispobj object);
99 int (*sizetab[256])(lispobj *where);
100 struct weak_pointer *weak_pointers;
106 /* to copy a boxed object */
108 copy_object(lispobj object, int nwords)
112 lispobj *source, *dest;
114 gc_assert(is_lisp_pointer(object));
115 gc_assert(from_space_p(object));
116 gc_assert((nwords & 0x01) == 0);
118 /* Get tag of object. */
119 tag = lowtag_of(object);
121 /* Allocate space. */
122 new = gc_general_alloc(nwords*4,ALLOC_BOXED,ALLOC_QUICK);
125 source = (lispobj *) native_pointer(object);
127 /* Copy the object. */
136 return make_lispobj(new,tag);
139 static int scav_lose(lispobj *where, lispobj object); /* forward decl */
141 /* FIXME: Most calls end up going to some trouble to compute an
142 * 'n_words' value for this function. The system might be a little
143 * simpler if this function used an 'end' parameter instead. */
146 scavenge(lispobj *start, long n_words)
148 lispobj *end = start + n_words;
150 int n_words_scavenged;
152 for (object_ptr = start;
154 object_ptr += n_words_scavenged) {
156 lispobj object = *object_ptr;
157 #ifdef LISP_FEATURE_GENCGC
158 gc_assert(!forwarding_pointer_p(object_ptr));
160 if (is_lisp_pointer(object)) {
161 if (from_space_p(object)) {
162 /* It currently points to old space. Check for a
163 * forwarding pointer. */
164 lispobj *ptr = native_pointer(object);
165 if (forwarding_pointer_p(ptr)) {
166 /* Yes, there's a forwarding pointer. */
167 *object_ptr = LOW_WORD(forwarding_pointer_value(ptr));
168 n_words_scavenged = 1;
170 /* Scavenge that pointer. */
172 (scavtab[widetag_of(object)])(object_ptr, object);
175 /* It points somewhere other than oldspace. Leave it
177 n_words_scavenged = 1;
180 #ifndef LISP_FEATURE_GENCGC
181 /* this workaround is probably not necessary for gencgc; at least, the
182 * behaviour it describes has never been reported */
183 else if (n_words==1) {
184 /* there are some situations where an
185 other-immediate may end up in a descriptor
186 register. I'm not sure whether this is
187 supposed to happen, but if it does then we
188 don't want to (a) barf or (b) scavenge over the
189 data-block, because there isn't one. So, if
190 we're checking a single word and it's anything
191 other than a pointer, just hush it up */
192 int type=widetag_of(object);
195 if ((scavtab[type]==scav_lose) ||
196 (((scavtab[type])(start,object))>1)) {
197 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",
202 else if ((object & 3) == 0) {
203 /* It's a fixnum: really easy.. */
204 n_words_scavenged = 1;
206 /* It's some sort of header object or another. */
208 (scavtab[widetag_of(object)])(object_ptr, object);
211 gc_assert(object_ptr == end);
214 static lispobj trans_fun_header(lispobj object); /* forward decls */
215 static lispobj trans_boxed(lispobj object);
218 scav_fun_pointer(lispobj *where, lispobj object)
220 lispobj *first_pointer;
223 gc_assert(is_lisp_pointer(object));
225 /* Object is a pointer into from_space - not a FP. */
226 first_pointer = (lispobj *) native_pointer(object);
228 /* must transport object -- object may point to either a function
229 * header, a closure function header, or to a closure header. */
231 switch (widetag_of(*first_pointer)) {
232 case SIMPLE_FUN_HEADER_WIDETAG:
233 case CLOSURE_FUN_HEADER_WIDETAG:
234 copy = trans_fun_header(object);
237 copy = trans_boxed(object);
241 if (copy != object) {
242 /* Set forwarding pointer */
243 set_forwarding_pointer(first_pointer,copy);
246 gc_assert(is_lisp_pointer(copy));
247 gc_assert(!from_space_p(copy));
256 trans_code(struct code *code)
258 struct code *new_code;
259 lispobj first, l_code, l_new_code;
260 int nheader_words, ncode_words, nwords;
261 unsigned long displacement;
262 lispobj fheaderl, *prev_pointer;
264 /* if object has already been transported, just return pointer */
265 first = code->header;
266 if (forwarding_pointer_p((lispobj *)code)) {
268 printf("Was already transported\n");
270 return (struct code *) forwarding_pointer_value
271 ((lispobj *)((pointer_sized_uint_t) code));
274 gc_assert(widetag_of(first) == CODE_HEADER_WIDETAG);
276 /* prepare to transport the code vector */
277 l_code = (lispobj) LOW_WORD(code) | OTHER_POINTER_LOWTAG;
279 ncode_words = fixnum_value(code->code_size);
280 nheader_words = HeaderValue(code->header);
281 nwords = ncode_words + nheader_words;
282 nwords = CEILING(nwords, 2);
284 l_new_code = copy_object(l_code, nwords);
285 new_code = (struct code *) native_pointer(l_new_code);
287 #if defined(DEBUG_CODE_GC)
288 printf("Old code object at 0x%08x, new code object at 0x%08x.\n",
289 (unsigned long) code, (unsigned long) new_code);
290 printf("Code object is %d words long.\n", nwords);
293 #ifdef LISP_FEATURE_GENCGC
294 if (new_code == code)
298 displacement = l_new_code - l_code;
300 set_forwarding_pointer((lispobj *)code, l_new_code);
302 /* set forwarding pointers for all the function headers in the */
303 /* code object. also fix all self pointers */
305 fheaderl = code->entry_points;
306 prev_pointer = &new_code->entry_points;
308 while (fheaderl != NIL) {
309 struct simple_fun *fheaderp, *nfheaderp;
312 fheaderp = (struct simple_fun *) native_pointer(fheaderl);
313 gc_assert(widetag_of(fheaderp->header) == SIMPLE_FUN_HEADER_WIDETAG);
315 /* Calculate the new function pointer and the new */
316 /* function header. */
317 nfheaderl = fheaderl + displacement;
318 nfheaderp = (struct simple_fun *) native_pointer(nfheaderl);
321 printf("fheaderp->header (at %x) <- %x\n",
322 &(fheaderp->header) , nfheaderl);
324 set_forwarding_pointer((lispobj *)fheaderp, nfheaderl);
326 /* fix self pointer. */
328 #ifdef LISP_FEATURE_GENCGC /* GENCGC? Maybe x86 is better conditional */
329 FUN_RAW_ADDR_OFFSET +
333 *prev_pointer = nfheaderl;
335 fheaderl = fheaderp->next;
336 prev_pointer = &nfheaderp->next;
338 os_flush_icache((os_vm_address_t) (((int *)new_code) + nheader_words),
339 ncode_words * sizeof(int));
340 #ifdef LISP_FEATURE_GENCGC
341 gencgc_apply_code_fixups(code, new_code);
347 scav_code_header(lispobj *where, lispobj object)
350 int n_header_words, n_code_words, n_words;
351 lispobj entry_point; /* tagged pointer to entry point */
352 struct simple_fun *function_ptr; /* untagged pointer to entry point */
354 code = (struct code *) where;
355 n_code_words = fixnum_value(code->code_size);
356 n_header_words = HeaderValue(object);
357 n_words = n_code_words + n_header_words;
358 n_words = CEILING(n_words, 2);
360 /* Scavenge the boxed section of the code data block. */
361 scavenge(where + 1, n_header_words - 1);
363 /* Scavenge the boxed section of each function object in the
364 * code data block. */
365 for (entry_point = code->entry_points;
367 entry_point = function_ptr->next) {
369 gc_assert(is_lisp_pointer(entry_point));
371 function_ptr = (struct simple_fun *) native_pointer(entry_point);
372 gc_assert(widetag_of(function_ptr->header)==SIMPLE_FUN_HEADER_WIDETAG);
374 scavenge(&function_ptr->name, 1);
375 scavenge(&function_ptr->arglist, 1);
376 scavenge(&function_ptr->type, 1);
383 trans_code_header(lispobj object)
387 ncode = trans_code((struct code *) native_pointer(object));
388 return (lispobj) LOW_WORD(ncode) | OTHER_POINTER_LOWTAG;
393 size_code_header(lispobj *where)
396 int nheader_words, ncode_words, nwords;
398 code = (struct code *) where;
400 ncode_words = fixnum_value(code->code_size);
401 nheader_words = HeaderValue(code->header);
402 nwords = ncode_words + nheader_words;
403 nwords = CEILING(nwords, 2);
409 scav_return_pc_header(lispobj *where, lispobj object)
411 lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x",
412 (unsigned long) where,
413 (unsigned long) object);
414 return 0; /* bogus return value to satisfy static type checking */
418 trans_return_pc_header(lispobj object)
420 struct simple_fun *return_pc;
421 unsigned long offset;
422 struct code *code, *ncode;
424 return_pc = (struct simple_fun *) native_pointer(object);
425 offset = HeaderValue(return_pc->header) * 4 ;
427 /* Transport the whole code object */
428 code = (struct code *) ((unsigned long) return_pc - offset);
429 ncode = trans_code(code);
431 return ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG;
434 /* On the 386, closures hold a pointer to the raw address instead of the
435 * function object, so we can use CALL [$FDEFN+const] to invoke
436 * the function without loading it into a register. Given that code
437 * objects don't move, we don't need to update anything, but we do
438 * have to figure out that the function is still live. */
440 #ifdef LISP_FEATURE_X86
442 scav_closure_header(lispobj *where, lispobj object)
444 struct closure *closure;
447 closure = (struct closure *)where;
448 fun = closure->fun - FUN_RAW_ADDR_OFFSET;
450 #ifdef LISP_FEATURE_GENCGC
451 /* The function may have moved so update the raw address. But
452 * don't write unnecessarily. */
453 if (closure->fun != fun + FUN_RAW_ADDR_OFFSET)
454 closure->fun = fun + FUN_RAW_ADDR_OFFSET;
461 scav_fun_header(lispobj *where, lispobj object)
463 lose("attempted to scavenge a function header where=0x%08x object=0x%08x",
464 (unsigned long) where,
465 (unsigned long) object);
466 return 0; /* bogus return value to satisfy static type checking */
470 trans_fun_header(lispobj object)
472 struct simple_fun *fheader;
473 unsigned long offset;
474 struct code *code, *ncode;
476 fheader = (struct simple_fun *) native_pointer(object);
477 offset = HeaderValue(fheader->header) * 4;
479 /* Transport the whole code object */
480 code = (struct code *) ((unsigned long) fheader - offset);
481 ncode = trans_code(code);
483 return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG;
492 scav_instance_pointer(lispobj *where, lispobj object)
494 lispobj copy, *first_pointer;
496 /* Object is a pointer into from space - not a FP. */
497 copy = trans_boxed(object);
499 #ifdef LISP_FEATURE_GENCGC
500 gc_assert(copy != object);
503 first_pointer = (lispobj *) native_pointer(object);
504 set_forwarding_pointer(first_pointer,copy);
515 static lispobj trans_list(lispobj object);
518 scav_list_pointer(lispobj *where, lispobj object)
520 lispobj first, *first_pointer;
522 gc_assert(is_lisp_pointer(object));
524 /* Object is a pointer into from space - not FP. */
525 first_pointer = (lispobj *) native_pointer(object);
527 first = trans_list(object);
528 gc_assert(first != object);
530 /* Set forwarding pointer */
531 set_forwarding_pointer(first_pointer, first);
533 gc_assert(is_lisp_pointer(first));
534 gc_assert(!from_space_p(first));
542 trans_list(lispobj object)
544 lispobj new_list_pointer;
545 struct cons *cons, *new_cons;
548 cons = (struct cons *) native_pointer(object);
551 new_cons = (struct cons *)
552 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
553 new_cons->car = cons->car;
554 new_cons->cdr = cons->cdr; /* updated later */
555 new_list_pointer = make_lispobj(new_cons,lowtag_of(object));
557 /* Grab the cdr: set_forwarding_pointer will clobber it in GENCGC */
560 set_forwarding_pointer((lispobj *)cons, new_list_pointer);
562 /* Try to linearize the list in the cdr direction to help reduce
566 struct cons *cdr_cons, *new_cdr_cons;
568 if(lowtag_of(cdr) != LIST_POINTER_LOWTAG ||
569 !from_space_p(cdr) ||
570 forwarding_pointer_p((lispobj *)native_pointer(cdr)))
573 cdr_cons = (struct cons *) native_pointer(cdr);
576 new_cdr_cons = (struct cons*)
577 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
578 new_cdr_cons->car = cdr_cons->car;
579 new_cdr_cons->cdr = cdr_cons->cdr;
580 new_cdr = make_lispobj(new_cdr_cons, lowtag_of(cdr));
582 /* Grab the cdr before it is clobbered. */
584 set_forwarding_pointer((lispobj *)cdr_cons, new_cdr);
586 /* Update the cdr of the last cons copied into new space to
587 * keep the newspace scavenge from having to do it. */
588 new_cons->cdr = new_cdr;
590 new_cons = new_cdr_cons;
593 return new_list_pointer;
598 * scavenging and transporting other pointers
602 scav_other_pointer(lispobj *where, lispobj object)
604 lispobj first, *first_pointer;
606 gc_assert(is_lisp_pointer(object));
608 /* Object is a pointer into from space - not FP. */
609 first_pointer = (lispobj *) native_pointer(object);
610 first = (transother[widetag_of(*first_pointer)])(object);
612 if (first != object) {
613 set_forwarding_pointer(first_pointer, first);
614 #ifdef LISP_FEATURE_GENCGC
618 #ifndef LISP_FEATURE_GENCGC
621 gc_assert(is_lisp_pointer(first));
622 gc_assert(!from_space_p(first));
628 * immediate, boxed, and unboxed objects
632 size_pointer(lispobj *where)
638 scav_immediate(lispobj *where, lispobj object)
644 trans_immediate(lispobj object)
646 lose("trying to transport an immediate");
647 return NIL; /* bogus return value to satisfy static type checking */
651 size_immediate(lispobj *where)
658 scav_boxed(lispobj *where, lispobj object)
664 trans_boxed(lispobj object)
667 unsigned long length;
669 gc_assert(is_lisp_pointer(object));
671 header = *((lispobj *) native_pointer(object));
672 length = HeaderValue(header) + 1;
673 length = CEILING(length, 2);
675 return copy_object(object, length);
680 size_boxed(lispobj *where)
683 unsigned long length;
686 length = HeaderValue(header) + 1;
687 length = CEILING(length, 2);
692 /* Note: on the sparc we don't have to do anything special for fdefns, */
693 /* 'cause the raw-addr has a function lowtag. */
694 #ifndef LISP_FEATURE_SPARC
696 scav_fdefn(lispobj *where, lispobj object)
700 fdefn = (struct fdefn *)where;
702 /* FSHOW((stderr, "scav_fdefn, function = %p, raw_addr = %p\n",
703 fdefn->fun, fdefn->raw_addr)); */
705 if ((char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET)
706 == (char *)((unsigned long)(fdefn->raw_addr))) {
707 scavenge(where + 1, sizeof(struct fdefn)/sizeof(lispobj) - 1);
709 /* Don't write unnecessarily. */
710 if (fdefn->raw_addr != (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET))
711 fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
712 /* gc.c has more casts here, which may be relevant or alternatively
713 may be compiler warning defeaters. try
715 (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
717 return sizeof(struct fdefn) / sizeof(lispobj);
725 scav_unboxed(lispobj *where, lispobj object)
727 unsigned long length;
729 length = HeaderValue(object) + 1;
730 length = CEILING(length, 2);
736 trans_unboxed(lispobj object)
739 unsigned long length;
742 gc_assert(is_lisp_pointer(object));
744 header = *((lispobj *) native_pointer(object));
745 length = HeaderValue(header) + 1;
746 length = CEILING(length, 2);
748 return copy_unboxed_object(object, length);
752 size_unboxed(lispobj *where)
755 unsigned long length;
758 length = HeaderValue(header) + 1;
759 length = CEILING(length, 2);
765 /* vector-like objects */
767 #define NWORDS(x,y) (CEILING((x),(y)) / (y))
769 scav_string(lispobj *where, lispobj object)
771 struct vector *vector;
774 /* NOTE: Strings contain one more byte of data than the length */
775 /* slot indicates. */
777 vector = (struct vector *) where;
778 length = fixnum_value(vector->length) + 1;
779 nwords = CEILING(NWORDS(length, 4) + 2, 2);
784 trans_string(lispobj object)
786 struct vector *vector;
789 gc_assert(is_lisp_pointer(object));
791 /* NOTE: A string contains one more byte of data (a terminating
792 * '\0' to help when interfacing with C functions) than indicated
793 * by the length slot. */
795 vector = (struct vector *) native_pointer(object);
796 length = fixnum_value(vector->length) + 1;
797 nwords = CEILING(NWORDS(length, 4) + 2, 2);
799 return copy_large_unboxed_object(object, nwords);
803 size_string(lispobj *where)
805 struct vector *vector;
808 /* NOTE: A string contains one more byte of data (a terminating
809 * '\0' to help when interfacing with C functions) than indicated
810 * by the length slot. */
812 vector = (struct vector *) where;
813 length = fixnum_value(vector->length) + 1;
814 nwords = CEILING(NWORDS(length, 4) + 2, 2);
820 trans_vector(lispobj object)
822 struct vector *vector;
825 gc_assert(is_lisp_pointer(object));
827 vector = (struct vector *) native_pointer(object);
829 length = fixnum_value(vector->length);
830 nwords = CEILING(length + 2, 2);
832 return copy_large_object(object, nwords);
836 size_vector(lispobj *where)
838 struct vector *vector;
841 vector = (struct vector *) where;
842 length = fixnum_value(vector->length);
843 nwords = CEILING(length + 2, 2);
849 scav_vector_nil(lispobj *where, lispobj object)
855 trans_vector_nil(lispobj object)
857 gc_assert(is_lisp_pointer(object));
858 return copy_unboxed_object(object, 2);
862 size_vector_nil(lispobj *where)
864 /* Just the header word and the length word */
869 scav_vector_bit(lispobj *where, lispobj object)
871 struct vector *vector;
874 vector = (struct vector *) where;
875 length = fixnum_value(vector->length);
876 nwords = CEILING(NWORDS(length, 32) + 2, 2);
882 trans_vector_bit(lispobj object)
884 struct vector *vector;
887 gc_assert(is_lisp_pointer(object));
889 vector = (struct vector *) native_pointer(object);
890 length = fixnum_value(vector->length);
891 nwords = CEILING(NWORDS(length, 32) + 2, 2);
893 return copy_large_unboxed_object(object, nwords);
897 size_vector_bit(lispobj *where)
899 struct vector *vector;
902 vector = (struct vector *) where;
903 length = fixnum_value(vector->length);
904 nwords = CEILING(NWORDS(length, 32) + 2, 2);
910 scav_vector_unsigned_byte_2(lispobj *where, lispobj object)
912 struct vector *vector;
915 vector = (struct vector *) where;
916 length = fixnum_value(vector->length);
917 nwords = CEILING(NWORDS(length, 16) + 2, 2);
923 trans_vector_unsigned_byte_2(lispobj object)
925 struct vector *vector;
928 gc_assert(is_lisp_pointer(object));
930 vector = (struct vector *) native_pointer(object);
931 length = fixnum_value(vector->length);
932 nwords = CEILING(NWORDS(length, 16) + 2, 2);
934 return copy_large_unboxed_object(object, nwords);
938 size_vector_unsigned_byte_2(lispobj *where)
940 struct vector *vector;
943 vector = (struct vector *) where;
944 length = fixnum_value(vector->length);
945 nwords = CEILING(NWORDS(length, 16) + 2, 2);
951 scav_vector_unsigned_byte_4(lispobj *where, lispobj object)
953 struct vector *vector;
956 vector = (struct vector *) where;
957 length = fixnum_value(vector->length);
958 nwords = CEILING(NWORDS(length, 8) + 2, 2);
964 trans_vector_unsigned_byte_4(lispobj object)
966 struct vector *vector;
969 gc_assert(is_lisp_pointer(object));
971 vector = (struct vector *) native_pointer(object);
972 length = fixnum_value(vector->length);
973 nwords = CEILING(NWORDS(length, 8) + 2, 2);
975 return copy_large_unboxed_object(object, nwords);
978 size_vector_unsigned_byte_4(lispobj *where)
980 struct vector *vector;
983 vector = (struct vector *) where;
984 length = fixnum_value(vector->length);
985 nwords = CEILING(NWORDS(length, 8) + 2, 2);
992 scav_vector_unsigned_byte_8(lispobj *where, lispobj object)
994 struct vector *vector;
997 vector = (struct vector *) where;
998 length = fixnum_value(vector->length);
999 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1004 /*********************/
1009 trans_vector_unsigned_byte_8(lispobj object)
1011 struct vector *vector;
1014 gc_assert(is_lisp_pointer(object));
1016 vector = (struct vector *) native_pointer(object);
1017 length = fixnum_value(vector->length);
1018 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1020 return copy_large_unboxed_object(object, nwords);
1024 size_vector_unsigned_byte_8(lispobj *where)
1026 struct vector *vector;
1029 vector = (struct vector *) where;
1030 length = fixnum_value(vector->length);
1031 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1038 scav_vector_unsigned_byte_16(lispobj *where, lispobj object)
1040 struct vector *vector;
1043 vector = (struct vector *) where;
1044 length = fixnum_value(vector->length);
1045 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1051 trans_vector_unsigned_byte_16(lispobj object)
1053 struct vector *vector;
1056 gc_assert(is_lisp_pointer(object));
1058 vector = (struct vector *) native_pointer(object);
1059 length = fixnum_value(vector->length);
1060 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1062 return copy_large_unboxed_object(object, nwords);
1066 size_vector_unsigned_byte_16(lispobj *where)
1068 struct vector *vector;
1071 vector = (struct vector *) where;
1072 length = fixnum_value(vector->length);
1073 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1079 scav_vector_unsigned_byte_32(lispobj *where, lispobj object)
1081 struct vector *vector;
1084 vector = (struct vector *) where;
1085 length = fixnum_value(vector->length);
1086 nwords = CEILING(length + 2, 2);
1092 trans_vector_unsigned_byte_32(lispobj object)
1094 struct vector *vector;
1097 gc_assert(is_lisp_pointer(object));
1099 vector = (struct vector *) native_pointer(object);
1100 length = fixnum_value(vector->length);
1101 nwords = CEILING(length + 2, 2);
1103 return copy_large_unboxed_object(object, nwords);
1107 size_vector_unsigned_byte_32(lispobj *where)
1109 struct vector *vector;
1112 vector = (struct vector *) where;
1113 length = fixnum_value(vector->length);
1114 nwords = CEILING(length + 2, 2);
1120 scav_vector_single_float(lispobj *where, lispobj object)
1122 struct vector *vector;
1125 vector = (struct vector *) where;
1126 length = fixnum_value(vector->length);
1127 nwords = CEILING(length + 2, 2);
1133 trans_vector_single_float(lispobj object)
1135 struct vector *vector;
1138 gc_assert(is_lisp_pointer(object));
1140 vector = (struct vector *) native_pointer(object);
1141 length = fixnum_value(vector->length);
1142 nwords = CEILING(length + 2, 2);
1144 return copy_large_unboxed_object(object, nwords);
1148 size_vector_single_float(lispobj *where)
1150 struct vector *vector;
1153 vector = (struct vector *) where;
1154 length = fixnum_value(vector->length);
1155 nwords = CEILING(length + 2, 2);
1161 scav_vector_double_float(lispobj *where, lispobj object)
1163 struct vector *vector;
1166 vector = (struct vector *) where;
1167 length = fixnum_value(vector->length);
1168 nwords = CEILING(length * 2 + 2, 2);
1174 trans_vector_double_float(lispobj object)
1176 struct vector *vector;
1179 gc_assert(is_lisp_pointer(object));
1181 vector = (struct vector *) native_pointer(object);
1182 length = fixnum_value(vector->length);
1183 nwords = CEILING(length * 2 + 2, 2);
1185 return copy_large_unboxed_object(object, nwords);
1189 size_vector_double_float(lispobj *where)
1191 struct vector *vector;
1194 vector = (struct vector *) where;
1195 length = fixnum_value(vector->length);
1196 nwords = CEILING(length * 2 + 2, 2);
1201 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1203 scav_vector_long_float(lispobj *where, lispobj object)
1205 struct vector *vector;
1208 vector = (struct vector *) where;
1209 length = fixnum_value(vector->length);
1210 nwords = CEILING(length *
1217 trans_vector_long_float(lispobj object)
1219 struct vector *vector;
1222 gc_assert(is_lisp_pointer(object));
1224 vector = (struct vector *) native_pointer(object);
1225 length = fixnum_value(vector->length);
1226 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1228 return copy_large_unboxed_object(object, nwords);
1232 size_vector_long_float(lispobj *where)
1234 struct vector *vector;
1237 vector = (struct vector *) where;
1238 length = fixnum_value(vector->length);
1239 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1246 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1248 scav_vector_complex_single_float(lispobj *where, lispobj object)
1250 struct vector *vector;
1253 vector = (struct vector *) where;
1254 length = fixnum_value(vector->length);
1255 nwords = CEILING(length * 2 + 2, 2);
1261 trans_vector_complex_single_float(lispobj object)
1263 struct vector *vector;
1266 gc_assert(is_lisp_pointer(object));
1268 vector = (struct vector *) native_pointer(object);
1269 length = fixnum_value(vector->length);
1270 nwords = CEILING(length * 2 + 2, 2);
1272 return copy_large_unboxed_object(object, nwords);
1276 size_vector_complex_single_float(lispobj *where)
1278 struct vector *vector;
1281 vector = (struct vector *) where;
1282 length = fixnum_value(vector->length);
1283 nwords = CEILING(length * 2 + 2, 2);
1289 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1291 scav_vector_complex_double_float(lispobj *where, lispobj object)
1293 struct vector *vector;
1296 vector = (struct vector *) where;
1297 length = fixnum_value(vector->length);
1298 nwords = CEILING(length * 4 + 2, 2);
1304 trans_vector_complex_double_float(lispobj object)
1306 struct vector *vector;
1309 gc_assert(is_lisp_pointer(object));
1311 vector = (struct vector *) native_pointer(object);
1312 length = fixnum_value(vector->length);
1313 nwords = CEILING(length * 4 + 2, 2);
1315 return copy_large_unboxed_object(object, nwords);
1319 size_vector_complex_double_float(lispobj *where)
1321 struct vector *vector;
1324 vector = (struct vector *) where;
1325 length = fixnum_value(vector->length);
1326 nwords = CEILING(length * 4 + 2, 2);
1333 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1335 scav_vector_complex_long_float(lispobj *where, lispobj object)
1337 struct vector *vector;
1340 vector = (struct vector *) where;
1341 length = fixnum_value(vector->length);
1342 nwords = CEILING(length * (2* LONG_FLOAT_SIZE) + 2, 2);
1348 trans_vector_complex_long_float(lispobj object)
1350 struct vector *vector;
1353 gc_assert(is_lisp_pointer(object));
1355 vector = (struct vector *) native_pointer(object);
1356 length = fixnum_value(vector->length);
1357 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1359 return copy_large_unboxed_object(object, nwords);
1363 size_vector_complex_long_float(lispobj *where)
1365 struct vector *vector;
1368 vector = (struct vector *) where;
1369 length = fixnum_value(vector->length);
1370 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1376 #define WEAK_POINTER_NWORDS \
1377 CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2)
1380 trans_weak_pointer(lispobj object)
1383 #ifndef LISP_FEATURE_GENCGC
1384 struct weak_pointer *wp;
1386 gc_assert(is_lisp_pointer(object));
1388 #if defined(DEBUG_WEAK)
1389 printf("Transporting weak pointer from 0x%08x\n", object);
1392 /* Need to remember where all the weak pointers are that have */
1393 /* been transported so they can be fixed up in a post-GC pass. */
1395 copy = copy_object(object, WEAK_POINTER_NWORDS);
1396 #ifndef LISP_FEATURE_GENCGC
1397 wp = (struct weak_pointer *) native_pointer(copy);
1399 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1400 /* Push the weak pointer onto the list of weak pointers. */
1401 wp->next = LOW_WORD(weak_pointers);
1408 size_weak_pointer(lispobj *where)
1410 return WEAK_POINTER_NWORDS;
1414 void scan_weak_pointers(void)
1416 struct weak_pointer *wp;
1417 for (wp = weak_pointers; wp != NULL;
1418 wp=(struct weak_pointer *)native_pointer(wp->next)) {
1419 lispobj value = wp->value;
1420 lispobj *first_pointer;
1421 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1422 if (!(is_lisp_pointer(value) && from_space_p(value)))
1425 /* Now, we need to check whether the object has been forwarded. If
1426 * it has been, the weak pointer is still good and needs to be
1427 * updated. Otherwise, the weak pointer needs to be nil'ed
1430 first_pointer = (lispobj *)native_pointer(value);
1432 if (forwarding_pointer_p(first_pointer)) {
1434 (lispobj)LOW_WORD(forwarding_pointer_value(first_pointer));
1450 scav_lose(lispobj *where, lispobj object)
1452 lose("no scavenge function for object 0x%08x (widetag 0x%x)",
1453 (unsigned long)object,
1454 widetag_of(*(lispobj*)native_pointer(object)));
1455 return 0; /* bogus return value to satisfy static type checking */
1459 trans_lose(lispobj object)
1461 lose("no transport function for object 0x%08x (widetag 0x%x)",
1462 (unsigned long)object,
1463 widetag_of(*(lispobj*)native_pointer(object)));
1464 return NIL; /* bogus return value to satisfy static type checking */
1468 size_lose(lispobj *where)
1470 lose("no size function for object at 0x%08x (widetag 0x%x)",
1471 (unsigned long)where,
1472 widetag_of(LOW_WORD(where)));
1473 return 1; /* bogus return value to satisfy static type checking */
1482 gc_init_tables(void)
1486 /* Set default value in all slots of scavenge table. FIXME
1487 * replace this gnarly sizeof with something based on
1489 for (i = 0; i < ((sizeof scavtab)/(sizeof scavtab[0])); i++) {
1490 scavtab[i] = scav_lose;
1493 /* For each type which can be selected by the lowtag alone, set
1494 * multiple entries in our widetag scavenge table (one for each
1495 * possible value of the high bits).
1498 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1499 scavtab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1500 scavtab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_fun_pointer;
1501 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1502 scavtab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_list_pointer;
1503 scavtab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1504 scavtab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_instance_pointer;
1505 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1506 scavtab[OTHER_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_other_pointer;
1509 /* Other-pointer types (those selected by all eight bits of the
1510 * tag) get one entry each in the scavenge table. */
1511 scavtab[BIGNUM_WIDETAG] = scav_unboxed;
1512 scavtab[RATIO_WIDETAG] = scav_boxed;
1513 scavtab[SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1514 scavtab[DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1515 #ifdef LONG_FLOAT_WIDETAG
1516 scavtab[LONG_FLOAT_WIDETAG] = scav_unboxed;
1518 scavtab[COMPLEX_WIDETAG] = scav_boxed;
1519 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1520 scavtab[COMPLEX_SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1522 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1523 scavtab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1525 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1526 scavtab[COMPLEX_LONG_FLOAT_WIDETAG] = scav_unboxed;
1528 scavtab[SIMPLE_ARRAY_WIDETAG] = scav_boxed;
1529 scavtab[SIMPLE_STRING_WIDETAG] = scav_string;
1530 scavtab[SIMPLE_BIT_VECTOR_WIDETAG] = scav_vector_bit;
1531 scavtab[SIMPLE_ARRAY_NIL_WIDETAG] = scav_vector_nil;
1532 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1533 scav_vector_unsigned_byte_2;
1534 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1535 scav_vector_unsigned_byte_4;
1536 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1537 scav_vector_unsigned_byte_8;
1538 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1539 scav_vector_unsigned_byte_16;
1540 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1541 scav_vector_unsigned_byte_32;
1542 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1543 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = scav_vector_unsigned_byte_8;
1545 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1546 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1547 scav_vector_unsigned_byte_16;
1549 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1550 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1551 scav_vector_unsigned_byte_32;
1553 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1554 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1555 scav_vector_unsigned_byte_32;
1557 scavtab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = scav_vector_single_float;
1558 scavtab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = scav_vector_double_float;
1559 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1560 scavtab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = scav_vector_long_float;
1562 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1563 scavtab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1564 scav_vector_complex_single_float;
1566 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1567 scavtab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1568 scav_vector_complex_double_float;
1570 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1571 scavtab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1572 scav_vector_complex_long_float;
1574 scavtab[COMPLEX_STRING_WIDETAG] = scav_boxed;
1575 scavtab[COMPLEX_BIT_VECTOR_WIDETAG] = scav_boxed;
1576 scavtab[COMPLEX_VECTOR_WIDETAG] = scav_boxed;
1577 scavtab[COMPLEX_ARRAY_WIDETAG] = scav_boxed;
1578 scavtab[CODE_HEADER_WIDETAG] = scav_code_header;
1579 #ifndef LISP_FEATURE_GENCGC /* FIXME ..._X86 ? */
1580 scavtab[SIMPLE_FUN_HEADER_WIDETAG] = scav_fun_header;
1581 scavtab[CLOSURE_FUN_HEADER_WIDETAG] = scav_fun_header;
1582 scavtab[RETURN_PC_HEADER_WIDETAG] = scav_return_pc_header;
1584 #ifdef LISP_FEATURE_X86
1585 scavtab[CLOSURE_HEADER_WIDETAG] = scav_closure_header;
1586 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_closure_header;
1588 scavtab[CLOSURE_HEADER_WIDETAG] = scav_boxed;
1589 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_boxed;
1591 scavtab[VALUE_CELL_HEADER_WIDETAG] = scav_boxed;
1592 scavtab[SYMBOL_HEADER_WIDETAG] = scav_boxed;
1593 scavtab[BASE_CHAR_WIDETAG] = scav_immediate;
1594 scavtab[SAP_WIDETAG] = scav_unboxed;
1595 scavtab[UNBOUND_MARKER_WIDETAG] = scav_immediate;
1596 scavtab[INSTANCE_HEADER_WIDETAG] = scav_boxed;
1597 #ifdef LISP_FEATURE_SPARC
1598 scavtab[FDEFN_WIDETAG] = scav_boxed;
1600 scavtab[FDEFN_WIDETAG] = scav_fdefn;
1603 /* transport other table, initialized same way as scavtab */
1604 for (i = 0; i < ((sizeof transother)/(sizeof transother[0])); i++)
1605 transother[i] = trans_lose;
1606 transother[BIGNUM_WIDETAG] = trans_unboxed;
1607 transother[RATIO_WIDETAG] = trans_boxed;
1608 transother[SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1609 transother[DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1610 #ifdef LONG_FLOAT_WIDETAG
1611 transother[LONG_FLOAT_WIDETAG] = trans_unboxed;
1613 transother[COMPLEX_WIDETAG] = trans_boxed;
1614 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1615 transother[COMPLEX_SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1617 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1618 transother[COMPLEX_DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1620 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1621 transother[COMPLEX_LONG_FLOAT_WIDETAG] = trans_unboxed;
1623 transother[SIMPLE_ARRAY_WIDETAG] = trans_boxed; /* but not GENCGC */
1624 transother[SIMPLE_STRING_WIDETAG] = trans_string;
1625 transother[SIMPLE_BIT_VECTOR_WIDETAG] = trans_vector_bit;
1626 transother[SIMPLE_VECTOR_WIDETAG] = trans_vector;
1627 transother[SIMPLE_ARRAY_NIL_WIDETAG] = trans_vector_nil;
1628 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1629 trans_vector_unsigned_byte_2;
1630 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1631 trans_vector_unsigned_byte_4;
1632 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1633 trans_vector_unsigned_byte_8;
1634 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1635 trans_vector_unsigned_byte_16;
1636 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1637 trans_vector_unsigned_byte_32;
1638 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1639 transother[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] =
1640 trans_vector_unsigned_byte_8;
1642 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1643 transother[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1644 trans_vector_unsigned_byte_16;
1646 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1647 transother[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1648 trans_vector_unsigned_byte_32;
1650 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1651 transother[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1652 trans_vector_unsigned_byte_32;
1654 transother[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] =
1655 trans_vector_single_float;
1656 transother[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] =
1657 trans_vector_double_float;
1658 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1659 transother[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] =
1660 trans_vector_long_float;
1662 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1663 transother[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1664 trans_vector_complex_single_float;
1666 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1667 transother[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1668 trans_vector_complex_double_float;
1670 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1671 transother[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1672 trans_vector_complex_long_float;
1674 transother[COMPLEX_STRING_WIDETAG] = trans_boxed;
1675 transother[COMPLEX_BIT_VECTOR_WIDETAG] = trans_boxed;
1676 transother[COMPLEX_VECTOR_WIDETAG] = trans_boxed;
1677 transother[COMPLEX_ARRAY_WIDETAG] = trans_boxed;
1678 transother[CODE_HEADER_WIDETAG] = trans_code_header;
1679 transother[SIMPLE_FUN_HEADER_WIDETAG] = trans_fun_header;
1680 transother[CLOSURE_FUN_HEADER_WIDETAG] = trans_fun_header;
1681 transother[RETURN_PC_HEADER_WIDETAG] = trans_return_pc_header;
1682 transother[CLOSURE_HEADER_WIDETAG] = trans_boxed;
1683 transother[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = trans_boxed;
1684 transother[VALUE_CELL_HEADER_WIDETAG] = trans_boxed;
1685 transother[SYMBOL_HEADER_WIDETAG] = trans_boxed;
1686 transother[BASE_CHAR_WIDETAG] = trans_immediate;
1687 transother[SAP_WIDETAG] = trans_unboxed;
1688 transother[UNBOUND_MARKER_WIDETAG] = trans_immediate;
1689 transother[WEAK_POINTER_WIDETAG] = trans_weak_pointer;
1690 transother[INSTANCE_HEADER_WIDETAG] = trans_boxed;
1691 transother[FDEFN_WIDETAG] = trans_boxed;
1693 /* size table, initialized the same way as scavtab */
1694 for (i = 0; i < ((sizeof sizetab)/(sizeof sizetab[0])); i++)
1695 sizetab[i] = size_lose;
1696 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1697 sizetab[EVEN_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1698 sizetab[FUN_POINTER_LOWTAG|(i<<3)] = size_pointer;
1699 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1700 sizetab[LIST_POINTER_LOWTAG|(i<<3)] = size_pointer;
1701 sizetab[ODD_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1702 sizetab[INSTANCE_POINTER_LOWTAG|(i<<3)] = size_pointer;
1703 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1704 sizetab[OTHER_POINTER_LOWTAG|(i<<3)] = size_pointer;
1706 sizetab[BIGNUM_WIDETAG] = size_unboxed;
1707 sizetab[RATIO_WIDETAG] = size_boxed;
1708 sizetab[SINGLE_FLOAT_WIDETAG] = size_unboxed;
1709 sizetab[DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1710 #ifdef LONG_FLOAT_WIDETAG
1711 sizetab[LONG_FLOAT_WIDETAG] = size_unboxed;
1713 sizetab[COMPLEX_WIDETAG] = size_boxed;
1714 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1715 sizetab[COMPLEX_SINGLE_FLOAT_WIDETAG] = size_unboxed;
1717 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1718 sizetab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1720 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1721 sizetab[COMPLEX_LONG_FLOAT_WIDETAG] = size_unboxed;
1723 sizetab[SIMPLE_ARRAY_WIDETAG] = size_boxed;
1724 sizetab[SIMPLE_STRING_WIDETAG] = size_string;
1725 sizetab[SIMPLE_BIT_VECTOR_WIDETAG] = size_vector_bit;
1726 sizetab[SIMPLE_VECTOR_WIDETAG] = size_vector;
1727 sizetab[SIMPLE_ARRAY_NIL_WIDETAG] = size_vector_nil;
1728 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1729 size_vector_unsigned_byte_2;
1730 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1731 size_vector_unsigned_byte_4;
1732 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1733 size_vector_unsigned_byte_8;
1734 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1735 size_vector_unsigned_byte_16;
1736 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1737 size_vector_unsigned_byte_32;
1738 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1739 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = size_vector_unsigned_byte_8;
1741 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1742 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1743 size_vector_unsigned_byte_16;
1745 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1746 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1747 size_vector_unsigned_byte_32;
1749 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1750 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1751 size_vector_unsigned_byte_32;
1753 sizetab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = size_vector_single_float;
1754 sizetab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = size_vector_double_float;
1755 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1756 sizetab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = size_vector_long_float;
1758 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1759 sizetab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1760 size_vector_complex_single_float;
1762 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1763 sizetab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1764 size_vector_complex_double_float;
1766 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1767 sizetab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1768 size_vector_complex_long_float;
1770 sizetab[COMPLEX_STRING_WIDETAG] = size_boxed;
1771 sizetab[COMPLEX_BIT_VECTOR_WIDETAG] = size_boxed;
1772 sizetab[COMPLEX_VECTOR_WIDETAG] = size_boxed;
1773 sizetab[COMPLEX_ARRAY_WIDETAG] = size_boxed;
1774 sizetab[CODE_HEADER_WIDETAG] = size_code_header;
1776 /* We shouldn't see these, so just lose if it happens. */
1777 sizetab[SIMPLE_FUN_HEADER_WIDETAG] = size_function_header;
1778 sizetab[CLOSURE_FUN_HEADER_WIDETAG] = size_function_header;
1779 sizetab[RETURN_PC_HEADER_WIDETAG] = size_return_pc_header;
1781 sizetab[CLOSURE_HEADER_WIDETAG] = size_boxed;
1782 sizetab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = size_boxed;
1783 sizetab[VALUE_CELL_HEADER_WIDETAG] = size_boxed;
1784 sizetab[SYMBOL_HEADER_WIDETAG] = size_boxed;
1785 sizetab[BASE_CHAR_WIDETAG] = size_immediate;
1786 sizetab[SAP_WIDETAG] = size_unboxed;
1787 sizetab[UNBOUND_MARKER_WIDETAG] = size_immediate;
1788 sizetab[WEAK_POINTER_WIDETAG] = size_weak_pointer;
1789 sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed;
1790 sizetab[FDEFN_WIDETAG] = size_boxed;