X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fcheneygc.c;h=fc003f53de757e5a8acd49fc7087bdb9f1c7d516;hb=d04b59670ab69405c4115ea3caac99fd62a4b7ab;hp=07e9d15126ee0079114b4309c36e879823fbb0c5;hpb=cf4cb9554515c59eddbde38d1cf236339c37f55f;p=sbcl.git diff --git a/src/runtime/cheneygc.c b/src/runtime/cheneygc.c index 07e9d15..fc003f5 100644 --- a/src/runtime/cheneygc.c +++ b/src/runtime/cheneygc.c @@ -72,7 +72,7 @@ tv_diff(struct timeval *x, struct timeval *y) static void zero_stack(void) { - u32 *ptr = (u32 *)current_control_stack_pointer; + lispobj *ptr = current_control_stack_pointer; search: do { if (*ptr) @@ -90,19 +90,19 @@ zero_stack(void) void * -gc_general_alloc(int bytes, int unboxed_p, int quick_p) { +gc_general_alloc(long bytes, int unboxed_p, int quick_p) { lispobj *new=new_space_free_pointer; - new_space_free_pointer+=(bytes/4); + new_space_free_pointer+=(bytes/N_WORD_BYTES); return new; } -lispobj copy_large_unboxed_object(lispobj object, int nwords) { +lispobj copy_large_unboxed_object(lispobj object, long nwords) { return copy_object(object,nwords); } -lispobj copy_unboxed_object(lispobj object, int nwords) { +lispobj copy_unboxed_object(lispobj object, long nwords) { return copy_object(object,nwords); } -lispobj copy_large_object(lispobj object, int nwords) { +lispobj copy_large_object(lispobj object, long nwords) { return copy_object(object,nwords); } @@ -273,15 +273,8 @@ collect_garbage(unsigned ignore) user_time = tv_diff(&stop_rusage.ru_utime, &start_rusage.ru_utime); system_time = tv_diff(&stop_rusage.ru_stime, &start_rusage.ru_stime); -#if 0 - printf("Statistics:\n"); - printf("%10.2f sec of real time\n", real_time); - printf("%10.2f sec of user time,\n", user_time); - printf("%10.2f sec of system time.\n", system_time); -#else printf("Statistics: %10.2fs real, %10.2fs user, %10.2fs system.\n", real_time, user_time, system_time); -#endif gc_rate = ((float) size_retained / (float) (1<<20)) / real_time; @@ -339,8 +332,9 @@ scavenge_interrupt_context(os_context_t *context) /* before we scavenge the context. */ #ifdef reg_LIP lip = *os_context_register_addr(context, reg_LIP); - /* 0x7FFFFFFF or 0x7FFFFFFFFFFFFFFF ? */ - lip_offset = 0x7FFFFFFF; + /* 0x7FFFFFFF on 32-bit platforms; + 0x7FFFFFFFFFFFFFFF on 64-bit platforms */ + lip_offset = (((unsigned long)1) << (N_WORD_BITS - 1)) - 1; lip_register_pair = -1; for (i = 0; i < (sizeof(boxed_registers) / sizeof(int)); i++) { unsigned long reg; @@ -501,47 +495,9 @@ print_garbage(lispobj *from_space, lispobj *from_space_free_pointer) } -/* code and code-related objects */ - -/* FIXME (1) this could probably be defined using something like - * sizeof(lispobj)*floor(sizeof(struct simple_fun)/sizeof(lispobj)) - * - FUN_POINTER_LOWTAG - * as I'm reasonably sure that simple_fun->code must always be the - * last slot in the object - - * FIXME (2) it also appears in purify.c, and it has a different value - * for SPARC users in that bit - */ - -#define FUN_RAW_ADDR_OFFSET (6*sizeof(lispobj) - FUN_POINTER_LOWTAG) - -/* 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 -scav_fdefn(lispobj *where, lispobj object) -{ - struct fdefn *fdefn; - - fdefn = (struct fdefn *)where; - - 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->fun)) + FUN_RAW_ADDR_OFFSET; - return sizeof(struct fdefn) / sizeof(lispobj); - } - else - return 1; -} -#endif - - - /* vector-like objects */ -static int +static long scav_vector(lispobj *where, lispobj object) { if (HeaderValue(object) == subtype_VectorValidHashing) { @@ -558,7 +514,7 @@ scav_vector(lispobj *where, lispobj object) #define WEAK_POINTER_NWORDS \ CEILING((sizeof(struct weak_pointer) / sizeof(lispobj)), 2) -static int +static long scav_weak_pointer(lispobj *where, lispobj object) { /* Do not let GC scavenge the value slot of the weak pointer */ @@ -643,16 +599,16 @@ void set_auto_gc_trigger(os_vm_size_t dynamic_usage) if (addr < (os_vm_address_t)dynamic_space_free_pointer) { fprintf(stderr, - "set_auto_gc_trigger: tried to set gc trigger too low! (%d < %p)\n", - (unsigned int)dynamic_usage, - (os_vm_address_t)dynamic_space_free_pointer - - (os_vm_address_t)current_dynamic_space); + "set_auto_gc_trigger: tried to set gc trigger too low! (%ld < 0x%08lx)\n", + (unsigned long)dynamic_usage, + (unsigned long)((os_vm_address_t)dynamic_space_free_pointer + - (os_vm_address_t)current_dynamic_space)); lose("lost"); } else if (length < 0) { fprintf(stderr, - "set_auto_gc_trigger: tried to set gc trigger too high! (%p)\n", - dynamic_usage); + "set_auto_gc_trigger: tried to set gc trigger too high! (0x%08lx)\n", + (unsigned long)dynamic_usage); lose("lost"); }