1.0.5.32: partial fix for DISASSEMBLE bug reported by Peter Graves
[sbcl.git] / src / runtime / interrupt.c
index 9ee4193..86b7413 100644 (file)
@@ -136,27 +136,6 @@ check_blockables_blocked_or_lose(void)
 }
 
 void
-check_gc_signals_unblocked_or_lose(void)
-{
-#ifdef LISP_FEATURE_SB_THREAD
-# if !defined(LISP_FEATURE_WIN32)
-    /* Get the current sigmask, by blocking the empty set. */
-    sigset_t empty,current;
-    sigemptyset(&empty);
-    thread_sigmask(SIG_BLOCK, &empty, &current);
-    if (sigismember(&current, SIG_STOP_FOR_GC))
-        lose("SIG_STOP_FOR_GC blocked in thread %p at a bad place\n",
-             arch_os_get_current_thread());
-#  if defined(SIG_RESUME_FROM_GC)
-    if (sigismember(&current, SIG_RESUME_FROM_GC))
-        lose("SIG_RESUME_FROM_GC blocked in thread %p at a bad place\n",
-             arch_os_get_current_thread());
-#  endif
-# endif
-#endif
-}
-
-void
 unblock_gc_signals(void)
 {
 #ifdef LISP_FEATURE_SB_THREAD
@@ -406,14 +385,19 @@ interrupt_internal_error(os_context_t *context, boolean continuable)
 void
 interrupt_handle_pending(os_context_t *context)
 {
-#ifdef LISP_FEATURE_WIN32
-    /* Actually this part looks almost good to go for
-     * Windows too, but currently we never save anything
-     * on Windows, so ending up here would be pretty bad. */
-    lose("Pending interrupts unimplemented on Windows.");
-#else
+    /* There are three ways we can get here.  First, if an interrupt
+     * occurs within pseudo-atomic, it will be deferred, and we'll
+     * trap to here at the end of the pseudo-atomic block.  Second, if
+     * the GC (in alloc()) decides that a GC is required, it will set
+     * *GC-PENDING* and pseudo-atomic-interrupted, and alloc() is
+     * always called from within pseudo-atomic, and thus we end up
+     * here again.  Third, when calling GC-ON or at the end of a
+     * WITHOUT-GCING, MAYBE-HANDLE-PENDING-GC will trap to here if
+     * there is a pending GC. */
+
+    /* Win32 only needs to handle the GC cases (for now?) */
+
     struct thread *thread = arch_os_get_current_thread();
-    struct interrupt_data *data = thread->interrupt_data;
 
     FSHOW_SIGNAL((stderr, "/entering interrupt_handle_pending\n"));
 
@@ -442,6 +426,7 @@ interrupt_handle_pending(os_context_t *context)
         check_blockables_blocked_or_lose();
     }
 
+#ifndef LISP_FEATURE_WIN32
     /* we may be here only to do the gc stuff, if interrupts are
      * enabled run the pending handler */
     if (!((SymbolValue(INTERRUPTS_ENABLED,thread) == NIL) ||
@@ -450,6 +435,7 @@ interrupt_handle_pending(os_context_t *context)
            (!foreign_function_call_active) &&
 #endif
            arch_pseudo_atomic_atomic(context)))) {
+        struct interrupt_data *data = thread->interrupt_data;
 
         /* There may be no pending handler, because it was only a gc
          * that had to be executed or because pseudo atomic triggered
@@ -825,13 +811,6 @@ interrupt_handle_now_handler(int signal, siginfo_t *info, void *void_context)
 #endif
 }
 
-/*
- * stuff to detect and handle hitting the GC trigger
- */
-
-#ifndef LISP_FEATURE_GENCGC
-#endif
-
 /* manipulate the signal context and stack such that when the handler
  * returns, it will call function instead of whatever it was doing
  * previously
@@ -1332,7 +1311,7 @@ unhandled_trap_error(os_context_t *context)
 }
 
 /* Common logic far trapping instructions. How we actually handle each
- * case is highly architecture dependant, but the overall shape is
+ * case is highly architecture dependent, but the overall shape is
  * this. */
 void
 handle_trap(os_context_t *context, int trap)