From c308db4d3f624cc1262c058cbecfcb610f53ccd5 Mon Sep 17 00:00:00 2001 From: dtc <dtc> Date: Tue, 25 Nov 1997 15:27:32 +0000 Subject: [PATCH] Ignore the foreign_function_call_active flag on the x86 port. It was of no utility and wasn't even being maintained thoroughly. Can now use pseudo atomic in C code. All interrupt contexts are saved, even those that occur when running foreign C code; this may be necessary for reliable stack parsing on some operating systems, e.g. Linux. When the pending interrupt from a GC trigger is processed by interrupt_handle_pending, any other accumulated pending interrupt is also processed even if *interrupts-enabled* is false, breaking the behaviour of the *interrupts-enabled* flag. The best way around this for the x86 port is to call maybe-gc directly from the allocation routines; remove the recently introduced function set_maybe_gc_pending which also had other problems. Note this problem will likely occur on the other ports. --- lisp/interrupt.c | 36 ++++++++++++++---------------------- lisp/interrupt.h | 6 +----- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/lisp/interrupt.c b/lisp/interrupt.c index 2e9c8f425..6b9d07585 100644 --- a/lisp/interrupt.c +++ b/lisp/interrupt.c @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.12 1997/11/22 14:38:21 dtc Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.13 1997/11/25 15:27:31 dtc Exp $ */ /* Interrupt handing magic. */ @@ -199,10 +199,14 @@ interrupt_handle_pending(struct sigcontext *context) if (maybe_gc_pending) { maybe_gc_pending = FALSE; +#ifndef i386 if (were_in_lisp) +#endif fake_foreign_function_call(context); funcall0(SymbolFunction(MAYBE_GC)); +#ifndef i386 if (were_in_lisp) +#endif undo_fake_foreign_function_call(context); } @@ -261,7 +265,9 @@ interrupt_handle_now(HANDLER_ARGS) SAVE_CONTEXT(); /**/ were_in_lisp = !foreign_function_call_active; +#ifndef i386 if (were_in_lisp) +#endif fake_foreign_function_call(context); if (handler.c==SIG_DFL) @@ -303,7 +309,9 @@ interrupt_handle_now(HANDLER_ARGS) #endif } +#ifndef i386 if (were_in_lisp) +#endif undo_fake_foreign_function_call(context); } @@ -331,8 +339,11 @@ maybe_now_maybe_later(HANDLER_ARGS) context->sc_mask |= BLOCKABLE; #endif SetSymbolValue(INTERRUPT_PENDING, T); - } else if ((!foreign_function_call_active) - && arch_pseudo_atomic_atomic(context)) { + } else if ( +#ifndef i386 + (!foreign_function_call_active) && +#endif + arch_pseudo_atomic_atomic(context)) { pending_signal = signal; pending_code = DEREFCODE(code); #ifdef POSIX_SIGS @@ -406,25 +417,6 @@ boolean interrupt_maybe_gc(HANDLER_ARGS) } #endif -#ifdef i386 -void set_maybe_gc_pending(void) -{ - maybe_gc_pending = TRUE; - if (pending_signal == 0) { - /* Block all blockable signals */ -#ifdef POSIX_SIGS - sigset_t block; - sigemptyset(&block); - FILLBLOCKSET(&block); - sigprocmask(SIG_BLOCK, &block, &pending_mask); -#else - pending_mask = sigblock(BLOCKABLE); -#endif - } - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1)); -} -#endif - /****************************************************************\ * Noise to install handlers. * \****************************************************************/ diff --git a/lisp/interrupt.h b/lisp/interrupt.h index 36ed04a39..e0d54d5cc 100644 --- a/lisp/interrupt.h +++ b/lisp/interrupt.h @@ -1,4 +1,4 @@ -/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.h,v 1.5 1997/11/19 02:41:55 dtc Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.h,v 1.6 1997/11/25 15:27:32 dtc Exp $ */ #if !defined(_INCLUDE_INTERRUPT_H_) #define _INCLUDE_INTERRUPT_H_ @@ -14,10 +14,6 @@ union interrupt_handler { void (*c)(HANDLER_ARGS); }; -#ifdef i386 -extern void set_maybe_gc_pending(void); -#endif - extern void interrupt_init(void); extern void fake_foreign_function_call(struct sigcontext *context); extern void undo_fake_foreign_function_call(struct sigcontext *context); -- GitLab