Support building without PSEUDO-ATOMIC on POSIX safepoints
authorDavid Lichteblau <david@lichteblau.com>
Wed, 5 Dec 2012 18:08:23 +0000 (19:08 +0100)
committerDavid Lichteblau <david@lichteblau.com>
Fri, 21 Dec 2012 19:30:48 +0000 (20:30 +0100)
commit37d3828773e2f847bb1ed7522b0af4fb8e736fc8
tree39aa3b0c4764c6d44ca44dd09c22e2d409fc1f5c
parentdaa6f0ce672d8dc60176ff885da18e44ee0355c6
Support building without PSEUDO-ATOMIC on POSIX safepoints

  - Mark Lisp signal handlers with a flag `synchronous' to indicate
    whether we can (and must) handle them immediately.  Conversely,
    we understand this flag to imply a guarantee that the signal
    does not occur during allocation.

  - Any signal with a Lisp handler that is not synchronous is
    implemented in the runtime using a trampoline, which (instead of
    invoking Lisp code directly) first spawns a new pthread, which
    only then calls back into Lisp to invoke the handler function
    (with a fake signal context).

  - Used in particular for SIGINT.

  - For SIGPROF, introduce a second per-thread allocation region,
    which gets swapped with the usual region around the call into
    SIGPROF-HANDLER.  This handler is a special case, because it is
    careful not to trigger GC nor non-local unwinds, and we can
    safely return to the original region afterwards.

  - Add a new subclass SIGNAL-HANDLER-THREAD for this purpose,
    making it easy to identify these threads (e.g. in the test
    driver).

  - Run sprof tests while building the contrib.  Add a test stressing
    time profiling of allocation sequences.

Enable using :SB-SAFEPOINT-STRICTLY on features.

Quite usable already on x86 and x86-64; PPC still has more prominent
issues, e.g. in threads.impure.lisp.
21 files changed:
contrib/sb-sprof/Makefile
contrib/sb-sprof/sb-sprof.lisp
contrib/sb-sprof/test.lisp [new file with mode: 0644]
make-config.sh
package-data-list.lisp-expr
src/code/target-signal.lisp
src/code/thread.lisp
src/compiler/generic/objdef.lisp
src/compiler/generic/parms.lisp
src/compiler/ppc/macros.lisp
src/compiler/x86-64/macros.lisp
src/compiler/x86/macros.lisp
src/runtime/gencgc.c
src/runtime/interrupt.c
src/runtime/interrupt.h
src/runtime/runtime.c
src/runtime/safepoint.c
src/runtime/thread.c
src/runtime/thread.h
tests/signals.impure.lisp
tests/test-util.lisp