X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fcheneygc.c;h=4948da85d0e69a469da9deb6e0e42bec2bad62de;hb=dc71db379ab4162a45c393a2e828f619dae9fa32;hp=63383f5e8d26a724bd45e3c631b498224a62dd33;hpb=1cfc4ee568b84b2dfa7db391b8a7c269f1bff1be;p=sbcl.git diff --git a/src/runtime/cheneygc.c b/src/runtime/cheneygc.c index 63383f5..4948da8 100644 --- a/src/runtime/cheneygc.c +++ b/src/runtime/cheneygc.c @@ -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/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); } @@ -237,7 +237,10 @@ collect_garbage(unsigned ignore) printf("Flipping spaces ...\n"); #endif - os_zero((os_vm_address_t) current_dynamic_space, + /* Maybe FIXME: it's possible that we could significantly reduce + * RSS by zeroing the from_space or madvise(MADV_DONTNEED) or + * similar os-dependent tricks here */ + os_zero((os_vm_address_t) from_space, (os_vm_size_t) DYNAMIC_SPACE_SIZE); current_dynamic_space = new_space; @@ -248,6 +251,8 @@ collect_garbage(unsigned ignore) #endif size_retained = (new_space_free_pointer - new_space) * sizeof(lispobj); + os_flush_icache((os_vm_address_t)new_space, size_retained); + /* Zero stack. */ #ifdef PRINTNOISE printf("Zeroing empty part of control stack ...\n"); @@ -280,10 +285,6 @@ collect_garbage(unsigned ignore) printf("%10.2f M bytes/sec collected.\n", gc_rate); #endif - /* os_flush_icache((os_vm_address_t) 0, sizeof(unsigned long)); */ - /* Maybe FIXME: it's possible that we could significantly reduce - * RSS by zeroing the from_space or madvise(MADV_DONTNEED) or - * similar os-dependent tricks here */ } @@ -419,8 +420,6 @@ void scavenge_interrupt_contexts(void) os_context_t *context; struct thread *th=arch_os_get_current_thread(); - struct interrupt_data *data= - th ? th->interrupt_data : global_interrupt_data; index = fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,0)); @@ -495,47 +494,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) { @@ -552,7 +513,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 */ @@ -569,9 +530,9 @@ search_read_only_space(void *pointer) lispobj* end = (lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } lispobj * @@ -581,9 +542,9 @@ search_static_space(void *pointer) lispobj* end = (lispobj*)SymbolValue(STATIC_SPACE_FREE_POINTER,0); if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } lispobj * @@ -593,9 +554,9 @@ search_dynamic_space(void *pointer) lispobj *end = (lispobj *) dynamic_space_free_pointer; if ((pointer < (void *)start) || (pointer >= (void *)end)) return NULL; - return (search_space(start, - (((lispobj *)pointer)+2)-start, - (lispobj *)pointer)); + return (gc_search_space(start, + (((lispobj *)pointer)+2)-start, + (lispobj *)pointer)); } /* initialization. if gc_init can be moved to after core load, we could @@ -637,16 +598,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"); }