X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fcheneygc.c;h=25e9252db5953bdda53e2c706eb6a2f26399cf49;hb=3be1ab042ab74e008e40626cc6bd5190b27da033;hp=2fe298ce8957fa4a2229c11ee3d1fdcef8790bff;hpb=d6237a4b49e0a27e8abdd75f96eb467e4b8ab5d9;p=sbcl.git diff --git a/src/runtime/cheneygc.c b/src/runtime/cheneygc.c index 2fe298c..25e9252 100644 --- a/src/runtime/cheneygc.c +++ b/src/runtime/cheneygc.c @@ -47,9 +47,6 @@ lispobj *new_space; lispobj *new_space_free_pointer; static void scavenge_newspace(void); -static void scavenge_interrupt_contexts(void); - -extern unsigned long bytes_consed_between_gcs; /* collecting garbage */ @@ -109,7 +106,7 @@ lispobj copy_large_object(lispobj object, long nwords) { * last_generation argument. That's meaningless for us, since we're * not a generational GC. So we ignore it. */ void -collect_garbage(unsigned ignore) +collect_garbage(generation_index_t ignore) { #ifdef PRINTNOISE struct timeval start_tv, stop_tv; @@ -223,11 +220,16 @@ collect_garbage(unsigned ignore) /* Scan the weak pointers. */ #ifdef PRINTNOISE + printf("Scanning weak hash tables ...\n"); +#endif + scan_weak_hash_tables(); + + /* Scan the weak pointers. */ +#ifdef PRINTNOISE printf("Scanning weak pointers ...\n"); #endif scan_weak_pointers(); - /* Flip spaces. */ #ifdef PRINTNOISE printf("Flipping spaces ...\n"); @@ -237,7 +239,7 @@ collect_garbage(unsigned ignore) * 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); + (os_vm_size_t) dynamic_space_size); current_dynamic_space = new_space; dynamic_space_free_pointer = new_space_free_pointer; @@ -297,6 +299,7 @@ scavenge_newspace(void) here,new_space_free_pointer); */ next = new_space_free_pointer; scavenge(here, next - here); + scav_weak_hash_tables(); here = next; } /* printf("done with newspace\n"); */ @@ -490,20 +493,6 @@ print_garbage(lispobj *from_space, lispobj *from_space_free_pointer) } -/* vector-like objects */ - -static long -scav_vector(lispobj *where, lispobj object) -{ - if (HeaderValue(object) == subtype_VectorValidHashing) { - *where = - (subtype_VectorMustRehash<= (void *)current_auto_gc_trigger && + addr <((void *)current_dynamic_space + dynamic_space_size)); + } +} + +boolean +cheneygc_handle_wp_violation(os_context_t *context, void *addr) +{ + if(!foreign_function_call_active && gc_trigger_hit(addr)){ + struct thread *thread=arch_os_get_current_thread(); + clear_auto_gc_trigger(); + /* Don't flood the system with interrupts if the need to gc is + * already noted. This can happen for example when SUB-GC + * allocates or after a gc triggered in a WITHOUT-GCING. */ + if (SymbolValue(GC_PENDING,thread) == NIL) { + if (SymbolValue(GC_INHIBIT,thread) == NIL) { + if (arch_pseudo_atomic_atomic(context)) { + /* set things up so that GC happens when we finish + * the PA section */ + SetSymbolValue(GC_PENDING,T,thread); + arch_set_pseudo_atomic_interrupted(context); + } else { + maybe_gc(context); + } + } else { + SetSymbolValue(GC_PENDING,T,thread); + } + } + return 1; + } + return 0; +}