0.8.14.2:
[sbcl.git] / src / runtime / gc-common.c
index 26bc938..2dfe4c9 100644 (file)
  */
 
 /*
- * GENerational Conservative Garbage Collector for SBCL x86
- */
-
-/*
- * This software is part of the SBCL system. See the README file for
- * more information.
- *
- * This software is derived from the CMU CL system, which was
- * written at Carnegie Mellon University and released into the
- * public domain. The software is in the public domain and is
- * provided with absolutely no warranty. See the COPYING and CREDITS
- * files for more information.
- */
-
-/*
  * For a review of garbage collection techniques (e.g. generational
  * GC) and terminology (e.g. "scavenging") see Paul R. Wilson,
  * "Uniprocessor Garbage Collection Techniques". As of 20000618, this
@@ -43,8 +28,8 @@
 #include <stdio.h>
 #include <signal.h>
 #include <string.h>
-#include "runtime.h"
 #include "sbcl.h"
+#include "runtime.h"
 #include "os.h"
 #include "interr.h"
 #include "globals.h"
@@ -122,10 +107,10 @@ copy_object(lispobj object, int nwords)
     tag = lowtag_of(object);
 
     /* Allocate space. */
-    new = gc_general_alloc(nwords*4,ALLOC_BOXED,ALLOC_QUICK);
+    new = gc_general_alloc(nwords*N_WORD_BYTES,ALLOC_BOXED,ALLOC_QUICK);
 
     /* Copy the object. */
-    memcpy(new,native_pointer(object),nwords*4);
+    memcpy(new,native_pointer(object),nwords*N_WORD_BYTES);
     return make_lispobj(new,tag);
 }
 
@@ -190,7 +175,7 @@ scavenge(lispobj *start, long n_words)
            }
        }
 #endif
-       else if ((object & 3) == 0) {
+       else if (fixnump(object)) {
            /* It's a fixnum: really easy.. */
            n_words_scavenged = 1;
        } else {
@@ -395,6 +380,7 @@ size_code_header(lispobj *where)
     return nwords;
 }
 
+#ifndef LISP_FEATURE_X86
 static int
 scav_return_pc_header(lispobj *where, lispobj object)
 {
@@ -403,6 +389,7 @@ scav_return_pc_header(lispobj *where, lispobj object)
         (unsigned long) object);
     return 0; /* bogus return value to satisfy static type checking */
 }
+#endif /* LISP_FEATURE_X86 */
 
 static lispobj
 trans_return_pc_header(lispobj object)
@@ -412,7 +399,8 @@ trans_return_pc_header(lispobj object)
     struct code *code, *ncode;
 
     return_pc = (struct simple_fun *) native_pointer(object);
-    offset = HeaderValue(return_pc->header)  * 4 ;
+    /* FIXME: was times 4, should it really be N_WORD_BYTES? */
+    offset = HeaderValue(return_pc->header) * N_WORD_BYTES;
 
     /* Transport the whole code object */
     code = (struct code *) ((unsigned long) return_pc - offset);
@@ -447,6 +435,7 @@ scav_closure_header(lispobj *where, lispobj object)
 }
 #endif
 
+#ifndef LISP_FEATURE_X86
 static int
 scav_fun_header(lispobj *where, lispobj object)
 {
@@ -455,6 +444,7 @@ scav_fun_header(lispobj *where, lispobj object)
         (unsigned long) object);
     return 0; /* bogus return value to satisfy static type checking */
 }
+#endif /* LISP_FEATURE_X86 */
 
 static lispobj
 trans_fun_header(lispobj object)
@@ -464,7 +454,8 @@ trans_fun_header(lispobj object)
     struct code *code, *ncode;
        
     fheader = (struct simple_fun *) native_pointer(object);
-    offset = HeaderValue(fheader->header) * 4;
+    /* FIXME: was times 4, should it really be N_WORD_BYTES? */
+    offset = HeaderValue(fheader->header) * N_WORD_BYTES;
 
     /* Transport the whole code object */
     code = (struct code *) ((unsigned long) fheader - offset);
