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;
102 unsigned long bytes_consed_between_gcs = 12*1024*1024;
109 /* to copy a boxed object */
111 copy_object(lispobj object, int nwords)
115 lispobj *source, *dest;
117 gc_assert(is_lisp_pointer(object));
118 gc_assert(from_space_p(object));
119 gc_assert((nwords & 0x01) == 0);
121 /* Get tag of object. */
122 tag = lowtag_of(object);
124 /* Allocate space. */
125 new = gc_general_alloc(nwords*4,ALLOC_BOXED,ALLOC_QUICK);
128 source = (lispobj *) native_pointer(object);
130 /* Copy the object. */
139 return make_lispobj(new,tag);
142 static int scav_lose(lispobj *where, lispobj object); /* forward decl */
144 /* FIXME: Most calls end up going to some trouble to compute an
145 * 'n_words' value for this function. The system might be a little
146 * simpler if this function used an 'end' parameter instead. */
149 scavenge(lispobj *start, long n_words)
151 lispobj *end = start + n_words;
153 int n_words_scavenged;
155 for (object_ptr = start;
157 object_ptr += n_words_scavenged) {
159 lispobj object = *object_ptr;
160 #ifdef LISP_FEATURE_GENCGC
161 gc_assert(!forwarding_pointer_p(object_ptr));
163 if (is_lisp_pointer(object)) {
164 if (from_space_p(object)) {
165 /* It currently points to old space. Check for a
166 * forwarding pointer. */
167 lispobj *ptr = native_pointer(object);
168 if (forwarding_pointer_p(ptr)) {
169 /* Yes, there's a forwarding pointer. */
170 *object_ptr = LOW_WORD(forwarding_pointer_value(ptr));
171 n_words_scavenged = 1;
173 /* Scavenge that pointer. */
175 (scavtab[widetag_of(object)])(object_ptr, object);
178 /* It points somewhere other than oldspace. Leave it
180 n_words_scavenged = 1;
183 #ifndef LISP_FEATURE_GENCGC
184 /* this workaround is probably not necessary for gencgc; at least, the
185 * behaviour it describes has never been reported */
186 else if (n_words==1) {
187 /* there are some situations where an
188 other-immediate may end up in a descriptor
189 register. I'm not sure whether this is
190 supposed to happen, but if it does then we
191 don't want to (a) barf or (b) scavenge over the
192 data-block, because there isn't one. So, if
193 we're checking a single word and it's anything
194 other than a pointer, just hush it up */
195 int type=widetag_of(object);
198 if ((scavtab[type]==scav_lose) ||
199 (((scavtab[type])(start,object))>1)) {
200 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",
205 else if ((object & 3) == 0) {
206 /* It's a fixnum: really easy.. */
207 n_words_scavenged = 1;
209 /* It's some sort of header object or another. */
211 (scavtab[widetag_of(object)])(object_ptr, object);
214 gc_assert(object_ptr == end);
217 static lispobj trans_fun_header(lispobj object); /* forward decls */
218 static lispobj trans_boxed(lispobj object);
221 scav_fun_pointer(lispobj *where, lispobj object)
223 lispobj *first_pointer;
226 gc_assert(is_lisp_pointer(object));
228 /* Object is a pointer into from_space - not a FP. */
229 first_pointer = (lispobj *) native_pointer(object);
231 /* must transport object -- object may point to either a function
232 * header, a closure function header, or to a closure header. */
234 switch (widetag_of(*first_pointer)) {
235 case SIMPLE_FUN_HEADER_WIDETAG:
236 case CLOSURE_FUN_HEADER_WIDETAG:
237 copy = trans_fun_header(object);
240 copy = trans_boxed(object);
244 if (copy != object) {
245 /* Set forwarding pointer */
246 set_forwarding_pointer(first_pointer,copy);
249 gc_assert(is_lisp_pointer(copy));
250 gc_assert(!from_space_p(copy));
259 trans_code(struct code *code)
261 struct code *new_code;
262 lispobj first, l_code, l_new_code;
263 int nheader_words, ncode_words, nwords;
264 unsigned long displacement;
265 lispobj fheaderl, *prev_pointer;
267 /* if object has already been transported, just return pointer */
268 first = code->header;
269 if (forwarding_pointer_p((lispobj *)code)) {
271 printf("Was already transported\n");
273 return (struct code *) forwarding_pointer_value
274 ((lispobj *)((pointer_sized_uint_t) code));
277 gc_assert(widetag_of(first) == CODE_HEADER_WIDETAG);
279 /* prepare to transport the code vector */
280 l_code = (lispobj) LOW_WORD(code) | OTHER_POINTER_LOWTAG;
282 ncode_words = fixnum_value(code->code_size);
283 nheader_words = HeaderValue(code->header);
284 nwords = ncode_words + nheader_words;
285 nwords = CEILING(nwords, 2);
287 l_new_code = copy_object(l_code, nwords);
288 new_code = (struct code *) native_pointer(l_new_code);
290 #if defined(DEBUG_CODE_GC)
291 printf("Old code object at 0x%08x, new code object at 0x%08x.\n",
292 (unsigned long) code, (unsigned long) new_code);
293 printf("Code object is %d words long.\n", nwords);
296 #ifdef LISP_FEATURE_GENCGC
297 if (new_code == code)
301 displacement = l_new_code - l_code;
303 set_forwarding_pointer((lispobj *)code, l_new_code);
305 /* set forwarding pointers for all the function headers in the */
306 /* code object. also fix all self pointers */
308 fheaderl = code->entry_points;
309 prev_pointer = &new_code->entry_points;
311 while (fheaderl != NIL) {
312 struct simple_fun *fheaderp, *nfheaderp;
315 fheaderp = (struct simple_fun *) native_pointer(fheaderl);
316 gc_assert(widetag_of(fheaderp->header) == SIMPLE_FUN_HEADER_WIDETAG);
318 /* Calculate the new function pointer and the new */
319 /* function header. */
320 nfheaderl = fheaderl + displacement;
321 nfheaderp = (struct simple_fun *) native_pointer(nfheaderl);
324 printf("fheaderp->header (at %x) <- %x\n",
325 &(fheaderp->header) , nfheaderl);
327 set_forwarding_pointer((lispobj *)fheaderp, nfheaderl);
329 /* fix self pointer. */
331 #ifdef LISP_FEATURE_GENCGC /* GENCGC? Maybe x86 is better conditional */
332 FUN_RAW_ADDR_OFFSET +
336 *prev_pointer = nfheaderl;
338 fheaderl = fheaderp->next;
339 prev_pointer = &nfheaderp->next;
341 os_flush_icache((os_vm_address_t) (((int *)new_code) + nheader_words),
342 ncode_words * sizeof(int));
343 #ifdef LISP_FEATURE_GENCGC
344 gencgc_apply_code_fixups(code, new_code);
350 scav_code_header(lispobj *where, lispobj object)
353 int n_header_words, n_code_words, n_words;
354 lispobj entry_point; /* tagged pointer to entry point */
355 struct simple_fun *function_ptr; /* untagged pointer to entry point */
357 code = (struct code *) where;
358 n_code_words = fixnum_value(code->code_size);
359 n_header_words = HeaderValue(object);
360 n_words = n_code_words + n_header_words;
361 n_words = CEILING(n_words, 2);
363 /* Scavenge the boxed section of the code data block. */
364 scavenge(where + 1, n_header_words - 1);
366 /* Scavenge the boxed section of each function object in the
367 * code data block. */
368 for (entry_point = code->entry_points;
370 entry_point = function_ptr->next) {
372 gc_assert(is_lisp_pointer(entry_point));
374 function_ptr = (struct simple_fun *) native_pointer(entry_point);
375 gc_assert(widetag_of(function_ptr->header)==SIMPLE_FUN_HEADER_WIDETAG);
377 scavenge(&function_ptr->name, 1);
378 scavenge(&function_ptr->arglist, 1);
379 scavenge(&function_ptr->type, 1);
386 trans_code_header(lispobj object)
390 ncode = trans_code((struct code *) native_pointer(object));
391 return (lispobj) LOW_WORD(ncode) | OTHER_POINTER_LOWTAG;
396 size_code_header(lispobj *where)
399 int nheader_words, ncode_words, nwords;
401 code = (struct code *) where;
403 ncode_words = fixnum_value(code->code_size);
404 nheader_words = HeaderValue(code->header);
405 nwords = ncode_words + nheader_words;
406 nwords = CEILING(nwords, 2);
412 scav_return_pc_header(lispobj *where, lispobj object)
414 lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x",
415 (unsigned long) where,
416 (unsigned long) object);
417 return 0; /* bogus return value to satisfy static type checking */
421 trans_return_pc_header(lispobj object)
423 struct simple_fun *return_pc;
424 unsigned long offset;
425 struct code *code, *ncode;
427 return_pc = (struct simple_fun *) native_pointer(object);
428 offset = HeaderValue(return_pc->header) * 4 ;
430 /* Transport the whole code object */
431 code = (struct code *) ((unsigned long) return_pc - offset);
432 ncode = trans_code(code);
434 return ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG;
437 /* On the 386, closures hold a pointer to the raw address instead of the
438 * function object, so we can use CALL [$FDEFN+const] to invoke
439 * the function without loading it into a register. Given that code
440 * objects don't move, we don't need to update anything, but we do
441 * have to figure out that the function is still live. */
443 #ifdef LISP_FEATURE_X86
445 scav_closure_header(lispobj *where, lispobj object)
447 struct closure *closure;
450 closure = (struct closure *)where;
451 fun = closure->fun - FUN_RAW_ADDR_OFFSET;
453 #ifdef LISP_FEATURE_GENCGC
454 /* The function may have moved so update the raw address. But
455 * don't write unnecessarily. */
456 if (closure->fun != fun + FUN_RAW_ADDR_OFFSET)
457 closure->fun = fun + FUN_RAW_ADDR_OFFSET;
464 scav_fun_header(lispobj *where, lispobj object)
466 lose("attempted to scavenge a function header where=0x%08x object=0x%08x",
467 (unsigned long) where,
468 (unsigned long) object);
469 return 0; /* bogus return value to satisfy static type checking */
473 trans_fun_header(lispobj object)
475 struct simple_fun *fheader;
476 unsigned long offset;
477 struct code *code, *ncode;
479 fheader = (struct simple_fun *) native_pointer(object);
480 offset = HeaderValue(fheader->header) * 4;
482 /* Transport the whole code object */
483 code = (struct code *) ((unsigned long) fheader - offset);
484 ncode = trans_code(code);
486 return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG;
495 scav_instance_pointer(lispobj *where, lispobj object)
497 lispobj copy, *first_pointer;
499 /* Object is a pointer into from space - not a FP. */
500 copy = trans_boxed(object);
502 #ifdef LISP_FEATURE_GENCGC
503 gc_assert(copy != object);
506 first_pointer = (lispobj *) native_pointer(object);
507 set_forwarding_pointer(first_pointer,copy);
518 static lispobj trans_list(lispobj object);
521 scav_list_pointer(lispobj *where, lispobj object)
523 lispobj first, *first_pointer;
525 gc_assert(is_lisp_pointer(object));
527 /* Object is a pointer into from space - not FP. */
528 first_pointer = (lispobj *) native_pointer(object);
530 first = trans_list(object);
531 gc_assert(first != object);
533 /* Set forwarding pointer */
534 set_forwarding_pointer(first_pointer, first);
536 gc_assert(is_lisp_pointer(first));
537 gc_assert(!from_space_p(first));
545 trans_list(lispobj object)
547 lispobj new_list_pointer;
548 struct cons *cons, *new_cons;
551 cons = (struct cons *) native_pointer(object);
554 new_cons = (struct cons *)
555 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
556 new_cons->car = cons->car;
557 new_cons->cdr = cons->cdr; /* updated later */
558 new_list_pointer = make_lispobj(new_cons,lowtag_of(object));
560 /* Grab the cdr: set_forwarding_pointer will clobber it in GENCGC */
563 set_forwarding_pointer((lispobj *)cons, new_list_pointer);
565 /* Try to linearize the list in the cdr direction to help reduce
569 struct cons *cdr_cons, *new_cdr_cons;
571 if(lowtag_of(cdr) != LIST_POINTER_LOWTAG ||
572 !from_space_p(cdr) ||
573 forwarding_pointer_p((lispobj *)native_pointer(cdr)))
576 cdr_cons = (struct cons *) native_pointer(cdr);
579 new_cdr_cons = (struct cons*)
580 gc_general_alloc(sizeof(struct cons),ALLOC_BOXED,ALLOC_QUICK);
581 new_cdr_cons->car = cdr_cons->car;
582 new_cdr_cons->cdr = cdr_cons->cdr;
583 new_cdr = make_lispobj(new_cdr_cons, lowtag_of(cdr));
585 /* Grab the cdr before it is clobbered. */
587 set_forwarding_pointer((lispobj *)cdr_cons, new_cdr);
589 /* Update the cdr of the last cons copied into new space to
590 * keep the newspace scavenge from having to do it. */
591 new_cons->cdr = new_cdr;
593 new_cons = new_cdr_cons;
596 return new_list_pointer;
601 * scavenging and transporting other pointers
605 scav_other_pointer(lispobj *where, lispobj object)
607 lispobj first, *first_pointer;
609 gc_assert(is_lisp_pointer(object));
611 /* Object is a pointer into from space - not FP. */
612 first_pointer = (lispobj *) native_pointer(object);
613 first = (transother[widetag_of(*first_pointer)])(object);
615 if (first != object) {
616 set_forwarding_pointer(first_pointer, first);
617 #ifdef LISP_FEATURE_GENCGC
621 #ifndef LISP_FEATURE_GENCGC
624 gc_assert(is_lisp_pointer(first));
625 gc_assert(!from_space_p(first));
631 * immediate, boxed, and unboxed objects
635 size_pointer(lispobj *where)
641 scav_immediate(lispobj *where, lispobj object)
647 trans_immediate(lispobj object)
649 lose("trying to transport an immediate");
650 return NIL; /* bogus return value to satisfy static type checking */
654 size_immediate(lispobj *where)
661 scav_boxed(lispobj *where, lispobj object)
667 trans_boxed(lispobj object)
670 unsigned long length;
672 gc_assert(is_lisp_pointer(object));
674 header = *((lispobj *) native_pointer(object));
675 length = HeaderValue(header) + 1;
676 length = CEILING(length, 2);
678 return copy_object(object, length);
683 size_boxed(lispobj *where)
686 unsigned long length;
689 length = HeaderValue(header) + 1;
690 length = CEILING(length, 2);
695 /* Note: on the sparc we don't have to do anything special for fdefns, */
696 /* 'cause the raw-addr has a function lowtag. */
697 #ifndef LISP_FEATURE_SPARC
699 scav_fdefn(lispobj *where, lispobj object)
703 fdefn = (struct fdefn *)where;
705 /* FSHOW((stderr, "scav_fdefn, function = %p, raw_addr = %p\n",
706 fdefn->fun, fdefn->raw_addr)); */
708 if ((char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET)
709 == (char *)((unsigned long)(fdefn->raw_addr))) {
710 scavenge(where + 1, sizeof(struct fdefn)/sizeof(lispobj) - 1);
712 /* Don't write unnecessarily. */
713 if (fdefn->raw_addr != (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET))
714 fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
715 /* gc.c has more casts here, which may be relevant or alternatively
716 may be compiler warning defeaters. try
718 (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
720 return sizeof(struct fdefn) / sizeof(lispobj);
728 scav_unboxed(lispobj *where, lispobj object)
730 unsigned long length;
732 length = HeaderValue(object) + 1;
733 length = CEILING(length, 2);
739 trans_unboxed(lispobj object)
742 unsigned long length;
745 gc_assert(is_lisp_pointer(object));
747 header = *((lispobj *) native_pointer(object));
748 length = HeaderValue(header) + 1;
749 length = CEILING(length, 2);
751 return copy_unboxed_object(object, length);
755 size_unboxed(lispobj *where)
758 unsigned long length;
761 length = HeaderValue(header) + 1;
762 length = CEILING(length, 2);
768 /* vector-like objects */
770 #define NWORDS(x,y) (CEILING((x),(y)) / (y))
772 scav_base_string(lispobj *where, lispobj object)
774 struct vector *vector;
777 /* NOTE: Strings contain one more byte of data than the length */
778 /* slot indicates. */
780 vector = (struct vector *) where;
781 length = fixnum_value(vector->length) + 1;
782 nwords = CEILING(NWORDS(length, 4) + 2, 2);
787 trans_base_string(lispobj object)
789 struct vector *vector;
792 gc_assert(is_lisp_pointer(object));
794 /* NOTE: A string contains one more byte of data (a terminating
795 * '\0' to help when interfacing with C functions) than indicated
796 * by the length slot. */
798 vector = (struct vector *) native_pointer(object);
799 length = fixnum_value(vector->length) + 1;
800 nwords = CEILING(NWORDS(length, 4) + 2, 2);
802 return copy_large_unboxed_object(object, nwords);
806 size_base_string(lispobj *where)
808 struct vector *vector;
811 /* NOTE: A string contains one more byte of data (a terminating
812 * '\0' to help when interfacing with C functions) than indicated
813 * by the length slot. */
815 vector = (struct vector *) where;
816 length = fixnum_value(vector->length) + 1;
817 nwords = CEILING(NWORDS(length, 4) + 2, 2);
823 trans_vector(lispobj object)
825 struct vector *vector;
828 gc_assert(is_lisp_pointer(object));
830 vector = (struct vector *) native_pointer(object);
832 length = fixnum_value(vector->length);
833 nwords = CEILING(length + 2, 2);
835 return copy_large_object(object, nwords);
839 size_vector(lispobj *where)
841 struct vector *vector;
844 vector = (struct vector *) where;
845 length = fixnum_value(vector->length);
846 nwords = CEILING(length + 2, 2);
852 scav_vector_nil(lispobj *where, lispobj object)
858 trans_vector_nil(lispobj object)
860 gc_assert(is_lisp_pointer(object));
861 return copy_unboxed_object(object, 2);
865 size_vector_nil(lispobj *where)
867 /* Just the header word and the length word */
872 scav_vector_bit(lispobj *where, lispobj object)
874 struct vector *vector;
877 vector = (struct vector *) where;
878 length = fixnum_value(vector->length);
879 nwords = CEILING(NWORDS(length, 32) + 2, 2);
885 trans_vector_bit(lispobj object)
887 struct vector *vector;
890 gc_assert(is_lisp_pointer(object));
892 vector = (struct vector *) native_pointer(object);
893 length = fixnum_value(vector->length);
894 nwords = CEILING(NWORDS(length, 32) + 2, 2);
896 return copy_large_unboxed_object(object, nwords);
900 size_vector_bit(lispobj *where)
902 struct vector *vector;
905 vector = (struct vector *) where;
906 length = fixnum_value(vector->length);
907 nwords = CEILING(NWORDS(length, 32) + 2, 2);
913 scav_vector_unsigned_byte_2(lispobj *where, lispobj object)
915 struct vector *vector;
918 vector = (struct vector *) where;
919 length = fixnum_value(vector->length);
920 nwords = CEILING(NWORDS(length, 16) + 2, 2);
926 trans_vector_unsigned_byte_2(lispobj object)
928 struct vector *vector;
931 gc_assert(is_lisp_pointer(object));
933 vector = (struct vector *) native_pointer(object);
934 length = fixnum_value(vector->length);
935 nwords = CEILING(NWORDS(length, 16) + 2, 2);
937 return copy_large_unboxed_object(object, nwords);
941 size_vector_unsigned_byte_2(lispobj *where)
943 struct vector *vector;
946 vector = (struct vector *) where;
947 length = fixnum_value(vector->length);
948 nwords = CEILING(NWORDS(length, 16) + 2, 2);
954 scav_vector_unsigned_byte_4(lispobj *where, lispobj object)
956 struct vector *vector;
959 vector = (struct vector *) where;
960 length = fixnum_value(vector->length);
961 nwords = CEILING(NWORDS(length, 8) + 2, 2);
967 trans_vector_unsigned_byte_4(lispobj object)
969 struct vector *vector;
972 gc_assert(is_lisp_pointer(object));
974 vector = (struct vector *) native_pointer(object);
975 length = fixnum_value(vector->length);
976 nwords = CEILING(NWORDS(length, 8) + 2, 2);
978 return copy_large_unboxed_object(object, nwords);
981 size_vector_unsigned_byte_4(lispobj *where)
983 struct vector *vector;
986 vector = (struct vector *) where;
987 length = fixnum_value(vector->length);
988 nwords = CEILING(NWORDS(length, 8) + 2, 2);
995 scav_vector_unsigned_byte_8(lispobj *where, lispobj object)
997 struct vector *vector;
1000 vector = (struct vector *) where;
1001 length = fixnum_value(vector->length);
1002 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1007 /*********************/
1012 trans_vector_unsigned_byte_8(lispobj object)
1014 struct vector *vector;
1017 gc_assert(is_lisp_pointer(object));
1019 vector = (struct vector *) native_pointer(object);
1020 length = fixnum_value(vector->length);
1021 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1023 return copy_large_unboxed_object(object, nwords);
1027 size_vector_unsigned_byte_8(lispobj *where)
1029 struct vector *vector;
1032 vector = (struct vector *) where;
1033 length = fixnum_value(vector->length);
1034 nwords = CEILING(NWORDS(length, 4) + 2, 2);
1041 scav_vector_unsigned_byte_16(lispobj *where, lispobj object)
1043 struct vector *vector;
1046 vector = (struct vector *) where;
1047 length = fixnum_value(vector->length);
1048 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1054 trans_vector_unsigned_byte_16(lispobj object)
1056 struct vector *vector;
1059 gc_assert(is_lisp_pointer(object));
1061 vector = (struct vector *) native_pointer(object);
1062 length = fixnum_value(vector->length);
1063 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1065 return copy_large_unboxed_object(object, nwords);
1069 size_vector_unsigned_byte_16(lispobj *where)
1071 struct vector *vector;
1074 vector = (struct vector *) where;
1075 length = fixnum_value(vector->length);
1076 nwords = CEILING(NWORDS(length, 2) + 2, 2);
1082 scav_vector_unsigned_byte_32(lispobj *where, lispobj object)
1084 struct vector *vector;
1087 vector = (struct vector *) where;
1088 length = fixnum_value(vector->length);
1089 nwords = CEILING(length + 2, 2);
1095 trans_vector_unsigned_byte_32(lispobj object)
1097 struct vector *vector;
1100 gc_assert(is_lisp_pointer(object));
1102 vector = (struct vector *) native_pointer(object);
1103 length = fixnum_value(vector->length);
1104 nwords = CEILING(length + 2, 2);
1106 return copy_large_unboxed_object(object, nwords);
1110 size_vector_unsigned_byte_32(lispobj *where)
1112 struct vector *vector;
1115 vector = (struct vector *) where;
1116 length = fixnum_value(vector->length);
1117 nwords = CEILING(length + 2, 2);
1123 scav_vector_single_float(lispobj *where, lispobj object)
1125 struct vector *vector;
1128 vector = (struct vector *) where;
1129 length = fixnum_value(vector->length);
1130 nwords = CEILING(length + 2, 2);
1136 trans_vector_single_float(lispobj object)
1138 struct vector *vector;
1141 gc_assert(is_lisp_pointer(object));
1143 vector = (struct vector *) native_pointer(object);
1144 length = fixnum_value(vector->length);
1145 nwords = CEILING(length + 2, 2);
1147 return copy_large_unboxed_object(object, nwords);
1151 size_vector_single_float(lispobj *where)
1153 struct vector *vector;
1156 vector = (struct vector *) where;
1157 length = fixnum_value(vector->length);
1158 nwords = CEILING(length + 2, 2);
1164 scav_vector_double_float(lispobj *where, lispobj object)
1166 struct vector *vector;
1169 vector = (struct vector *) where;
1170 length = fixnum_value(vector->length);
1171 nwords = CEILING(length * 2 + 2, 2);
1177 trans_vector_double_float(lispobj object)
1179 struct vector *vector;
1182 gc_assert(is_lisp_pointer(object));
1184 vector = (struct vector *) native_pointer(object);
1185 length = fixnum_value(vector->length);
1186 nwords = CEILING(length * 2 + 2, 2);
1188 return copy_large_unboxed_object(object, nwords);
1192 size_vector_double_float(lispobj *where)
1194 struct vector *vector;
1197 vector = (struct vector *) where;
1198 length = fixnum_value(vector->length);
1199 nwords = CEILING(length * 2 + 2, 2);
1204 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1206 scav_vector_long_float(lispobj *where, lispobj object)
1208 struct vector *vector;
1211 vector = (struct vector *) where;
1212 length = fixnum_value(vector->length);
1213 nwords = CEILING(length *
1220 trans_vector_long_float(lispobj object)
1222 struct vector *vector;
1225 gc_assert(is_lisp_pointer(object));
1227 vector = (struct vector *) native_pointer(object);
1228 length = fixnum_value(vector->length);
1229 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1231 return copy_large_unboxed_object(object, nwords);
1235 size_vector_long_float(lispobj *where)
1237 struct vector *vector;
1240 vector = (struct vector *) where;
1241 length = fixnum_value(vector->length);
1242 nwords = CEILING(length * LONG_FLOAT_SIZE + 2, 2);
1249 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1251 scav_vector_complex_single_float(lispobj *where, lispobj object)
1253 struct vector *vector;
1256 vector = (struct vector *) where;
1257 length = fixnum_value(vector->length);
1258 nwords = CEILING(length * 2 + 2, 2);
1264 trans_vector_complex_single_float(lispobj object)
1266 struct vector *vector;
1269 gc_assert(is_lisp_pointer(object));
1271 vector = (struct vector *) native_pointer(object);
1272 length = fixnum_value(vector->length);
1273 nwords = CEILING(length * 2 + 2, 2);
1275 return copy_large_unboxed_object(object, nwords);
1279 size_vector_complex_single_float(lispobj *where)
1281 struct vector *vector;
1284 vector = (struct vector *) where;
1285 length = fixnum_value(vector->length);
1286 nwords = CEILING(length * 2 + 2, 2);
1292 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1294 scav_vector_complex_double_float(lispobj *where, lispobj object)
1296 struct vector *vector;
1299 vector = (struct vector *) where;
1300 length = fixnum_value(vector->length);
1301 nwords = CEILING(length * 4 + 2, 2);
1307 trans_vector_complex_double_float(lispobj object)
1309 struct vector *vector;
1312 gc_assert(is_lisp_pointer(object));
1314 vector = (struct vector *) native_pointer(object);
1315 length = fixnum_value(vector->length);
1316 nwords = CEILING(length * 4 + 2, 2);
1318 return copy_large_unboxed_object(object, nwords);
1322 size_vector_complex_double_float(lispobj *where)
1324 struct vector *vector;
1327 vector = (struct vector *) where;
1328 length = fixnum_value(vector->length);
1329 nwords = CEILING(length * 4 + 2, 2);
1336 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1338 scav_vector_complex_long_float(lispobj *where, lispobj object)
1340 struct vector *vector;
1343 vector = (struct vector *) where;
1344 length = fixnum_value(vector->length);
1345 nwords = CEILING(length * (2* LONG_FLOAT_SIZE) + 2, 2);
1351 trans_vector_complex_long_float(lispobj object)
1353 struct vector *vector;
1356 gc_assert(is_lisp_pointer(object));
1358 vector = (struct vector *) native_pointer(object);
1359 length = fixnum_value(vector->length);
1360 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1362 return copy_large_unboxed_object(object, nwords);
1366 size_vector_complex_long_float(lispobj *where)
1368 struct vector *vector;
1371 vector = (struct vector *) where;
1372 length = fixnum_value(vector->length);
1373 nwords = CEILING(length * (2*LONG_FLOAT_SIZE) + 2, 2);
1379 #define WEAK_POINTER_NWORDS \
1380 CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2)
1383 trans_weak_pointer(lispobj object)
1386 #ifndef LISP_FEATURE_GENCGC
1387 struct weak_pointer *wp;
1389 gc_assert(is_lisp_pointer(object));
1391 #if defined(DEBUG_WEAK)
1392 printf("Transporting weak pointer from 0x%08x\n", object);
1395 /* Need to remember where all the weak pointers are that have */
1396 /* been transported so they can be fixed up in a post-GC pass. */
1398 copy = copy_object(object, WEAK_POINTER_NWORDS);
1399 #ifndef LISP_FEATURE_GENCGC
1400 wp = (struct weak_pointer *) native_pointer(copy);
1402 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1403 /* Push the weak pointer onto the list of weak pointers. */
1404 wp->next = LOW_WORD(weak_pointers);
1411 size_weak_pointer(lispobj *where)
1413 return WEAK_POINTER_NWORDS;
1417 void scan_weak_pointers(void)
1419 struct weak_pointer *wp;
1420 for (wp = weak_pointers; wp != NULL;
1421 wp=(struct weak_pointer *)native_pointer(wp->next)) {
1422 lispobj value = wp->value;
1423 lispobj *first_pointer;
1424 gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG);
1425 if (!(is_lisp_pointer(value) && from_space_p(value)))
1428 /* Now, we need to check whether the object has been forwarded. If
1429 * it has been, the weak pointer is still good and needs to be
1430 * updated. Otherwise, the weak pointer needs to be nil'ed
1433 first_pointer = (lispobj *)native_pointer(value);
1435 if (forwarding_pointer_p(first_pointer)) {
1437 (lispobj)LOW_WORD(forwarding_pointer_value(first_pointer));
1453 scav_lose(lispobj *where, lispobj object)
1455 lose("no scavenge function for object 0x%08x (widetag 0x%x)",
1456 (unsigned long)object,
1457 widetag_of(*(lispobj*)native_pointer(object)));
1458 return 0; /* bogus return value to satisfy static type checking */
1462 trans_lose(lispobj object)
1464 lose("no transport function for object 0x%08x (widetag 0x%x)",
1465 (unsigned long)object,
1466 widetag_of(*(lispobj*)native_pointer(object)));
1467 return NIL; /* bogus return value to satisfy static type checking */
1471 size_lose(lispobj *where)
1473 lose("no size function for object at 0x%08x (widetag 0x%x)",
1474 (unsigned long)where,
1475 widetag_of(LOW_WORD(where)));
1476 return 1; /* bogus return value to satisfy static type checking */
1485 gc_init_tables(void)
1489 /* Set default value in all slots of scavenge table. FIXME
1490 * replace this gnarly sizeof with something based on
1492 for (i = 0; i < ((sizeof scavtab)/(sizeof scavtab[0])); i++) {
1493 scavtab[i] = scav_lose;
1496 /* For each type which can be selected by the lowtag alone, set
1497 * multiple entries in our widetag scavenge table (one for each
1498 * possible value of the high bits).
1501 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1502 scavtab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1503 scavtab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_fun_pointer;
1504 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1505 scavtab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_list_pointer;
1506 scavtab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_immediate;
1507 scavtab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_instance_pointer;
1508 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1509 scavtab[OTHER_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = scav_other_pointer;
1512 /* Other-pointer types (those selected by all eight bits of the
1513 * tag) get one entry each in the scavenge table. */
1514 scavtab[BIGNUM_WIDETAG] = scav_unboxed;
1515 scavtab[RATIO_WIDETAG] = scav_boxed;
1516 scavtab[SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1517 scavtab[DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1518 #ifdef LONG_FLOAT_WIDETAG
1519 scavtab[LONG_FLOAT_WIDETAG] = scav_unboxed;
1521 scavtab[COMPLEX_WIDETAG] = scav_boxed;
1522 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1523 scavtab[COMPLEX_SINGLE_FLOAT_WIDETAG] = scav_unboxed;
1525 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1526 scavtab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = scav_unboxed;
1528 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1529 scavtab[COMPLEX_LONG_FLOAT_WIDETAG] = scav_unboxed;
1531 scavtab[SIMPLE_ARRAY_WIDETAG] = scav_boxed;
1532 scavtab[SIMPLE_BASE_STRING_WIDETAG] = scav_base_string;
1533 scavtab[SIMPLE_BIT_VECTOR_WIDETAG] = scav_vector_bit;
1534 scavtab[SIMPLE_ARRAY_NIL_WIDETAG] = scav_vector_nil;
1535 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1536 scav_vector_unsigned_byte_2;
1537 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1538 scav_vector_unsigned_byte_4;
1539 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1540 scav_vector_unsigned_byte_8;
1541 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1542 scav_vector_unsigned_byte_16;
1543 scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1544 scav_vector_unsigned_byte_32;
1545 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1546 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = scav_vector_unsigned_byte_8;
1548 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1549 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1550 scav_vector_unsigned_byte_16;
1552 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1553 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1554 scav_vector_unsigned_byte_32;
1556 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1557 scavtab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1558 scav_vector_unsigned_byte_32;
1560 scavtab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = scav_vector_single_float;
1561 scavtab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = scav_vector_double_float;
1562 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1563 scavtab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = scav_vector_long_float;
1565 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1566 scavtab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1567 scav_vector_complex_single_float;
1569 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1570 scavtab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1571 scav_vector_complex_double_float;
1573 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1574 scavtab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1575 scav_vector_complex_long_float;
1577 scavtab[COMPLEX_BASE_STRING_WIDETAG] = scav_boxed;
1578 scavtab[COMPLEX_VECTOR_NIL_WIDETAG] = scav_boxed;
1579 scavtab[COMPLEX_BIT_VECTOR_WIDETAG] = scav_boxed;
1580 scavtab[COMPLEX_VECTOR_WIDETAG] = scav_boxed;
1581 scavtab[COMPLEX_ARRAY_WIDETAG] = scav_boxed;
1582 scavtab[CODE_HEADER_WIDETAG] = scav_code_header;
1583 #ifndef LISP_FEATURE_GENCGC /* FIXME ..._X86 ? */
1584 scavtab[SIMPLE_FUN_HEADER_WIDETAG] = scav_fun_header;
1585 scavtab[CLOSURE_FUN_HEADER_WIDETAG] = scav_fun_header;
1586 scavtab[RETURN_PC_HEADER_WIDETAG] = scav_return_pc_header;
1588 #ifdef LISP_FEATURE_X86
1589 scavtab[CLOSURE_HEADER_WIDETAG] = scav_closure_header;
1590 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_closure_header;
1592 scavtab[CLOSURE_HEADER_WIDETAG] = scav_boxed;
1593 scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_boxed;
1595 scavtab[VALUE_CELL_HEADER_WIDETAG] = scav_boxed;
1596 scavtab[SYMBOL_HEADER_WIDETAG] = scav_boxed;
1597 scavtab[BASE_CHAR_WIDETAG] = scav_immediate;
1598 scavtab[SAP_WIDETAG] = scav_unboxed;
1599 scavtab[UNBOUND_MARKER_WIDETAG] = scav_immediate;
1600 scavtab[INSTANCE_HEADER_WIDETAG] = scav_boxed;
1601 #ifdef LISP_FEATURE_SPARC
1602 scavtab[FDEFN_WIDETAG] = scav_boxed;
1604 scavtab[FDEFN_WIDETAG] = scav_fdefn;
1607 /* transport other table, initialized same way as scavtab */
1608 for (i = 0; i < ((sizeof transother)/(sizeof transother[0])); i++)
1609 transother[i] = trans_lose;
1610 transother[BIGNUM_WIDETAG] = trans_unboxed;
1611 transother[RATIO_WIDETAG] = trans_boxed;
1612 transother[SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1613 transother[DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1614 #ifdef LONG_FLOAT_WIDETAG
1615 transother[LONG_FLOAT_WIDETAG] = trans_unboxed;
1617 transother[COMPLEX_WIDETAG] = trans_boxed;
1618 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1619 transother[COMPLEX_SINGLE_FLOAT_WIDETAG] = trans_unboxed;
1621 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1622 transother[COMPLEX_DOUBLE_FLOAT_WIDETAG] = trans_unboxed;
1624 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1625 transother[COMPLEX_LONG_FLOAT_WIDETAG] = trans_unboxed;
1627 transother[SIMPLE_ARRAY_WIDETAG] = trans_boxed; /* but not GENCGC */
1628 transother[SIMPLE_BASE_STRING_WIDETAG] = trans_base_string;
1629 transother[SIMPLE_BIT_VECTOR_WIDETAG] = trans_vector_bit;
1630 transother[SIMPLE_VECTOR_WIDETAG] = trans_vector;
1631 transother[SIMPLE_ARRAY_NIL_WIDETAG] = trans_vector_nil;
1632 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1633 trans_vector_unsigned_byte_2;
1634 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1635 trans_vector_unsigned_byte_4;
1636 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1637 trans_vector_unsigned_byte_8;
1638 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1639 trans_vector_unsigned_byte_16;
1640 transother[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1641 trans_vector_unsigned_byte_32;
1642 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1643 transother[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] =
1644 trans_vector_unsigned_byte_8;
1646 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1647 transother[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1648 trans_vector_unsigned_byte_16;
1650 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1651 transother[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1652 trans_vector_unsigned_byte_32;
1654 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1655 transother[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1656 trans_vector_unsigned_byte_32;
1658 transother[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] =
1659 trans_vector_single_float;
1660 transother[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] =
1661 trans_vector_double_float;
1662 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1663 transother[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] =
1664 trans_vector_long_float;
1666 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1667 transother[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1668 trans_vector_complex_single_float;
1670 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1671 transother[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1672 trans_vector_complex_double_float;
1674 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1675 transother[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1676 trans_vector_complex_long_float;
1678 transother[COMPLEX_BASE_STRING_WIDETAG] = trans_boxed;
1679 transother[COMPLEX_BIT_VECTOR_WIDETAG] = trans_boxed;
1680 transother[COMPLEX_VECTOR_NIL_WIDETAG] = trans_boxed;
1681 transother[COMPLEX_VECTOR_WIDETAG] = trans_boxed;
1682 transother[COMPLEX_ARRAY_WIDETAG] = trans_boxed;
1683 transother[CODE_HEADER_WIDETAG] = trans_code_header;
1684 transother[SIMPLE_FUN_HEADER_WIDETAG] = trans_fun_header;
1685 transother[CLOSURE_FUN_HEADER_WIDETAG] = trans_fun_header;
1686 transother[RETURN_PC_HEADER_WIDETAG] = trans_return_pc_header;
1687 transother[CLOSURE_HEADER_WIDETAG] = trans_boxed;
1688 transother[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = trans_boxed;
1689 transother[VALUE_CELL_HEADER_WIDETAG] = trans_boxed;
1690 transother[SYMBOL_HEADER_WIDETAG] = trans_boxed;
1691 transother[BASE_CHAR_WIDETAG] = trans_immediate;
1692 transother[SAP_WIDETAG] = trans_unboxed;
1693 transother[UNBOUND_MARKER_WIDETAG] = trans_immediate;
1694 transother[WEAK_POINTER_WIDETAG] = trans_weak_pointer;
1695 transother[INSTANCE_HEADER_WIDETAG] = trans_boxed;
1696 transother[FDEFN_WIDETAG] = trans_boxed;
1698 /* size table, initialized the same way as scavtab */
1699 for (i = 0; i < ((sizeof sizetab)/(sizeof sizetab[0])); i++)
1700 sizetab[i] = size_lose;
1701 for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
1702 sizetab[EVEN_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1703 sizetab[FUN_POINTER_LOWTAG|(i<<3)] = size_pointer;
1704 /* skipping OTHER_IMMEDIATE_0_LOWTAG */
1705 sizetab[LIST_POINTER_LOWTAG|(i<<3)] = size_pointer;
1706 sizetab[ODD_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
1707 sizetab[INSTANCE_POINTER_LOWTAG|(i<<3)] = size_pointer;
1708 /* skipping OTHER_IMMEDIATE_1_LOWTAG */
1709 sizetab[OTHER_POINTER_LOWTAG|(i<<3)] = size_pointer;
1711 sizetab[BIGNUM_WIDETAG] = size_unboxed;
1712 sizetab[RATIO_WIDETAG] = size_boxed;
1713 sizetab[SINGLE_FLOAT_WIDETAG] = size_unboxed;
1714 sizetab[DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1715 #ifdef LONG_FLOAT_WIDETAG
1716 sizetab[LONG_FLOAT_WIDETAG] = size_unboxed;
1718 sizetab[COMPLEX_WIDETAG] = size_boxed;
1719 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
1720 sizetab[COMPLEX_SINGLE_FLOAT_WIDETAG] = size_unboxed;
1722 #ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG
1723 sizetab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = size_unboxed;
1725 #ifdef COMPLEX_LONG_FLOAT_WIDETAG
1726 sizetab[COMPLEX_LONG_FLOAT_WIDETAG] = size_unboxed;
1728 sizetab[SIMPLE_ARRAY_WIDETAG] = size_boxed;
1729 sizetab[SIMPLE_BASE_STRING_WIDETAG] = size_base_string;
1730 sizetab[SIMPLE_BIT_VECTOR_WIDETAG] = size_vector_bit;
1731 sizetab[SIMPLE_VECTOR_WIDETAG] = size_vector;
1732 sizetab[SIMPLE_ARRAY_NIL_WIDETAG] = size_vector_nil;
1733 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] =
1734 size_vector_unsigned_byte_2;
1735 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] =
1736 size_vector_unsigned_byte_4;
1737 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] =
1738 size_vector_unsigned_byte_8;
1739 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
1740 size_vector_unsigned_byte_16;
1741 sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
1742 size_vector_unsigned_byte_32;
1743 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
1744 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = size_vector_unsigned_byte_8;
1746 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG
1747 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] =
1748 size_vector_unsigned_byte_16;
1750 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG
1751 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] =
1752 size_vector_unsigned_byte_32;
1754 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG
1755 sizetab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
1756 size_vector_unsigned_byte_32;
1758 sizetab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = size_vector_single_float;
1759 sizetab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = size_vector_double_float;
1760 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
1761 sizetab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = size_vector_long_float;
1763 #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG
1764 sizetab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] =
1765 size_vector_complex_single_float;
1767 #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG
1768 sizetab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] =
1769 size_vector_complex_double_float;
1771 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
1772 sizetab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] =
1773 size_vector_complex_long_float;
1775 sizetab[COMPLEX_BASE_STRING_WIDETAG] = size_boxed;
1776 sizetab[COMPLEX_VECTOR_NIL_WIDETAG] = size_boxed;
1777 sizetab[COMPLEX_BIT_VECTOR_WIDETAG] = size_boxed;
1778 sizetab[COMPLEX_VECTOR_WIDETAG] = size_boxed;
1779 sizetab[COMPLEX_ARRAY_WIDETAG] = size_boxed;
1780 sizetab[CODE_HEADER_WIDETAG] = size_code_header;
1782 /* We shouldn't see these, so just lose if it happens. */
1783 sizetab[SIMPLE_FUN_HEADER_WIDETAG] = size_function_header;
1784 sizetab[CLOSURE_FUN_HEADER_WIDETAG] = size_function_header;
1785 sizetab[RETURN_PC_HEADER_WIDETAG] = size_return_pc_header;
1787 sizetab[CLOSURE_HEADER_WIDETAG] = size_boxed;
1788 sizetab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = size_boxed;
1789 sizetab[VALUE_CELL_HEADER_WIDETAG] = size_boxed;
1790 sizetab[SYMBOL_HEADER_WIDETAG] = size_boxed;
1791 sizetab[BASE_CHAR_WIDETAG] = size_immediate;
1792 sizetab[SAP_WIDETAG] = size_unboxed;
1793 sizetab[UNBOUND_MARKER_WIDETAG] = size_immediate;
1794 sizetab[WEAK_POINTER_WIDETAG] = size_weak_pointer;
1795 sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed;
1796 sizetab[FDEFN_WIDETAG] = size_boxed;