X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Finterrupt.c;h=f191cd38db3b6f37112225411c2bb3925fa291f6;hb=df679ed627975948b1cee190f4d79c397588c43e;hp=c63083122f0460b913f0c784c7de8f0a5543d85a;hpb=e365f2f7a9c66d307b48fee70778f4eaa84bdcc0;p=sbcl.git diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index c630831..f191cd3 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -288,7 +288,7 @@ interrupt_handle_pending(os_context_t *context) { fake_foreign_function_call(context); } - funcall0(SymbolFunction(MAYBE_GC)); + funcall0(SymbolFunction(SUB_GC)); #ifndef __i386__ if (were_in_lisp) #endif @@ -562,26 +562,23 @@ boolean handle_control_stack_guard_triggered(os_context_t *context,void *addr) else return 0; } -#ifndef LISP_FEATURE_X86 +#ifndef LISP_FEATURE_GENCGC /* This function gets called from the SIGSEGV (for e.g. Linux or * OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check * whether the signal was due to treading on the mprotect()ed zone - * and if so, arrange for a GC to happen. */ +extern unsigned long bytes_consed_between_gcs; /* gc-common.c */ + boolean interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context) { os_context_t *context=(os_context_t *) void_context; + struct thread *th=arch_os_get_current_thread(); + struct interrupt_data *data= + th ? th->interrupt_data : global_interrupt_data; - if (!foreign_function_call_active -#ifndef LISP_FEATURE_GENCGC - /* nb: GENCGC on non-x86? I really don't think so. This - * happens every time */ - && gc_trigger_hit(signal, info, context) -#endif - ) { -#ifndef LISP_FEATURE_GENCGC + if(!foreign_function_call_active && gc_trigger_hit(signal, info, context)){ clear_auto_gc_trigger(); -#endif if (arch_pseudo_atomic_atomic(context)) { /* don't GC during an atomic operation. Instead, copy the @@ -589,11 +586,11 @@ interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context) * will detect pending_signal==0 and know to do a GC with the * signal context instead of calling a Lisp-level handler */ maybe_gc_pending = 1; - if (pending_signal == 0) { + if (data->pending_signal == 0) { /* FIXME: This copy-pending_mask-then-sigaddset_blockable * idiom occurs over and over. It should be factored out * into a function with a descriptive name. */ - memcpy(&pending_mask, + memcpy(&(data->pending_mask), os_context_sigmask_addr(context), sizeof(sigset_t)); sigaddset_blockable(os_context_sigmask_addr(context)); @@ -601,18 +598,13 @@ interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context) arch_set_pseudo_atomic_interrupted(context); } else { - lispobj *old_free_space=current_dynamic_space; fake_foreign_function_call(context); - funcall0(SymbolFunction(MAYBE_GC)); + /* SUB-GC may return without GCing if *GC-INHIBIT* is set, + * in which case we will be running with no gc trigger + * barrier thing for a while. But it shouldn't be long + * until the end of WITHOUT-GCING. */ + funcall0(SymbolFunction(SUB_GC)); undo_fake_foreign_function_call(context); - if(current_dynamic_space==old_free_space) - /* MAYBE-GC (as the name suggest) might not. If it - * doesn't, it won't reset the GC trigger either, so we - * have to do it ourselves. Put it near the end of - * dynamic space so we're not running into it continually - */ - set_auto_gc_trigger(DYNAMIC_SPACE_SIZE - -(u32)os_vm_page_size); } return 1; } else { @@ -671,7 +663,7 @@ undoably_install_low_level_interrupt_handler (int signal, if(signal==SIG_MEMORY_FAULT) sa.sa_flags|= SA_ONSTACK; #endif - sigaction(signal, &sa, NULL); + sigaction(signal, &sa, NULL); data->interrupt_low_level_handlers[signal] = (ARE_SAME_HANDLER(handler, SIG_DFL) ? 0 : handler); }