X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fruntime%2Fgc-common.c;h=8e8b3fa244598cc0e8e871ee1afc66fcc7289871;hb=e3547b45241fdc4a2aaab382f1e7e8f71566beba;hp=a7d203417a93a4c76517f6a8f45a72f362917ce1;hpb=457d80803848ccd73b28508177f1888ff66bc72f;p=sbcl.git diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index a7d2034..8e8b3fa 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -41,6 +41,7 @@ #include "gc.h" #include "genesis/primitive-objects.h" #include "genesis/static-symbols.h" +#include "genesis/layout.h" #include "gc-internal.h" #ifdef LISP_FEATURE_SPARC @@ -81,9 +82,9 @@ set_forwarding_pointer(lispobj * pointer, lispobj newspace_copy) { return newspace_copy; } -int (*scavtab[256])(lispobj *where, lispobj object); +long (*scavtab[256])(lispobj *where, lispobj object); lispobj (*transother[256])(lispobj object); -int (*sizetab[256])(lispobj *where); +long (*sizetab[256])(lispobj *where); struct weak_pointer *weak_pointers; unsigned long bytes_consed_between_gcs = 12*1024*1024; @@ -95,7 +96,7 @@ unsigned long bytes_consed_between_gcs = 12*1024*1024; /* to copy a boxed object */ lispobj -copy_object(lispobj object, int nwords) +copy_object(lispobj object, long nwords) { int tag; lispobj *new; @@ -115,7 +116,7 @@ copy_object(lispobj object, int nwords) return make_lispobj(new,tag); } -static int scav_lose(lispobj *where, lispobj object); /* forward decl */ +static long scav_lose(lispobj *where, lispobj object); /* forward decl */ /* FIXME: Most calls end up going to some trouble to compute an * 'n_words' value for this function. The system might be a little @@ -125,8 +126,9 @@ scavenge(lispobj *start, long n_words) { lispobj *end = start + n_words; lispobj *object_ptr; - int n_words_scavenged; + long n_words_scavenged; for (object_ptr = start; + object_ptr < end; object_ptr += n_words_scavenged) { @@ -191,7 +193,7 @@ scavenge(lispobj *start, long n_words) static lispobj trans_fun_header(lispobj object); /* forward decls */ static lispobj trans_boxed(lispobj object); -static int +static long scav_fun_pointer(lispobj *where, lispobj object) { lispobj *first_pointer; @@ -233,7 +235,7 @@ trans_code(struct code *code) { struct code *new_code; lispobj first, l_code, l_new_code; - int nheader_words, ncode_words, nwords; + long nheader_words, ncode_words, nwords; unsigned long displacement; lispobj fheaderl, *prev_pointer; @@ -301,7 +303,7 @@ trans_code(struct code *code) /* fix self pointer. */ nfheaderp->self = -#ifdef LISP_FEATURE_X86 +#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) FUN_RAW_ADDR_OFFSET + #endif nfheaderl; @@ -311,19 +313,19 @@ trans_code(struct code *code) fheaderl = fheaderp->next; prev_pointer = &nfheaderp->next; } - os_flush_icache((os_vm_address_t) (((int *)new_code) + nheader_words), - ncode_words * sizeof(int)); + os_flush_icache((os_vm_address_t) (((long *)new_code) + nheader_words), + ncode_words * sizeof(long)); #ifdef LISP_FEATURE_GENCGC gencgc_apply_code_fixups(code, new_code); #endif return new_code; } -static int +static long scav_code_header(lispobj *where, lispobj object) { struct code *code; - int n_header_words, n_code_words, n_words; + long n_header_words, n_code_words, n_words; lispobj entry_point; /* tagged pointer to entry point */ struct simple_fun *function_ptr; /* untagged pointer to entry point */ @@ -365,11 +367,11 @@ trans_code_header(lispobj object) } -static int +static long size_code_header(lispobj *where) { struct code *code; - int nheader_words, ncode_words, nwords; + long nheader_words, ncode_words, nwords; code = (struct code *) where; @@ -381,8 +383,8 @@ size_code_header(lispobj *where) return nwords; } -#ifndef LISP_FEATURE_X86 -static int +#if !defined(LISP_FEATURE_X86) && ! defined(LISP_FEATURE_X86_64) +static long scav_return_pc_header(lispobj *where, lispobj object) { lose("attempted to scavenge a return PC header where=0x%08x object=0x%08x", @@ -416,8 +418,8 @@ trans_return_pc_header(lispobj object) * objects don't move, we don't need to update anything, but we do * have to figure out that the function is still live. */ -#ifdef LISP_FEATURE_X86 -static int +#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) +static long scav_closure_header(lispobj *where, lispobj object) { struct closure *closure; @@ -436,8 +438,8 @@ scav_closure_header(lispobj *where, lispobj object) } #endif -#ifndef LISP_FEATURE_X86 -static int +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) +static long scav_fun_header(lispobj *where, lispobj object) { lose("attempted to scavenge a function header where=0x%08x object=0x%08x", @@ -470,7 +472,7 @@ trans_fun_header(lispobj object) * instances */ -static int +static long scav_instance_pointer(lispobj *where, lispobj object) { lispobj copy, *first_pointer; @@ -496,7 +498,7 @@ scav_instance_pointer(lispobj *where, lispobj object) static lispobj trans_list(lispobj object); -static int +static long scav_list_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; @@ -580,7 +582,7 @@ trans_list(lispobj object) * scavenging and transporting other pointers */ -static int +static long scav_other_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; @@ -610,13 +612,13 @@ scav_other_pointer(lispobj *where, lispobj object) * immediate, boxed, and unboxed objects */ -static int +static long size_pointer(lispobj *where) { return 1; } -static int +static long scav_immediate(lispobj *where, lispobj object) { return 1; @@ -629,19 +631,37 @@ trans_immediate(lispobj object) return NIL; /* bogus return value to satisfy static type checking */ } -static int +static long size_immediate(lispobj *where) { return 1; } -static int +static long scav_boxed(lispobj *where, lispobj object) { return 1; } +static long +scav_instance(lispobj *where, lispobj object) +{ + lispobj nuntagged; + long ntotal = HeaderValue(object); + lispobj layout = ((struct instance *)native_pointer(where))->slots[0]; + + if (!layout) + return 1; + if (forwarding_pointer_p(native_pointer(layout))) + layout = (lispobj) forwarding_pointer_value(native_pointer(layout)); + + nuntagged = ((struct layout *)native_pointer(layout))->n_untagged_slots; + scavenge(where + 1, ntotal - fixnum_value(nuntagged)); + + return ntotal + 1; +} + static lispobj trans_boxed(lispobj object) { @@ -658,7 +678,7 @@ trans_boxed(lispobj object) } -static int +static long size_boxed(lispobj *where) { lispobj header; @@ -674,7 +694,7 @@ size_boxed(lispobj *where) /* Note: on the sparc we don't have to do anything special for fdefns, */ /* 'cause the raw-addr has a function lowtag. */ #ifndef LISP_FEATURE_SPARC -static int +static long scav_fdefn(lispobj *where, lispobj object) { struct fdefn *fdefn; @@ -702,7 +722,7 @@ scav_fdefn(lispobj *where, lispobj object) } #endif -static int +static long scav_unboxed(lispobj *where, lispobj object) { unsigned long length; @@ -729,7 +749,7 @@ trans_unboxed(lispobj object) return copy_unboxed_object(object, length); } -static int +static long size_unboxed(lispobj *where) { lispobj header; @@ -742,13 +762,13 @@ size_unboxed(lispobj *where) return length; } -static int + /* vector-like objects */ - +static long scav_base_string(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; /* NOTE: Strings contain one more byte of data than the length */ /* slot indicates. */ @@ -763,7 +783,7 @@ static lispobj trans_base_string(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -778,11 +798,11 @@ trans_base_string(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int -size_character_string(lispobj *where) +static long +size_base_string(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; /* NOTE: A string contains one more byte of data (a terminating * '\0' to help when interfacing with C functions) than indicated @@ -790,11 +810,12 @@ size_character_string(lispobj *where) vector = (struct vector *) where; length = fixnum_value(vector->length) + 1; - nwords = CEILING(NWORDS(length, 32) + 2, 2); + nwords = CEILING(NWORDS(length, 8) + 2, 2); return nwords; } +static long scav_character_string(lispobj *where, lispobj object) { struct vector *vector; @@ -828,8 +849,8 @@ trans_character_string(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int -size_base_string(lispobj *where) +static long +size_character_string(lispobj *where) { struct vector *vector; int length, nwords; @@ -840,7 +861,7 @@ size_base_string(lispobj *where) vector = (struct vector *) where; length = fixnum_value(vector->length) + 1; - nwords = CEILING(NWORDS(length, 8) + 2, 2); + nwords = CEILING(NWORDS(length, 32) + 2, 2); return nwords; } @@ -849,7 +870,7 @@ static lispobj trans_vector(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -861,11 +882,11 @@ trans_vector(lispobj object) return copy_large_object(object, nwords); } -static int +static long size_vector(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -874,7 +895,7 @@ size_vector(lispobj *where) return nwords; } -static int +static long scav_vector_nil(lispobj *where, lispobj object) { return 2; @@ -887,18 +908,18 @@ trans_vector_nil(lispobj object) return copy_unboxed_object(object, 2); } -static int +static long size_vector_nil(lispobj *where) { /* Just the header word and the length word */ return 2; } -static int +static long scav_vector_bit(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -911,7 +932,7 @@ static lispobj trans_vector_bit(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -922,11 +943,11 @@ trans_vector_bit(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_bit(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -935,11 +956,11 @@ size_vector_bit(lispobj *where) return nwords; } -static int +static long scav_vector_unsigned_byte_2(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -952,7 +973,7 @@ static lispobj trans_vector_unsigned_byte_2(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -963,11 +984,11 @@ trans_vector_unsigned_byte_2(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_2(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -976,11 +997,11 @@ size_vector_unsigned_byte_2(lispobj *where) return nwords; } -static int +static long scav_vector_unsigned_byte_4(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -993,7 +1014,7 @@ static lispobj trans_vector_unsigned_byte_4(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1003,11 +1024,11 @@ trans_vector_unsigned_byte_4(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_4(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1017,11 +1038,11 @@ size_vector_unsigned_byte_4(lispobj *where) } -static int +static long scav_vector_unsigned_byte_8(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1038,7 +1059,7 @@ static lispobj trans_vector_unsigned_byte_8(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1049,11 +1070,11 @@ trans_vector_unsigned_byte_8(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_8(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1063,11 +1084,11 @@ size_vector_unsigned_byte_8(lispobj *where) } -static int +static long scav_vector_unsigned_byte_16(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1080,7 +1101,7 @@ static lispobj trans_vector_unsigned_byte_16(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1091,11 +1112,11 @@ trans_vector_unsigned_byte_16(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_16(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1104,11 +1125,11 @@ size_vector_unsigned_byte_16(lispobj *where) return nwords; } -static int +static long scav_vector_unsigned_byte_32(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1121,7 +1142,7 @@ static lispobj trans_vector_unsigned_byte_32(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1132,11 +1153,11 @@ trans_vector_unsigned_byte_32(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_32(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1146,11 +1167,11 @@ size_vector_unsigned_byte_32(lispobj *where) } #if N_WORD_BITS == 64 -static int +static long scav_vector_unsigned_byte_64(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1163,7 +1184,7 @@ static lispobj trans_vector_unsigned_byte_64(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1174,11 +1195,11 @@ trans_vector_unsigned_byte_64(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_unsigned_byte_64(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1188,11 +1209,11 @@ size_vector_unsigned_byte_64(lispobj *where) } #endif -static int +static long scav_vector_single_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1205,7 +1226,7 @@ static lispobj trans_vector_single_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1216,11 +1237,11 @@ trans_vector_single_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_single_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1229,11 +1250,11 @@ size_vector_single_float(lispobj *where) return nwords; } -static int +static long scav_vector_double_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1246,7 +1267,7 @@ static lispobj trans_vector_double_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1257,11 +1278,11 @@ trans_vector_double_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_double_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1271,11 +1292,11 @@ size_vector_double_float(lispobj *where) } #ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG -static int +static long scav_vector_long_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1289,7 +1310,7 @@ static lispobj trans_vector_long_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1300,11 +1321,11 @@ trans_vector_long_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_long_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1316,11 +1337,11 @@ size_vector_long_float(lispobj *where) #ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG -static int +static long scav_vector_complex_single_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1333,7 +1354,7 @@ static lispobj trans_vector_complex_single_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1344,11 +1365,11 @@ trans_vector_complex_single_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_complex_single_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1359,11 +1380,11 @@ size_vector_complex_single_float(lispobj *where) #endif #ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG -static int +static long scav_vector_complex_double_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1376,7 +1397,7 @@ static lispobj trans_vector_complex_double_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1387,11 +1408,11 @@ trans_vector_complex_double_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_complex_double_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1403,11 +1424,11 @@ size_vector_complex_double_float(lispobj *where) #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG -static int +static long scav_vector_complex_long_float(lispobj *where, lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1420,7 +1441,7 @@ static lispobj trans_vector_complex_long_float(lispobj object) { struct vector *vector; - int length, nwords; + long length, nwords; gc_assert(is_lisp_pointer(object)); @@ -1431,11 +1452,11 @@ trans_vector_complex_long_float(lispobj object) return copy_large_unboxed_object(object, nwords); } -static int +static long size_vector_complex_long_float(lispobj *where) { struct vector *vector; - int length, nwords; + long length, nwords; vector = (struct vector *) where; length = fixnum_value(vector->length); @@ -1476,7 +1497,7 @@ trans_weak_pointer(lispobj object) return copy; } -static int +static long size_weak_pointer(lispobj *where) { return WEAK_POINTER_NWORDS; @@ -1518,7 +1539,7 @@ void scan_weak_pointers(void) * initialization */ -static int +static long scav_lose(lispobj *where, lispobj object) { lose("no scavenge function for object 0x%08x (widetag 0x%x)", @@ -1537,7 +1558,7 @@ trans_lose(lispobj object) return NIL; /* bogus return value to satisfy static type checking */ } -static int +static long size_lose(lispobj *where) { lose("no size function for object at 0x%08x (widetag 0x%x)", @@ -1554,7 +1575,7 @@ size_lose(lispobj *where) void gc_init_tables(void) { - int i; + long i; /* Set default value in all slots of scavenge table. FIXME * replace this gnarly sizeof with something based on @@ -1583,7 +1604,11 @@ gc_init_tables(void) * tag) get one entry each in the scavenge table. */ scavtab[BIGNUM_WIDETAG] = scav_unboxed; scavtab[RATIO_WIDETAG] = scav_boxed; +#if N_WORD_BITS == 64 + scavtab[SINGLE_FLOAT_WIDETAG] = scav_immediate; +#else scavtab[SINGLE_FLOAT_WIDETAG] = scav_unboxed; +#endif scavtab[DOUBLE_FLOAT_WIDETAG] = scav_unboxed; #ifdef LONG_FLOAT_WIDETAG scavtab[LONG_FLOAT_WIDETAG] = scav_unboxed; @@ -1690,7 +1715,7 @@ gc_init_tables(void) scavtab[SIMPLE_FUN_HEADER_WIDETAG] = scav_fun_header; scavtab[RETURN_PC_HEADER_WIDETAG] = scav_return_pc_header; #endif -#ifdef LISP_FEATURE_X86 +#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) scavtab[CLOSURE_HEADER_WIDETAG] = scav_closure_header; scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_closure_header; #else @@ -1702,7 +1727,7 @@ gc_init_tables(void) scavtab[CHARACTER_WIDETAG] = scav_immediate; scavtab[SAP_WIDETAG] = scav_unboxed; scavtab[UNBOUND_MARKER_WIDETAG] = scav_immediate; - scavtab[INSTANCE_HEADER_WIDETAG] = scav_boxed; + scavtab[INSTANCE_HEADER_WIDETAG] = scav_instance; #ifdef LISP_FEATURE_SPARC scavtab[FDEFN_WIDETAG] = scav_boxed; #else @@ -1714,7 +1739,12 @@ gc_init_tables(void) transother[i] = trans_lose; transother[BIGNUM_WIDETAG] = trans_unboxed; transother[RATIO_WIDETAG] = trans_boxed; + +#if N_WORD_BITS == 64 + transother[SINGLE_FLOAT_WIDETAG] = trans_immediate; +#else transother[SINGLE_FLOAT_WIDETAG] = trans_unboxed; +#endif transother[DOUBLE_FLOAT_WIDETAG] = trans_unboxed; #ifdef LONG_FLOAT_WIDETAG transother[LONG_FLOAT_WIDETAG] = trans_unboxed; @@ -1850,7 +1880,11 @@ gc_init_tables(void) } sizetab[BIGNUM_WIDETAG] = size_unboxed; sizetab[RATIO_WIDETAG] = size_boxed; +#if N_WORD_BITS == 64 + sizetab[SINGLE_FLOAT_WIDETAG] = size_immediate; +#else sizetab[SINGLE_FLOAT_WIDETAG] = size_unboxed; +#endif sizetab[DOUBLE_FLOAT_WIDETAG] = size_unboxed; #ifdef LONG_FLOAT_WIDETAG sizetab[LONG_FLOAT_WIDETAG] = size_unboxed; @@ -1992,3 +2026,40 @@ component_ptr_from_pc(lispobj *pc) return (NULL); } + +/* Scan an area looking for an object which encloses the given pointer. + * Return the object start on success or NULL on failure. */ +lispobj * +gc_search_space(lispobj *start, size_t words, lispobj *pointer) +{ + while (words > 0) { + size_t count = 1; + lispobj thing = *start; + + /* If thing is an immediate then this is a cons. */ + if (is_lisp_pointer(thing) + || (fixnump(thing)) + || (widetag_of(thing) == CHARACTER_WIDETAG) +#if N_WORD_BITS == 64 + || (widetag_of(thing) == SINGLE_FLOAT_WIDETAG) +#endif + || (widetag_of(thing) == UNBOUND_MARKER_WIDETAG)) + count = 2; + else + count = (sizetab[widetag_of(thing)])(start); + + /* Check whether the pointer is within this object. */ + if ((pointer >= start) && (pointer < (start+count))) { + /* found it! */ + /*FSHOW((stderr,"/found %x in %x %x\n", pointer, start, thing));*/ + return(start); + } + + /* Round up the count. */ + count = CEILING(count,2); + + start += count; + words -= count; + } + return (NULL); +}