@@ -701,8 +692,7 @@ scav_fdefn(lispobj *where, lispobj object)
            fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
        /* gc.c has more casts here, which may be relevant or alternatively
           may be compiler warning defeaters.  try 
-        fdefn->raw_addr =
-           (u32)  ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
+        fdefn->raw_addr = ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
        */
        return sizeof(struct fdefn) / sizeof(lispobj);
     } else {
@@ -754,8 +744,6 @@ size_unboxed(lispobj *where)
 static int\f
 /* vector-like objects */
 
-#define NWORDS(x,y) (CEILING((x),(y)) / (y))
-
 scav_base_string(lispobj *where, lispobj object)
 {
     struct vector *vector;
@@ -766,7 +754,7 @@ scav_base_string(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length) + 1;
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return nwords;
 }
@@ -784,7 +772,7 @@ trans_base_string(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length) + 1;
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -801,7 +789,7 @@ size_base_string(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length) + 1;
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return nwords;
 }
@@ -863,7 +851,7 @@ scav_vector_bit(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 32) + 2, 2);
+    nwords = CEILING(NWORDS(length, 1) + 2, 2);
 
     return nwords;
 }
@@ -878,7 +866,7 @@ trans_vector_bit(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 32) + 2, 2);
+    nwords = CEILING(NWORDS(length, 1) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -891,7 +879,7 @@ size_vector_bit(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 32) + 2, 2);
+    nwords = CEILING(NWORDS(length, 1) + 2, 2);
 
     return nwords;
 }
@@ -904,7 +892,7 @@ scav_vector_unsigned_byte_2(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 16) + 2, 2);
+    nwords = CEILING(NWORDS(length, 2) + 2, 2);
 
     return nwords;
 }
@@ -919,7 +907,7 @@ trans_vector_unsigned_byte_2(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 16) + 2, 2);
+    nwords = CEILING(NWORDS(length, 2) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -932,7 +920,7 @@ size_vector_unsigned_byte_2(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 16) + 2, 2);
+    nwords = CEILING(NWORDS(length, 2) + 2, 2);
 
     return nwords;
 }
@@ -945,7 +933,7 @@ scav_vector_unsigned_byte_4(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 8) + 2, 2);
+    nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
     return nwords;
 }
@@ -960,7 +948,7 @@ trans_vector_unsigned_byte_4(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 8) + 2, 2);
+    nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -972,7 +960,7 @@ size_vector_unsigned_byte_4(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 8) + 2, 2);
+    nwords = CEILING(NWORDS(length, 4) + 2, 2);
 
     return nwords;
 }
@@ -986,7 +974,7 @@ scav_vector_unsigned_byte_8(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return nwords;
 }
@@ -1005,7 +993,7 @@ trans_vector_unsigned_byte_8(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1018,7 +1006,7 @@ size_vector_unsigned_byte_8(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 4) + 2, 2);
+    nwords = CEILING(NWORDS(length, 8) + 2, 2);
 
     return nwords;
 }
@@ -1032,7 +1020,7 @@ scav_vector_unsigned_byte_16(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 2) + 2, 2);
+    nwords = CEILING(NWORDS(length, 16) + 2, 2);
 
     return nwords;
 }
