X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fgc.c;h=bf7659675320d419f2e4bff655d7381b8c2dc1c1;hb=683874b497a99cd2c11b6c5d9b47e2785b1ede5f;hp=b751687322b7b0dd210112dd2ac8ab102d07075f;hpb=63fcb94b875a97e468d9add229e220ecceec2352;p=sbcl.git diff --git a/src/runtime/gc.c b/src/runtime/gc.c index b751687..bf76596 100644 --- a/src/runtime/gc.c +++ b/src/runtime/gc.c @@ -68,31 +68,33 @@ static int scav_lose(lispobj *where, lispobj object); #define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1))) -/* Predicates */ +/* predicates */ #if defined(DEBUG_SPACE_PREDICATES) -boolean from_space_p(lispobj object) +boolean +from_space_p(lispobj object) { lispobj *ptr; /* this can be called for untagged pointers as well as for descriptors, so this assertion's not applicable - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); */ - ptr = (lispobj *) PTR(object); + ptr = (lispobj *) native_pointer(object); return ((from_space <= ptr) && (ptr < from_space_free_pointer)); } -boolean new_space_p(lispobj object) +boolean +new_space_p(lispobj object) { lispobj *ptr; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - ptr = (lispobj *) PTR(object); + ptr = (lispobj *) native_pointer(object); return ((new_space <= ptr) && (ptr < new_space_free_pointer)); @@ -111,7 +113,7 @@ boolean new_space_p(lispobj object) #endif -/* Copying Objects */ +/* copying objects */ static lispobj copy_object(lispobj object, int nwords) @@ -120,19 +122,19 @@ copy_object(lispobj object, int nwords) lispobj *new; lispobj *source, *dest; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); gc_assert(from_space_p(object)); gc_assert((nwords & 0x01) == 0); /* get tag of object */ - tag = LowtagOf(object); + tag = lowtag_of(object); /* allocate space */ new = new_space_free_pointer; new_space_free_pointer += nwords; dest = new; - source = (lispobj *) PTR(object); + source = (lispobj *) native_pointer(object); #ifdef DEBUG_COPY_VERBOSE fprintf(stderr,"Copying %d words from %p to %p\n", nwords,source,new); @@ -151,10 +153,11 @@ copy_object(lispobj object, int nwords) } -/* Collect Garbage */ +/* collecting garbage */ #ifdef PRINTNOISE -static double tv_diff(struct timeval *x, struct timeval *y) +static double +tv_diff(struct timeval *x, struct timeval *y) { return (((double) x->tv_sec + (double) x->tv_usec * 1.0e-6) - ((double) y->tv_sec + (double) y->tv_usec * 1.0e-6)); @@ -168,7 +171,8 @@ static double tv_diff(struct timeval *x, struct timeval *y) #else #define U32 unsigned long #endif -static void zero_stack(void) +static void +zero_stack(void) { U32 *ptr = (U32 *)current_control_stack_pointer; search: @@ -188,10 +192,11 @@ static void zero_stack(void) #undef U32 -/* this is not generational. It's called with a last_gen arg, which we shun. - */ - -void collect_garbage(unsigned ignore) +/* Note: The generic GC interface we're implementing passes us a + * last_generation argument. That's meaningless for us, since we're + * not a generational GC. So we ignore it. */ +void +collect_garbage(unsigned ignore) { #ifdef PRINTNOISE struct timeval start_tv, stop_tv; @@ -225,14 +230,12 @@ struct timeval start_tv, stop_tv; /* Set up from space and new space pointers. */ from_space = current_dynamic_space; -#ifndef ibmrt from_space_free_pointer = dynamic_space_free_pointer; -#else - from_space_free_pointer = (lispobj *)SymbolValue(ALLOCATION_POINTER); -#endif +#ifdef PRINTNOISE fprintf(stderr,"from_space = %lx\n", (unsigned long) current_dynamic_space); +#endif if (current_dynamic_space == (lispobj *) DYNAMIC_0_SPACE_START) new_space = (lispobj *)DYNAMIC_1_SPACE_START; else if (current_dynamic_space == (lispobj *) DYNAMIC_1_SPACE_START) @@ -272,14 +275,9 @@ struct timeval start_tv, stop_tv; scavenge(((lispobj *)CONTROL_STACK_START), control_stack_size); -#ifdef ibmrt - binding_stack_size = - (lispobj *)SymbolValue(BINDING_STACK_POINTER) - binding_stack; -#else binding_stack_size = current_binding_stack_pointer - (lispobj *)BINDING_STACK_START; -#endif #ifdef PRINTNOISE printf("Scavenging the binding stack %x - %x (%d words) ...\n", BINDING_STACK_START,current_binding_stack_pointer, @@ -324,11 +322,7 @@ struct timeval start_tv, stop_tv; (os_vm_size_t) DYNAMIC_SPACE_SIZE); current_dynamic_space = new_space; -#ifndef ibmrt dynamic_space_free_pointer = new_space_free_pointer; -#else - SetSymbolValue(ALLOCATION_POINTER, (lispobj)new_space_free_pointer); -#endif #ifdef PRINTNOISE size_discarded = (from_space_free_pointer - from_space) * sizeof(lispobj); @@ -377,9 +371,7 @@ struct timeval start_tv, stop_tv; } -/* Scavenging */ - -#define DIRECT_SCAV 0 +/* scavenging */ static void scavenge(lispobj *start, u32 nwords) @@ -389,25 +381,23 @@ scavenge(lispobj *start, u32 nwords) int type, words_scavenged; object = *start; - type = TypeOf(object); + type = widetag_of(object); #if defined(DEBUG_SCAVENGE_VERBOSE) fprintf(stderr,"Scavenging object at 0x%08x, object = 0x%08x, type = %d\n", (unsigned long) start, (unsigned long) object, type); #endif -#if DIRECT_SCAV - words_scavenged = (scavtab[type])(start, object); -#else - if (Pointerp(object)) { + if (is_lisp_pointer(object)) { /* It be a pointer. */ if (from_space_p(object)) { /* It currently points to old space. Check for a */ /* forwarding pointer. */ lispobj first_word; - first_word = *((lispobj *)PTR(object)); - if (Pointerp(first_word) && new_space_p(first_word)) { + first_word = *((lispobj *)native_pointer(object)); + if (is_lisp_pointer(first_word) && + new_space_p(first_word)) { /* Yep, there be a forwarding pointer. */ *start = first_word; words_scavenged = 1; @@ -449,14 +439,15 @@ scavenge(lispobj *start, u32 nwords) words_scavenged = (scavtab[type])(start, object); } -#endif + start += words_scavenged; nwords -= words_scavenged; } gc_assert(nwords == 0); } -static void scavenge_newspace(void) +static void +scavenge_newspace(void) { lispobj *here, *next; @@ -470,13 +461,13 @@ static void scavenge_newspace(void) } /* printf("done with newspace\n"); */ } - -/* Scavenging Interrupt Contexts */ +/* scavenging interrupt contexts */ static int boxed_registers[] = BOXED_REGISTERS; -static void scavenge_interrupt_context(os_context_t *context) +static void +scavenge_interrupt_context(os_context_t *context) { int i; #ifdef reg_LIP @@ -504,7 +495,7 @@ static void scavenge_interrupt_context(os_context_t *context) index = boxed_registers[i]; reg = *os_context_register_addr(context, index); /* would be using PTR if not for integer length issues */ - if ((reg & ~((1L<header; - if (Pointerp(first) && new_space_p(first)) { + if (is_lisp_pointer(first) && new_space_p(first)) { #ifdef DEBUG_CODE_GC printf("Was already transported\n"); #endif - return (struct code *) PTR(first); + return (struct code *) native_pointer(first); } - gc_assert(TypeOf(first) == type_CodeHeader); + gc_assert(widetag_of(first) == CODE_HEADER_WIDETAG); /* prepare to transport the code vector */ - l_code = (lispobj) LOW_WORD(code) | type_OtherPointer; + l_code = (lispobj) LOW_WORD(code) | OTHER_POINTER_LOWTAG; ncode_words = fixnum_value(code->code_size); nheader_words = HeaderValue(code->header); @@ -751,7 +698,7 @@ trans_code(struct code *code) nwords = CEILING(nwords, 2); l_new_code = copy_object(l_code, nwords); - new_code = (struct code *) PTR(l_new_code); + new_code = (struct code *) native_pointer(l_new_code); displacement = l_new_code - l_code; @@ -771,16 +718,16 @@ trans_code(struct code *code) prev_pointer = &new_code->entry_points; while (fheaderl != NIL) { - struct function *fheaderp, *nfheaderp; + struct simple_fun *fheaderp, *nfheaderp; lispobj nfheaderl; - fheaderp = (struct function *) PTR(fheaderl); - gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader); + fheaderp = (struct simple_fun *) native_pointer(fheaderl); + gc_assert(widetag_of(fheaderp->header) == SIMPLE_FUN_HEADER_WIDETAG); /* calcuate the new function pointer and the new */ /* function header */ nfheaderl = fheaderl + displacement; - nfheaderp = (struct function *) PTR(nfheaderl); + nfheaderp = (struct simple_fun *) native_pointer(nfheaderl); /* set forwarding pointer */ #ifdef DEBUG_CODE_GC @@ -811,7 +758,7 @@ scav_code_header(lispobj *where, lispobj object) struct code *code; int nheader_words, ncode_words, nwords; lispobj fheaderl; - struct function *fheaderp; + struct simple_fun *fheaderp; code = (struct code *) where; ncode_words = fixnum_value(code->code_size); @@ -834,12 +781,12 @@ scav_code_header(lispobj *where, lispobj object) /* code data block */ fheaderl = code->entry_points; while (fheaderl != NIL) { - fheaderp = (struct function *) PTR(fheaderl); - gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader); + fheaderp = (struct simple_fun *) native_pointer(fheaderl); + gc_assert(widetag_of(fheaderp->header) == SIMPLE_FUN_HEADER_WIDETAG); #if defined(DEBUG_CODE_GC) printf("Scavenging boxed section of entry point located at 0x%08x.\n", - (unsigned long) PTR(fheaderl)); + (unsigned long) native_pointer(fheaderl)); #endif scavenge(&fheaderp->name, 1); scavenge(&fheaderp->arglist, 1); @@ -856,8 +803,8 @@ trans_code_header(lispobj object) { struct code *ncode; - ncode = trans_code((struct code *) PTR(object)); - return (lispobj) LOW_WORD(ncode) | type_OtherPointer; + ncode = trans_code((struct code *) native_pointer(object)); + return (lispobj) LOW_WORD(ncode) | OTHER_POINTER_LOWTAG; } static int @@ -890,11 +837,11 @@ scav_return_pc_header(lispobj *where, lispobj object) static lispobj trans_return_pc_header(lispobj object) { - struct function *return_pc; + struct simple_fun *return_pc; unsigned long offset; struct code *code, *ncode; lispobj ret; - return_pc = (struct function *) PTR(object); + return_pc = (struct simple_fun *) native_pointer(object); offset = HeaderValue(return_pc->header) * 4 ; /* Transport the whole code object */ @@ -904,21 +851,21 @@ trans_return_pc_header(lispobj object) #endif ncode = trans_code(code); if(object==0x304748d7) { - /* ldb_monitor(); */ + /* monitor_or_something(); */ } - ret= ((lispobj) LOW_WORD(ncode) + offset) | type_OtherPointer; + ret= ((lispobj) LOW_WORD(ncode) + offset) | OTHER_POINTER_LOWTAG; #ifdef DEBUG_CODE_GC printf("trans_return_pc_header returning %x\n",ret); #endif return ret; } -/* On the 386, closures hold a pointer to the raw address instead of the - function object, so we can use CALL [$FDEFN+const] to invoke the function - without loading it into a register. Given that code 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 i386 +/* On the 386, closures hold a pointer to the raw address instead of + * the function object, so we can use CALL [$FDEFN+const] to invoke + * the function without loading it into a register. Given that code + * 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 __i386__ static scav_closure_header(where, object) lispobj *where, object; @@ -927,7 +874,7 @@ lispobj *where, object; lispobj fun; closure = (struct closure *)where; - fun = closure->function - RAW_ADDR_OFFSET; + fun = closure->fun - FUN_RAW_ADDR_OFFSET; scavenge(&fun, 1); return 2; @@ -935,7 +882,7 @@ lispobj *where, object; #endif static int -scav_function_header(lispobj *where, lispobj object) +scav_fun_header(lispobj *where, lispobj object) { fprintf(stderr, "GC lossage. Should not be scavenging a "); fprintf(stderr, "Function Header.\n"); @@ -946,107 +893,61 @@ scav_function_header(lispobj *where, lispobj object) } static lispobj -trans_function_header(lispobj object) +trans_fun_header(lispobj object) { - struct function *fheader; + struct simple_fun *fheader; unsigned long offset; struct code *code, *ncode; - fheader = (struct function *) PTR(object); + fheader = (struct simple_fun *) native_pointer(object); offset = HeaderValue(fheader->header) * 4; /* Transport the whole code object */ code = (struct code *) ((unsigned long) fheader - offset); ncode = trans_code(code); - return ((lispobj) LOW_WORD(ncode) + offset) | type_FunctionPointer; + return ((lispobj) LOW_WORD(ncode) + offset) | FUN_POINTER_LOWTAG; } -/* Instances */ +/* instances */ -#if DIRECT_SCAV -static int -scav_instance_pointer(lispobj *where, lispobj object) -{ - if (from_space_p(object)) { - lispobj first, *first_pointer; - - /* object is a pointer into from space. check to see */ - /* if it has been forwarded */ - first_pointer = (lispobj *) PTR(object); - first = *first_pointer; - - if (!(Pointerp(first) && new_space_p(first))) - first = *first_pointer = trans_boxed(object); - *where = first; - } - return 1; -} -#else static int scav_instance_pointer(lispobj *where, lispobj object) { lispobj *first_pointer; /* object is a pointer into from space. Not a FP */ - first_pointer = (lispobj *) PTR(object); + first_pointer = (lispobj *) native_pointer(object); *where = *first_pointer = trans_boxed(object); return 1; } -#endif -/* Lists and Conses */ +/* lists and conses */ static lispobj trans_list(lispobj object); -#if DIRECT_SCAV -static int -scav_list_pointer(lispobj *where, lispobj object) -{ - gc_assert(Pointerp(object)); - - if (from_space_p(object)) { - lispobj first, *first_pointer; - - /* object is a pointer into from space. check to see */ - /* if it has been forwarded */ - first_pointer = (lispobj *) PTR(object); - first = *first_pointer; - - if (!(Pointerp(first) && new_space_p(first))) - first = *first_pointer = trans_list(object); - - gc_assert(Pointerp(first)); - gc_assert(!from_space_p(first)); - - *where = first; - } - return 1; -} -#else static int scav_list_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); /* object is a pointer into from space. Not a FP. */ - first_pointer = (lispobj *) PTR(object); + first_pointer = (lispobj *) native_pointer(object); first = *first_pointer = trans_list(object); - gc_assert(Pointerp(first)); + gc_assert(is_lisp_pointer(first)); gc_assert(!from_space_p(first)); *where = first; return 1; } -#endif static lispobj trans_list(lispobj object) @@ -1054,11 +955,11 @@ trans_list(lispobj object) lispobj new_list_pointer; struct cons *cons, *new_cons; - cons = (struct cons *) PTR(object); + cons = (struct cons *) native_pointer(object); /* ### Don't use copy_object here. */ new_list_pointer = copy_object(object, 2); - new_cons = (struct cons *) PTR(new_list_pointer); + new_cons = (struct cons *) native_pointer(new_list_pointer); /* Set forwarding pointer. */ cons->car = new_list_pointer; @@ -1072,17 +973,17 @@ trans_list(lispobj object) cdr = cons->cdr; - if (LowtagOf(cdr) != type_ListPointer || + if (lowtag_of(cdr) != LIST_POINTER_LOWTAG || !from_space_p(cdr) || - (Pointerp(first = *(lispobj *)PTR(cdr)) && - new_space_p(first))) + (is_lisp_pointer(first = *(lispobj *)native_pointer(cdr)) + && new_space_p(first))) break; - cdr_cons = (struct cons *) PTR(cdr); + cdr_cons = (struct cons *) native_pointer(cdr); /* ### Don't use copy_object here */ new_cdr = copy_object(cdr, 2); - new_cdr_cons = (struct cons *) PTR(new_cdr); + new_cdr_cons = (struct cons *) native_pointer(new_cdr); /* Set forwarding pointer */ cdr_cons->car = new_cdr; @@ -1100,55 +1001,28 @@ trans_list(lispobj object) } -/* Scavenging and Transporting Other Pointers */ - -#if DIRECT_SCAV -static int -scav_other_pointer(lispobj *where, lispobj object) -{ - gc_assert(Pointerp(object)); +/* scavenging and transporting other pointers */ - if (from_space_p(object)) { - lispobj first, *first_pointer; - - /* object is a pointer into from space. check to see */ - /* if it has been forwarded */ - first_pointer = (lispobj *) PTR(object); - first = *first_pointer; - - if (!(Pointerp(first) && new_space_p(first))) - first = *first_pointer = - (transother[TypeOf(first)])(object); - - gc_assert(Pointerp(first)); - gc_assert(!from_space_p(first)); - - *where = first; - } - return 1; -} -#else static int scav_other_pointer(lispobj *where, lispobj object) { lispobj first, *first_pointer; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); /* Object is a pointer into from space - not a FP */ - first_pointer = (lispobj *) PTR(object); - first = *first_pointer = (transother[TypeOf(*first_pointer)])(object); + first_pointer = (lispobj *) native_pointer(object); + first = *first_pointer = (transother[widetag_of(*first_pointer)])(object); - gc_assert(Pointerp(first)); + gc_assert(is_lisp_pointer(first)); gc_assert(!from_space_p(first)); *where = first; return 1; } -#endif -/* Immediate, Boxed, and Unboxed Objects */ +/* immediate, boxed, and unboxed objects */ static int size_pointer(lispobj *where) @@ -1189,9 +1063,9 @@ trans_boxed(lispobj object) lispobj header; unsigned long length; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - header = *((lispobj *) PTR(object)); + header = *((lispobj *) native_pointer(object)); length = HeaderValue(header) + 1; length = CEILING(length, 2); @@ -1212,7 +1086,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. */ +/* 'cause the raw-addr has a function lowtag. */ #ifndef sparc static int scav_fdefn(lispobj *where, lispobj object) @@ -1221,10 +1095,11 @@ scav_fdefn(lispobj *where, lispobj object) fdefn = (struct fdefn *)where; - if ((char *)(fdefn->function + RAW_ADDR_OFFSET) + if ((char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET) == (char *)((unsigned long)(fdefn->raw_addr))) { scavenge(where + 1, sizeof(struct fdefn)/sizeof(lispobj) - 1); - fdefn->raw_addr = (u32) ((char *) LOW_WORD(fdefn->function)) + RAW_ADDR_OFFSET; + fdefn->raw_addr = + (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET; return sizeof(struct fdefn) / sizeof(lispobj); } else @@ -1250,9 +1125,9 @@ trans_unboxed(lispobj object) unsigned long length; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - header = *((lispobj *) PTR(object)); + header = *((lispobj *) native_pointer(object)); length = HeaderValue(header) + 1; length = CEILING(length, 2); @@ -1273,7 +1148,7 @@ size_unboxed(lispobj *where) } -/* Vector-Like Objects */ +/* vector-like objects */ #define NWORDS(x,y) (CEILING((x),(y)) / (y)) @@ -1299,12 +1174,12 @@ trans_string(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); /* NOTE: Strings contain one more byte of data than the length */ /* slot indicates. */ - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length) + 1; nwords = CEILING(NWORDS(length, 4) + 2, 2); @@ -1330,8 +1205,10 @@ size_string(lispobj *where) static int scav_vector(lispobj *where, lispobj object) { - if (HeaderValue(object) == subtype_VectorValidHashing) - *where = (subtype_VectorMustRehash<length); nwords = CEILING(length + 2, 2); @@ -1386,9 +1263,9 @@ trans_vector_bit(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(NWORDS(length, 32) + 2, 2); @@ -1428,9 +1305,9 @@ trans_vector_unsigned_byte_2(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(NWORDS(length, 16) + 2, 2); @@ -1470,9 +1347,9 @@ trans_vector_unsigned_byte_4(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(NWORDS(length, 8) + 2, 2); @@ -1512,9 +1389,9 @@ trans_vector_unsigned_byte_8(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(NWORDS(length, 4) + 2, 2); @@ -1554,9 +1431,9 @@ trans_vector_unsigned_byte_16(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(NWORDS(length, 2) + 2, 2); @@ -1596,9 +1473,9 @@ trans_vector_unsigned_byte_32(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(length + 2, 2); @@ -1638,9 +1515,9 @@ trans_vector_single_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(length + 2, 2); @@ -1680,9 +1557,9 @@ trans_vector_double_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(length * 2 + 2, 2); @@ -1703,7 +1580,7 @@ size_vector_double_float(lispobj *where) } -#ifdef type_SimpleArrayLongFloat +#ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG static int scav_vector_long_float(lispobj *where, lispobj object) { @@ -1725,9 +1602,9 @@ trans_vector_long_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); #ifdef sparc nwords = CEILING(length * 4 + 2, 2); @@ -1753,7 +1630,7 @@ size_vector_long_float(lispobj *where) #endif -#ifdef type_SimpleArrayComplexSingleFloat +#ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG static int scav_vector_complex_single_float(lispobj *where, lispobj object) { @@ -1773,9 +1650,9 @@ trans_vector_complex_single_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(length * 2 + 2, 2); @@ -1796,7 +1673,7 @@ size_vector_complex_single_float(lispobj *where) } #endif -#ifdef type_SimpleArrayComplexDoubleFloat +#ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG static int scav_vector_complex_double_float(lispobj *where, lispobj object) { @@ -1816,9 +1693,9 @@ trans_vector_complex_double_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); nwords = CEILING(length * 4 + 2, 2); @@ -1839,7 +1716,7 @@ size_vector_complex_double_float(lispobj *where) } #endif -#ifdef type_SimpleArrayComplexLongFloat +#ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG static int scav_vector_complex_long_float(lispobj *where, lispobj object) { @@ -1861,9 +1738,9 @@ trans_vector_complex_long_float(lispobj object) struct vector *vector; int length, nwords; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); - vector = (struct vector *) PTR(object); + vector = (struct vector *) native_pointer(object); length = fixnum_value(vector->length); #ifdef sparc nwords = CEILING(length * 8 + 2, 2); @@ -1889,7 +1766,7 @@ size_vector_complex_long_float(lispobj *where) #endif -/* Weak Pointers */ +/* weak pointers */ #define WEAK_POINTER_NWORDS \ CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2) @@ -1910,7 +1787,7 @@ trans_weak_pointer(lispobj object) lispobj copy; struct weak_pointer *wp; - gc_assert(Pointerp(object)); + gc_assert(is_lisp_pointer(object)); #if defined(DEBUG_WEAK) printf("Transporting weak pointer from 0x%08x\n", object); @@ -1920,7 +1797,7 @@ trans_weak_pointer(lispobj object) /* been transported so they can be fixed up in a post-GC pass. */ copy = copy_object(object, WEAK_POINTER_NWORDS); - wp = (struct weak_pointer *) PTR(copy); + wp = (struct weak_pointer *) native_pointer(copy); /* Push the weak pointer onto the list of weak pointers. */ @@ -1952,7 +1829,7 @@ void scan_weak_pointers(void) printf("Value: 0x%08x\n", (unsigned int) value); #endif - if (!(Pointerp(value) && from_space_p(value))) + if (!(is_lisp_pointer(value) && from_space_p(value))) continue; /* Now, we need to check if the object has been */ @@ -1960,14 +1837,14 @@ void scan_weak_pointers(void) /* still good and needs to be updated. Otherwise, the */ /* weak pointer needs to be nil'ed out. */ - first_pointer = (lispobj *) PTR(value); + first_pointer = (lispobj *) native_pointer(value); first = *first_pointer; #if defined(DEBUG_WEAK) printf("First: 0x%08x\n", (unsigned long) first); #endif - if (Pointerp(first) && new_space_p(first)) + if (is_lisp_pointer(first) && new_space_p(first)) wp->value = first; else { wp->value = NIL; @@ -1978,7 +1855,7 @@ void scan_weak_pointers(void) -/* Initialization */ +/* initialization */ static int scav_lose(lispobj *where, lispobj object) @@ -2008,188 +1885,213 @@ size_lose(lispobj *where) return 1; } -void gc_init(void) +/* KLUDGE: SBCL already has two GC implementations, and if someday the + * precise generational GC is revived, it might have three. It would + * be nice to share the scavtab[] data set up here, and perhaps other + * things too, between all of them, rather than trying to maintain + * multiple copies. -- WHN 2001-05-09 */ +void +gc_init(void) { int i; - /* Scavenge Table */ + /* scavenge table */ for (i = 0; i < 256; i++) scavtab[i] = scav_lose; /* scavtab[i] = scav_immediate; */ for (i = 0; i < 32; i++) { - scavtab[type_EvenFixnum|(i<<3)] = scav_immediate; - scavtab[type_FunctionPointer|(i<<3)] = scav_function_pointer; - /* OtherImmediate0 */ - scavtab[type_ListPointer|(i<<3)] = scav_list_pointer; - scavtab[type_OddFixnum|(i<<3)] = scav_immediate; - scavtab[type_InstancePointer|(i<<3)] = scav_instance_pointer; - /* OtherImmediate1 */ - scavtab[type_OtherPointer|(i<<3)] = scav_other_pointer; + scavtab[EVEN_FIXNUM_LOWTAG|(i<<3)] = scav_immediate; + scavtab[FUN_POINTER_LOWTAG|(i<<3)] = scav_fun_pointer; + /* skipping OTHER_IMMEDIATE_0_LOWTAG */ + scavtab[LIST_POINTER_LOWTAG|(i<<3)] = scav_list_pointer; + scavtab[ODD_FIXNUM_LOWTAG|(i<<3)] = scav_immediate; + scavtab[INSTANCE_POINTER_LOWTAG|(i<<3)] =scav_instance_pointer; + /* skipping OTHER_IMMEDIATE_1_LOWTAG */ + scavtab[OTHER_POINTER_LOWTAG|(i<<3)] = scav_other_pointer; } - scavtab[type_Bignum] = scav_unboxed; - scavtab[type_Ratio] = scav_boxed; - scavtab[type_SingleFloat] = scav_unboxed; - scavtab[type_DoubleFloat] = scav_unboxed; -#ifdef type_LongFloat - scavtab[type_LongFloat] = scav_unboxed; -#endif - scavtab[type_Complex] = scav_boxed; -#ifdef type_ComplexSingleFloat - scavtab[type_ComplexSingleFloat] = scav_unboxed; -#endif -#ifdef type_ComplexDoubleFloat - scavtab[type_ComplexDoubleFloat] = scav_unboxed; -#endif -#ifdef type_ComplexLongFloat - scavtab[type_ComplexLongFloat] = scav_unboxed; -#endif - scavtab[type_SimpleArray] = scav_boxed; - scavtab[type_SimpleString] = scav_string; - scavtab[type_SimpleBitVector] = scav_vector_bit; - scavtab[type_SimpleVector] = scav_vector; - scavtab[type_SimpleArrayUnsignedByte2] = scav_vector_unsigned_byte_2; - scavtab[type_SimpleArrayUnsignedByte4] = scav_vector_unsigned_byte_4; - scavtab[type_SimpleArrayUnsignedByte8] = scav_vector_unsigned_byte_8; - scavtab[type_SimpleArrayUnsignedByte16] = scav_vector_unsigned_byte_16; - scavtab[type_SimpleArrayUnsignedByte32] = scav_vector_unsigned_byte_32; -#ifdef type_SimpleArraySignedByte8 - scavtab[type_SimpleArraySignedByte8] = scav_vector_unsigned_byte_8; -#endif -#ifdef type_SimpleArraySignedByte16 - scavtab[type_SimpleArraySignedByte16] = scav_vector_unsigned_byte_16; -#endif -#ifdef type_SimpleArraySignedByte30 - scavtab[type_SimpleArraySignedByte30] = scav_vector_unsigned_byte_32; -#endif -#ifdef type_SimpleArraySignedByte32 - scavtab[type_SimpleArraySignedByte32] = scav_vector_unsigned_byte_32; -#endif - scavtab[type_SimpleArraySingleFloat] = scav_vector_single_float; - scavtab[type_SimpleArrayDoubleFloat] = scav_vector_double_float; -#ifdef type_SimpleArrayLongFloat - scavtab[type_SimpleArrayLongFloat] = scav_vector_long_float; -#endif -#ifdef type_SimpleArrayComplexSingleFloat - scavtab[type_SimpleArrayComplexSingleFloat] = scav_vector_complex_single_float; -#endif -#ifdef type_SimpleArrayComplexDoubleFloat - scavtab[type_SimpleArrayComplexDoubleFloat] = scav_vector_complex_double_float; -#endif -#ifdef type_SimpleArrayComplexLongFloat - scavtab[type_SimpleArrayComplexLongFloat] = scav_vector_complex_long_float; -#endif - scavtab[type_ComplexString] = scav_boxed; - scavtab[type_ComplexBitVector] = scav_boxed; - scavtab[type_ComplexVector] = scav_boxed; - scavtab[type_ComplexArray] = scav_boxed; - scavtab[type_CodeHeader] = scav_code_header; - scavtab[type_FunctionHeader] = scav_function_header; - scavtab[type_ClosureFunctionHeader] = scav_function_header; - scavtab[type_ReturnPcHeader] = scav_return_pc_header; -#ifdef i386 - scavtab[type_ClosureHeader] = scav_closure_header; - scavtab[type_FuncallableInstanceHeader] = scav_closure_header; - scavtab[type_ByteCodeFunction] = scav_closure_header; - scavtab[type_ByteCodeClosure] = scav_closure_header; - /* scavtab[type_DylanFunctionHeader] = scav_closure_header; */ + scavtab[BIGNUM_WIDETAG] = scav_unboxed; + scavtab[RATIO_WIDETAG] = scav_boxed; + scavtab[SINGLE_FLOAT_WIDETAG] = scav_unboxed; + scavtab[DOUBLE_FLOAT_WIDETAG] = scav_unboxed; +#ifdef LONG_FLOAT_WIDETAG + scavtab[LONG_FLOAT_WIDETAG] = scav_unboxed; +#endif + scavtab[COMPLEX_WIDETAG] = scav_boxed; +#ifdef COMPLEX_SINGLE_FLOAT_WIDETAG + scavtab[COMPLEX_SINGLE_FLOAT_WIDETAG] = scav_unboxed; +#endif +#ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG + scavtab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = scav_unboxed; +#endif +#ifdef COMPLEX_LONG_FLOAT_WIDETAG + scavtab[COMPLEX_LONG_FLOAT_WIDETAG] = scav_unboxed; +#endif + scavtab[SIMPLE_ARRAY_WIDETAG] = scav_boxed; + scavtab[SIMPLE_STRING_WIDETAG] = scav_string; + scavtab[SIMPLE_BIT_VECTOR_WIDETAG] = scav_vector_bit; + scavtab[SIMPLE_VECTOR_WIDETAG] = scav_vector; + scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] = + scav_vector_unsigned_byte_2; + scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] = + scav_vector_unsigned_byte_4; + scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] = + scav_vector_unsigned_byte_8; + scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] = + scav_vector_unsigned_byte_16; + scavtab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] = + scav_vector_unsigned_byte_32; +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG + scavtab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = + scav_vector_unsigned_byte_8; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG + scavtab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] = + scav_vector_unsigned_byte_16; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG + scavtab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] = + scav_vector_unsigned_byte_32; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG + scavtab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] = + scav_vector_unsigned_byte_32; +#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 + scavtab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = scav_vector_long_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG + scavtab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] = + scav_vector_complex_single_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG + scavtab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] = + scav_vector_complex_double_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG + scavtab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] = + scav_vector_complex_long_float; +#endif + scavtab[COMPLEX_STRING_WIDETAG] = scav_boxed; + scavtab[COMPLEX_BIT_VECTOR_WIDETAG] = scav_boxed; + scavtab[COMPLEX_VECTOR_WIDETAG] = scav_boxed; + scavtab[COMPLEX_ARRAY_WIDETAG] = scav_boxed; + scavtab[CODE_HEADER_WIDETAG] = scav_code_header; + scavtab[SIMPLE_FUN_HEADER_WIDETAG] = scav_fun_header; + scavtab[CLOSURE_FUN_HEADER_WIDETAG] = scav_fun_header; + scavtab[RETURN_PC_HEADER_WIDETAG] = scav_return_pc_header; +#ifdef __i386__ + scavtab[CLOSURE_HEADER_WIDETAG] = scav_closure_header; + scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_closure_header; #else - scavtab[type_ClosureHeader] = scav_boxed; - scavtab[type_FuncallableInstanceHeader] = scav_boxed; - scavtab[type_ByteCodeFunction] = scav_boxed; - scavtab[type_ByteCodeClosure] = scav_boxed; - /* scavtab[type_DylanFunctionHeader] = scav_boxed; */ -#endif - scavtab[type_ValueCellHeader] = scav_boxed; - scavtab[type_SymbolHeader] = scav_boxed; - scavtab[type_BaseChar] = scav_immediate; - scavtab[type_Sap] = scav_unboxed; - scavtab[type_UnboundMarker] = scav_immediate; - scavtab[type_WeakPointer] = scav_weak_pointer; - scavtab[type_InstanceHeader] = scav_boxed; + scavtab[CLOSURE_HEADER_WIDETAG] = scav_boxed; + scavtab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = scav_boxed; +#endif + scavtab[VALUE_CELL_HEADER_WIDETAG] = scav_boxed; + scavtab[SYMBOL_HEADER_WIDETAG] = scav_boxed; + scavtab[BASE_CHAR_WIDETAG] = scav_immediate; + scavtab[SAP_WIDETAG] = scav_unboxed; + scavtab[UNBOUND_MARKER_WIDETAG] = scav_immediate; + scavtab[WEAK_POINTER_WIDETAG] = scav_weak_pointer; + scavtab[INSTANCE_HEADER_WIDETAG] = scav_boxed; #ifndef sparc - scavtab[type_Fdefn] = scav_fdefn; + scavtab[FDEFN_WIDETAG] = scav_fdefn; #else - scavtab[type_Fdefn] = scav_boxed; + scavtab[FDEFN_WIDETAG] = scav_boxed; #endif /* Transport Other Table */ for (i = 0; i < 256; i++) transother[i] = trans_lose; - transother[type_Bignum] = trans_unboxed; - transother[type_Ratio] = trans_boxed; - transother[type_SingleFloat] = trans_unboxed; - transother[type_DoubleFloat] = trans_unboxed; -#ifdef type_LongFloat - transother[type_LongFloat] = trans_unboxed; -#endif - transother[type_Complex] = trans_boxed; -#ifdef type_ComplexSingleFloat - transother[type_ComplexSingleFloat] = trans_unboxed; -#endif -#ifdef type_ComplexDoubleFloat - transother[type_ComplexDoubleFloat] = trans_unboxed; -#endif -#ifdef type_ComplexLongFloat - transother[type_ComplexLongFloat] = trans_unboxed; -#endif - transother[type_SimpleArray] = trans_boxed; - transother[type_SimpleString] = trans_string; - transother[type_SimpleBitVector] = trans_vector_bit; - transother[type_SimpleVector] = trans_vector; - transother[type_SimpleArrayUnsignedByte2] = trans_vector_unsigned_byte_2; - transother[type_SimpleArrayUnsignedByte4] = trans_vector_unsigned_byte_4; - transother[type_SimpleArrayUnsignedByte8] = trans_vector_unsigned_byte_8; - transother[type_SimpleArrayUnsignedByte16] = trans_vector_unsigned_byte_16; - transother[type_SimpleArrayUnsignedByte32] = trans_vector_unsigned_byte_32; -#ifdef type_SimpleArraySignedByte8 - transother[type_SimpleArraySignedByte8] = trans_vector_unsigned_byte_8; -#endif -#ifdef type_SimpleArraySignedByte16 - transother[type_SimpleArraySignedByte16] = trans_vector_unsigned_byte_16; -#endif -#ifdef type_SimpleArraySignedByte30 - transother[type_SimpleArraySignedByte30] = trans_vector_unsigned_byte_32; -#endif -#ifdef type_SimpleArraySignedByte32 - transother[type_SimpleArraySignedByte32] = trans_vector_unsigned_byte_32; -#endif - transother[type_SimpleArraySingleFloat] = trans_vector_single_float; - transother[type_SimpleArrayDoubleFloat] = trans_vector_double_float; -#ifdef type_SimpleArrayLongFloat - transother[type_SimpleArrayLongFloat] = trans_vector_long_float; -#endif -#ifdef type_SimpleArrayComplexSingleFloat - transother[type_SimpleArrayComplexSingleFloat] = trans_vector_complex_single_float; -#endif -#ifdef type_SimpleArrayComplexDoubleFloat - transother[type_SimpleArrayComplexDoubleFloat] = trans_vector_complex_double_float; -#endif -#ifdef type_SimpleArrayComplexLongFloat - transother[type_SimpleArrayComplexLongFloat] = trans_vector_complex_long_float; -#endif - transother[type_ComplexString] = trans_boxed; - transother[type_ComplexBitVector] = trans_boxed; - transother[type_ComplexVector] = trans_boxed; - transother[type_ComplexArray] = trans_boxed; - transother[type_CodeHeader] = trans_code_header; - transother[type_FunctionHeader] = trans_function_header; - transother[type_ClosureFunctionHeader] = trans_function_header; - transother[type_ReturnPcHeader] = trans_return_pc_header; - transother[type_ClosureHeader] = trans_boxed; - transother[type_FuncallableInstanceHeader] = trans_boxed; - transother[type_ByteCodeFunction] = trans_boxed; - transother[type_ByteCodeClosure] = trans_boxed; - transother[type_ValueCellHeader] = trans_boxed; - transother[type_SymbolHeader] = trans_boxed; - transother[type_BaseChar] = trans_immediate; - transother[type_Sap] = trans_unboxed; - transother[type_UnboundMarker] = trans_immediate; - transother[type_WeakPointer] = trans_weak_pointer; - transother[type_InstanceHeader] = trans_boxed; - transother[type_Fdefn] = trans_boxed; + transother[BIGNUM_WIDETAG] = trans_unboxed; + transother[RATIO_WIDETAG] = trans_boxed; + transother[SINGLE_FLOAT_WIDETAG] = trans_unboxed; + transother[DOUBLE_FLOAT_WIDETAG] = trans_unboxed; +#ifdef LONG_FLOAT_WIDETAG + transother[LONG_FLOAT_WIDETAG] = trans_unboxed; +#endif + transother[COMPLEX_WIDETAG] = trans_boxed; +#ifdef COMPLEX_SINGLE_FLOAT_WIDETAG + transother[COMPLEX_SINGLE_FLOAT_WIDETAG] = trans_unboxed; +#endif +#ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG + transother[COMPLEX_DOUBLE_FLOAT_WIDETAG] = trans_unboxed; +#endif +#ifdef COMPLEX_LONG_FLOAT_WIDETAG + transother[COMPLEX_LONG_FLOAT_WIDETAG] = trans_unboxed; +#endif + transother[SIMPLE_ARRAY_WIDETAG] = trans_boxed; + transother[SIMPLE_STRING_WIDETAG] = trans_string; + transother[SIMPLE_BIT_VECTOR_WIDETAG] = trans_vector_bit; + transother[SIMPLE_VECTOR_WIDETAG] = trans_vector; + transother[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] = + trans_vector_unsigned_byte_2; + transother[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] = + trans_vector_unsigned_byte_4; + transother[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] = + trans_vector_unsigned_byte_8; + transother[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] = + trans_vector_unsigned_byte_16; + transother[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] = + trans_vector_unsigned_byte_32; +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG + transother[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = + trans_vector_unsigned_byte_8; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG + transother[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] = + trans_vector_unsigned_byte_16; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG + transother[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] = + trans_vector_unsigned_byte_32; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG + transother[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] = + trans_vector_unsigned_byte_32; +#endif + transother[SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG] = + trans_vector_single_float; + transother[SIMPLE_ARRAY_DOUBLE_FLOAT_WIDETAG] = + trans_vector_double_float; +#ifdef SIMPLE_ARRAY_LONG_FLOAT_WIDETAG + transother[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = + trans_vector_long_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG + transother[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] = + trans_vector_complex_single_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG + transother[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] = + trans_vector_complex_double_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG + transother[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] = + trans_vector_complex_long_float; +#endif + transother[COMPLEX_STRING_WIDETAG] = trans_boxed; + transother[COMPLEX_BIT_VECTOR_WIDETAG] = trans_boxed; + transother[COMPLEX_VECTOR_WIDETAG] = trans_boxed; + transother[COMPLEX_ARRAY_WIDETAG] = trans_boxed; + transother[CODE_HEADER_WIDETAG] = trans_code_header; + transother[SIMPLE_FUN_HEADER_WIDETAG] = trans_fun_header; + transother[CLOSURE_FUN_HEADER_WIDETAG] = trans_fun_header; + transother[RETURN_PC_HEADER_WIDETAG] = trans_return_pc_header; + transother[CLOSURE_HEADER_WIDETAG] = trans_boxed; + transother[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = trans_boxed; + transother[VALUE_CELL_HEADER_WIDETAG] = trans_boxed; + transother[SYMBOL_HEADER_WIDETAG] = trans_boxed; + transother[BASE_CHAR_WIDETAG] = trans_immediate; + transother[SAP_WIDETAG] = trans_unboxed; + transother[UNBOUND_MARKER_WIDETAG] = trans_immediate; + transother[WEAK_POINTER_WIDETAG] = trans_weak_pointer; + transother[INSTANCE_HEADER_WIDETAG] = trans_boxed; + transother[FDEFN_WIDETAG] = trans_boxed; /* Size table */ @@ -2197,96 +2099,104 @@ void gc_init(void) sizetab[i] = size_lose; for (i = 0; i < 32; i++) { - sizetab[type_EvenFixnum|(i<<3)] = size_immediate; - sizetab[type_FunctionPointer|(i<<3)] = size_pointer; - /* OtherImmediate0 */ - sizetab[type_ListPointer|(i<<3)] = size_pointer; - sizetab[type_OddFixnum|(i<<3)] = size_immediate; - sizetab[type_InstancePointer|(i<<3)] = size_pointer; - /* OtherImmediate1 */ - sizetab[type_OtherPointer|(i<<3)] = size_pointer; + sizetab[EVEN_FIXNUM_LOWTAG|(i<<3)] = size_immediate; + sizetab[FUN_POINTER_LOWTAG|(i<<3)] = 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; + /* skipping OTHER_IMMEDIATE_1_LOWTAG */ + sizetab[OTHER_POINTER_LOWTAG|(i<<3)] = size_pointer; } - sizetab[type_Bignum] = size_unboxed; - sizetab[type_Ratio] = size_boxed; - sizetab[type_SingleFloat] = size_unboxed; - sizetab[type_DoubleFloat] = size_unboxed; -#ifdef type_LongFloat - sizetab[type_LongFloat] = size_unboxed; -#endif - sizetab[type_Complex] = size_boxed; -#ifdef type_ComplexSingleFloat - sizetab[type_ComplexSingleFloat] = size_unboxed; -#endif -#ifdef type_ComplexDoubleFloat - sizetab[type_ComplexDoubleFloat] = size_unboxed; -#endif -#ifdef type_ComplexLongFloat - sizetab[type_ComplexLongFloat] = size_unboxed; -#endif - sizetab[type_SimpleArray] = size_boxed; - sizetab[type_SimpleString] = size_string; - sizetab[type_SimpleBitVector] = size_vector_bit; - sizetab[type_SimpleVector] = size_vector; - sizetab[type_SimpleArrayUnsignedByte2] = size_vector_unsigned_byte_2; - sizetab[type_SimpleArrayUnsignedByte4] = size_vector_unsigned_byte_4; - sizetab[type_SimpleArrayUnsignedByte8] = size_vector_unsigned_byte_8; - sizetab[type_SimpleArrayUnsignedByte16] = size_vector_unsigned_byte_16; - sizetab[type_SimpleArrayUnsignedByte32] = size_vector_unsigned_byte_32; -#ifdef type_SimpleArraySignedByte8 - sizetab[type_SimpleArraySignedByte8] = size_vector_unsigned_byte_8; -#endif -#ifdef type_SimpleArraySignedByte16 - sizetab[type_SimpleArraySignedByte16] = size_vector_unsigned_byte_16; -#endif -#ifdef type_SimpleArraySignedByte30 - sizetab[type_SimpleArraySignedByte30] = size_vector_unsigned_byte_32; -#endif -#ifdef type_SimpleArraySignedByte32 - sizetab[type_SimpleArraySignedByte32] = size_vector_unsigned_byte_32; -#endif - sizetab[type_SimpleArraySingleFloat] = size_vector_single_float; - sizetab[type_SimpleArrayDoubleFloat] = size_vector_double_float; -#ifdef type_SimpleArrayLongFloat - sizetab[type_SimpleArrayLongFloat] = size_vector_long_float; -#endif -#ifdef type_SimpleArrayComplexSingleFloat - sizetab[type_SimpleArrayComplexSingleFloat] = size_vector_complex_single_float; -#endif -#ifdef type_SimpleArrayComplexDoubleFloat - sizetab[type_SimpleArrayComplexDoubleFloat] = size_vector_complex_double_float; -#endif -#ifdef type_SimpleArrayComplexLongFloat - sizetab[type_SimpleArrayComplexLongFloat] = size_vector_complex_long_float; -#endif - sizetab[type_ComplexString] = size_boxed; - sizetab[type_ComplexBitVector] = size_boxed; - sizetab[type_ComplexVector] = size_boxed; - sizetab[type_ComplexArray] = size_boxed; - sizetab[type_CodeHeader] = size_code_header; + sizetab[BIGNUM_WIDETAG] = size_unboxed; + sizetab[RATIO_WIDETAG] = size_boxed; + sizetab[SINGLE_FLOAT_WIDETAG] = size_unboxed; + sizetab[DOUBLE_FLOAT_WIDETAG] = size_unboxed; +#ifdef LONG_FLOAT_WIDETAG + sizetab[LONG_FLOAT_WIDETAG] = size_unboxed; +#endif + sizetab[COMPLEX_WIDETAG] = size_boxed; +#ifdef COMPLEX_SINGLE_FLOAT_WIDETAG + sizetab[COMPLEX_SINGLE_FLOAT_WIDETAG] = size_unboxed; +#endif +#ifdef COMPLEX_DOUBLE_FLOAT_WIDETAG + sizetab[COMPLEX_DOUBLE_FLOAT_WIDETAG] = size_unboxed; +#endif +#ifdef COMPLEX_LONG_FLOAT_WIDETAG + sizetab[COMPLEX_LONG_FLOAT_WIDETAG] = size_unboxed; +#endif + sizetab[SIMPLE_ARRAY_WIDETAG] = size_boxed; + sizetab[SIMPLE_STRING_WIDETAG] = size_string; + sizetab[SIMPLE_BIT_VECTOR_WIDETAG] = size_vector_bit; + sizetab[SIMPLE_VECTOR_WIDETAG] = size_vector; + sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG] = + size_vector_unsigned_byte_2; + sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG] = + size_vector_unsigned_byte_4; + sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG] = + size_vector_unsigned_byte_8; + sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG] = + size_vector_unsigned_byte_16; + sizetab[SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG] = + size_vector_unsigned_byte_32; +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG + sizetab[SIMPLE_ARRAY_SIGNED_BYTE_8_WIDETAG] = + size_vector_unsigned_byte_8; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG + sizetab[SIMPLE_ARRAY_SIGNED_BYTE_16_WIDETAG] = + size_vector_unsigned_byte_16; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG + sizetab[SIMPLE_ARRAY_SIGNED_BYTE_30_WIDETAG] = + size_vector_unsigned_byte_32; +#endif +#ifdef SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG + sizetab[SIMPLE_ARRAY_SIGNED_BYTE_32_WIDETAG] = + size_vector_unsigned_byte_32; +#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 + sizetab[SIMPLE_ARRAY_LONG_FLOAT_WIDETAG] = size_vector_long_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG + sizetab[SIMPLE_ARRAY_COMPLEX_SINGLE_FLOAT_WIDETAG] = + size_vector_complex_single_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG + sizetab[SIMPLE_ARRAY_COMPLEX_DOUBLE_FLOAT_WIDETAG] = + size_vector_complex_double_float; +#endif +#ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG + sizetab[SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG] = + size_vector_complex_long_float; +#endif + sizetab[COMPLEX_STRING_WIDETAG] = size_boxed; + sizetab[COMPLEX_BIT_VECTOR_WIDETAG] = size_boxed; + sizetab[COMPLEX_VECTOR_WIDETAG] = size_boxed; + sizetab[COMPLEX_ARRAY_WIDETAG] = size_boxed; + sizetab[CODE_HEADER_WIDETAG] = size_code_header; #if 0 /* Shouldn't see these so just lose if it happens */ - sizetab[type_FunctionHeader] = size_function_header; - sizetab[type_ClosureFunctionHeader] = size_function_header; - sizetab[type_ReturnPcHeader] = size_return_pc_header; -#endif - sizetab[type_ClosureHeader] = size_boxed; - sizetab[type_FuncallableInstanceHeader] = size_boxed; - sizetab[type_ValueCellHeader] = size_boxed; - sizetab[type_SymbolHeader] = size_boxed; - sizetab[type_BaseChar] = size_immediate; - sizetab[type_Sap] = size_unboxed; - sizetab[type_UnboundMarker] = size_immediate; - sizetab[type_WeakPointer] = size_weak_pointer; - sizetab[type_InstanceHeader] = size_boxed; - sizetab[type_Fdefn] = size_boxed; + sizetab[SIMPLE_FUN_HEADER_WIDETAG] = size_function_header; + sizetab[CLOSURE_FUN_HEADER_WIDETAG] = size_function_header; + sizetab[RETURN_PC_HEADER_WIDETAG] = size_return_pc_header; +#endif + sizetab[CLOSURE_HEADER_WIDETAG] = size_boxed; + sizetab[FUNCALLABLE_INSTANCE_HEADER_WIDETAG] = size_boxed; + sizetab[VALUE_CELL_HEADER_WIDETAG] = size_boxed; + sizetab[SYMBOL_HEADER_WIDETAG] = size_boxed; + sizetab[BASE_CHAR_WIDETAG] = size_immediate; + sizetab[SAP_WIDETAG] = size_unboxed; + sizetab[UNBOUND_MARKER_WIDETAG] = size_immediate; + sizetab[WEAK_POINTER_WIDETAG] = size_weak_pointer; + sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed; + sizetab[FDEFN_WIDETAG] = size_boxed; } - - -/* Noise to manipulate the gc trigger stuff. */ - -#ifndef ibmrt +/* noise to manipulate the gc trigger stuff */ void set_auto_gc_trigger(os_vm_size_t dynamic_usage) { @@ -2340,5 +2250,3 @@ void clear_auto_gc_trigger(void) current_auto_gc_trigger = NULL; } } - -#endif