From: Nikodemus Siivola Date: Wed, 20 Jun 2007 19:05:53 +0000 (+0000) Subject: 1.0.6.59: bogus metacircles due to interrupted applicable method comp. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=f3a7c6b54880895d1598b1844d7e6eba98af9e53;p=sbcl.git 1.0.6.59: bogus metacircles due to interrupted applicable method comp. * If an interrupt arrives while have stuff on the *CACHE-MISS-VALUES-STACK* and the interrupt handler happens to call a gf that is already there, we used to think this was a metacircle. Instead we need to bind variables like this to "empty" values for interrupt hanlers. * Test. * Note some bugs. --- diff --git a/BUGS b/BUGS index 48ea0b3..e407f40 100644 --- a/BUGS +++ b/BUGS @@ -1820,3 +1820,29 @@ WORKAROUND: WARNING: bogus form-number in form! The source file has probably been changed too much to cope with. + +415: Issues creating large arrays on x86-64/Linux and x86/Darwin + + (make-array (1- array-dimension-limit)) + + causes a GC invariant violation on x86-64/Linux, and + an unhandled SIGILL on x86/Darwin. + +416: backtrace confusion + + (defun foo (x) + (let ((v "foo")) + (flet ((bar (z) + (oops v z) + (oops z v))) + (bar x) + (bar v)))) + (foo 13) + + gives the correct error, but the backtrace shows + 1: (SB-KERNEL:FDEFINITION-OBJECT 13 NIL) + as the second frame. + + + + diff --git a/NEWS b/NEWS index 1b686e1..a792105 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,8 @@ changes in sbcl-1.0.7 relative to sbcl-1.0.6: * bug fix: interning EQL-specializers is now thread and interrupt safe. * bug fix: asdf systems with dependencies to the SB-POSIX or SB-BSD-SOCKETS contribs can be loaded with :FORCE T. + * bug fix: interrupt safety of applicable method computation has been + improved. changes in sbcl-1.0.6 relative to sbcl-1.0.5: * new contrib: sb-cover, an experimental code coverage tool, is included diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index a5d9b33..1288f31 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -2037,6 +2037,7 @@ SB-KERNEL) have been undone, but probably more remain." "WITH-INTERRUPTS" "WITH-LOCAL-INTERRUPTS" "WITH-PINNED-OBJECTS" "WITHOUT-GCING" "WITHOUT-INTERRUPTS" + "WITH-INTERRUPT-BINDINGS" "WORDS")) #s(sb-cold:package-data diff --git a/src/code/early-impl.lisp b/src/code/early-impl.lisp index 01ae58d..b7de91e 100644 --- a/src/code/early-impl.lisp +++ b/src/code/early-impl.lisp @@ -52,4 +52,6 @@ sb!vm::*fp-constant-lg2* sb!vm::*fp-constant-ln2* sb!vm:*alloc-signal* - sb!pcl::..slot-unbound..)) + sb!pcl::..slot-unbound.. + sb!pcl::*cache-miss-values-stack* + sb!pcl::*dfun-miss-gfs-on-stack*)) diff --git a/src/code/target-signal.lisp b/src/code/target-signal.lisp index a59e730..c555dd2 100644 --- a/src/code/target-signal.lisp +++ b/src/code/target-signal.lisp @@ -11,22 +11,36 @@ (in-package "SB!UNIX") +(defmacro with-interrupt-bindings (&body body) + `(let + ;; KLUDGE: Whatever is on the PCL stacks before the interrupt + ;; handler runs doesn't really matter, since we're not on the + ;; same call stack, really -- and if we don't bind these (esp. + ;; the cache one) we can get a bogus metacircle if an interrupt + ;; handler calls a GF that was being computed when the interrupt + ;; hit. + ((sb!pcl::*cache-miss-values-stack* nil) + (sb!pcl::*dfun-miss-gfs-on-stack* nil)) + ,@body)) + (defun invoke-interruption (function) - (without-interrupts - ;; Reset signal mask: the C-side handler has blocked all - ;; deferrable interrupts before arranging return to lisp. This is - ;; safe because we can't get a pending interrupt before we unblock - ;; signals. - ;; - ;; FIXME: Should we not reset the _entire_ mask, just restore it - ;; to the state before we got the interrupt? - (reset-signal-mask) - (allow-with-interrupts (funcall function)))) - -(defmacro in-interruption ((&rest args) &body body) + (with-interrupt-bindings + (without-interrupts + ;; Reset signal mask: the C-side handler has blocked all + ;; deferrable interrupts before arranging return to lisp. This is + ;; safe because we can't get a pending interrupt before we unblock + ;; signals. + ;; + ;; FIXME: Should we not reset the _entire_ mask, but just + ;; restore it to the state before we got the interrupt? + (reset-signal-mask) + (allow-with-interrupts (funcall function))))) + +(defmacro in-interruption ((&key) &body body) #!+sb-doc "Convenience macro on top of INVOKE-INTERRUPTION." - `(invoke-interruption (lambda () ,@body) ,@args)) + `(dx-flet ((interruption () ,@body)) + (invoke-interruption #'interruption))) ;;;; system calls that deal with signals diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index 5eb299e..c831dc5 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -760,10 +760,12 @@ then do something that turns out to need those locks, you probably won't like the effect." #!-sb-thread (declare (ignore thread)) #!-sb-thread - (with-interrupts (funcall function)) + (with-interrupt-bindings + (with-interrupts (funcall function))) #!+sb-thread (if (eq thread *current-thread*) - (with-interrupts (funcall function)) + (with-interrupt-bindings + (with-interrupts (funcall function))) (let ((os-thread (thread-os-thread thread))) (cond ((not os-thread) (error 'interrupt-thread-error :thread thread)) diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 9aa2a3f..a58d900 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -1084,7 +1084,7 @@ gc_heap_exhausted_error_or_lose (long available, long requested) struct thread *thread = arch_os_get_current_thread(); print_generation_stats(1); fprintf(stderr, "GC control variables:\n"); - fprintf(stderr, " *GC-INHIBIT* = %s\n *GC-PENDING* = %s\n", + fprintf(stderr, " *GC-INHIBIT* = %s\n *GC-PENDING* = %s\n", SymbolValue(GC_INHIBIT,thread)==NIL ? "false" : "true", SymbolValue(GC_PENDING,thread)==NIL ? "false" : "true"); #ifdef LISP_FEATURE_SB_THREAD diff --git a/version.lisp-expr b/version.lisp-expr index 62ce26f..3639f77 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.6.58" +"1.0.6.59"