@@ -1047,7 +1035,7 @@ trans_vector_unsigned_byte_16(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 2) + 2, 2);
+    nwords = CEILING(NWORDS(length, 16) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1060,7 +1048,7 @@ size_vector_unsigned_byte_16(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(NWORDS(length, 2) + 2, 2);
+    nwords = CEILING(NWORDS(length, 16) + 2, 2);
 
     return nwords;
 }
@@ -1073,7 +1061,7 @@ scav_vector_unsigned_byte_32(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
     return nwords;
 }
@@ -1088,7 +1076,7 @@ trans_vector_unsigned_byte_32(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1101,10 +1089,53 @@ size_vector_unsigned_byte_32(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
+
+    return nwords;
+}
+
+#if N_WORD_BITS == 64
+static int
+scav_vector_unsigned_byte_64(lispobj *where, lispobj object)
+{
+    struct vector *vector;
+    int length, nwords;
+
+    vector = (struct vector *) where;
+    length = fixnum_value(vector->length);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
+
+    return nwords;
+}
+
+static lispobj
+trans_vector_unsigned_byte_64(lispobj object)
+{
+    struct vector *vector;
+    int length, nwords;
+
+    gc_assert(is_lisp_pointer(object));
+
+    vector = (struct vector *) native_pointer(object);
+    length = fixnum_value(vector->length);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
+
+    return copy_large_unboxed_object(object, nwords);
+}
+
+static int
+size_vector_unsigned_byte_64(lispobj *where)
+{
+    struct vector *vector;
+    int length, nwords;
+
+    vector = (struct vector *) where;
+    length = fixnum_value(vector->length);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return nwords;
 }
+#endif
 
 static int
 scav_vector_single_float(lispobj *where, lispobj object)
@@ -1114,7 +1145,7 @@ scav_vector_single_float(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
     return nwords;
 }
@@ -1129,7 +1160,7 @@ trans_vector_single_float(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1142,7 +1173,7 @@ size_vector_single_float(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length + 2, 2);
+    nwords = CEILING(NWORDS(length, 32) + 2, 2);
 
     return nwords;
 }
@@ -1155,7 +1186,7 @@ scav_vector_double_float(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return nwords;
 }
@@ -1170,7 +1201,7 @@ trans_vector_double_float(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1183,7 +1214,7 @@ size_vector_double_float(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return nwords;
 }
@@ -1242,7 +1273,7 @@ scav_vector_complex_single_float(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return nwords;
 }
@@ -1257,7 +1288,7 @@ trans_vector_complex_single_float(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1270,7 +1301,7 @@ size_vector_complex_single_float(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 2 + 2, 2);
+    nwords = CEILING(NWORDS(length, 64) + 2, 2);
 
     return nwords;
 }
@@ -1285,7 +1316,7 @@ scav_vector_complex_double_float(lispobj *where, lispobj object)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 4 + 2, 2);
+    nwords = CEILING(NWORDS(length, 128) + 2, 2);
 
     return nwords;
 }
@@ -1300,7 +1331,7 @@ trans_vector_complex_double_float(lispobj object)
 
     vector = (struct vector *) native_pointer(object);
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 4 + 2, 2);
+    nwords = CEILING(NWORDS(length, 128) + 2, 2);
 
     return copy_large_unboxed_object(object, nwords);
 }
@@ -1313,7 +1344,7 @@ size_vector_complex_double_float(lispobj *where)
 
     vector = (struct vector *) where;
     length = fixnum_value(vector->length);
-    nwords = CEILING(length * 4 + 2, 2);
+    nwords = CEILING(NWORDS(length, 128) + 2, 2);
 
     return nwords;
 }
@@ -1440,8 +1471,9 @@ static int
 scav_lose(lispobj *where, lispobj object)
 {
     lose("no scavenge function for object 0x%08x (widetag 0x%x)",
-        (unsigned long)object,
-        widetag_of(*(lispobj*)native_pointer(object)));
+         (unsigned long)object,
+         widetag_of(*(lispobj*)native_pointer(object)));
+
     return 0; /* bogus return value to satisfy static type checking */
 }
 
@@ -1531,12 +1563,26 @@ gc_init_tables(void)
        scav_vector_unsigned_byte_16;
     scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
        scav_vector_unsigned_byte_16;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG
     scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG] =
        scav_vector_unsigned_byte_32;
+#endif
     scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG] =
        scav_vector_unsigned_byte_32;
     scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
        scav_vector_unsigned_byte_32;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG
+    scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG] =
+       scav_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG
+    scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG] =
+       scav_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG
+    scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG] =
+       scav_vector_unsigned_byte_64;
+#endif
 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
     scavtab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = scav_vector_unsigned_byte_8;
 #endif
@@ -1552,6 +1598,14 @@ gc_init_tables(void)
     scavtab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
        scav_vector_unsigned_byte_32;
 #endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG
+    scavtab[SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG] =
+       scav_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG
+    scavtab[SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG] =
+       scav_vector_unsigned_byte_64;
+#endif
     scavtab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = scav_vector_single_float;
     scavtab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = scav_vector_double_float;
 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
@@ -1635,12 +1689,26 @@ gc_init_tables(void)
        trans_vector_unsigned_byte_16;
     transother[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
        trans_vector_unsigned_byte_16;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG
     transother[SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG] =
        trans_vector_unsigned_byte_32;
+#endif
     transother[SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG] =
        trans_vector_unsigned_byte_32;
     transother[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
        trans_vector_unsigned_byte_32;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG
+    transother[SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG] =
+       trans_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG
+    transother[SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG] =
+       trans_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG
+    transother[SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG] =
+       trans_vector_unsigned_byte_64;
+#endif
 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
     transother[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] =
        trans_vector_unsigned_byte_8;
@@ -1657,6 +1725,14 @@ gc_init_tables(void)
     transother[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
        trans_vector_unsigned_byte_32;
 #endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG
+    transother[SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG] =
+       trans_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG
+    transother[SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG] =
+       trans_vector_unsigned_byte_64;
+#endif
     transother[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] =
        trans_vector_single_float;
     transother[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] =
@@ -1700,14 +1776,14 @@ gc_init_tables(void)
     for (i = 0; i < ((sizeof sizetab)/(sizeof sizetab[0])); i++)
        sizetab[i] = size_lose;
     for (i = 0; i < (1<<(N_WIDETAG_BITS-N_LOWTAG_BITS)); i++) {
-       sizetab[EVEN_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
-       sizetab[FUN_POINTER_LOWTAG|(i<<3)] = size_pointer;
+       sizetab[EVEN_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = size_immediate;
+       sizetab[FUN_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
        /* skipping OTHER_IMMEDIATE_0_LOWTAG */
-       sizetab[LIST_POINTER_LOWTAG|(i<<3)] = size_pointer;
-       sizetab[ODD_FIXNUM_LOWTAG|(i<<3)] = size_immediate;
-       sizetab[INSTANCE_POINTER_LOWTAG|(i<<3)] = size_pointer;
+       sizetab[LIST_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
+       sizetab[ODD_FIXNUM_LOWTAG|(i<<N_LOWTAG_BITS)] = size_immediate;
+       sizetab[INSTANCE_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
        /* skipping OTHER_IMMEDIATE_1_LOWTAG */
-       sizetab[OTHER_POINTER_LOWTAG|(i<<3)] = size_pointer;
+       sizetab[OTHER_POINTER_LOWTAG|(i<<N_LOWTAG_BITS)] = size_pointer;
     }
     sizetab[BIGNUM_WIDETAG] = size_unboxed;
     sizetab[RATIO_WIDETAG] = size_boxed;
@@ -1743,12 +1819,26 @@ gc_init_tables(void)
        size_vector_unsigned_byte_16;
     sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] =
        size_vector_unsigned_byte_16;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG
     sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_29_WIDETAG] =
        size_vector_unsigned_byte_32;
+#endif
     sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG] =
        size_vector_unsigned_byte_32;
     sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] =
        size_vector_unsigned_byte_32;
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG
+    sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG] =
+       size_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG
+    sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG] =
+       size_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG
+    sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG] =
+       size_vector_unsigned_byte_64;
+#endif
 #ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG
     sizetab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = size_vector_unsigned_byte_8;
 #endif
@@ -1764,6 +1854,14 @@ gc_init_tables(void)
     sizetab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] =
        size_vector_unsigned_byte_32;
 #endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG
+    sizetab[SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG] =
+       size_vector_unsigned_byte_64;
+#endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG
+    sizetab[SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG] =
+       size_vector_unsigned_byte_64;
+#endif
     sizetab[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = size_vector_single_float;
     sizetab[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = size_vector_double_float;
 #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG
@@ -1803,3 +1901,25 @@ gc_init_tables(void)
     sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed;
     sizetab[FDEFN_WIDETAG] = size_boxed;
 }
+
+\f
+/* Find the code object for the given pc, or return NULL on
+   failure. */
+lispobj *
+component_ptr_from_pc(lispobj *pc)
+{
+    lispobj *object = NULL;
+
+    if ( (object = search_read_only_space(pc)) )
+       ;
+    else if ( (object = search_static_space(pc)) )
+       ;
+    else
+       object = search_dynamic_space(pc);
+
+    if (object) /* if we found something */
+       if (widetag_of(*object) == CODE_HEADER_WIDETAG)
+           return(object);
+
+    return (NULL);
+}