Add safepoint mechanism
authorDavid Lichteblau <david@lichteblau.com>
Thu, 28 Apr 2011 11:51:35 +0000 (13:51 +0200)
committerDavid Lichteblau <david@lichteblau.com>
Fri, 10 Aug 2012 12:51:45 +0000 (14:51 +0200)
commite6f4c7523aa628ece995ee01879d3fb90eed6d9f
tree44e3316456a3a70eaae5252711855810d859f9f4
parent4bc19d9ce2f31330e3d2a8639c078451d1adc79d
Add safepoint mechanism

  * Stop threads for GC at safepoints only.

  * Replaces use of SIG_STOP_FOR_GC.

  * Currently not used by default.  Users need to set feature
    SB-SAFEPOINT to enable this code.  SB-SAFEPOINT should only be set
    when SB-THREAD is also enabled.

  * ISA support: Each architecture needs VOP support, and changes to
    foreign call-out assembly; only x86 and x86-64 implemented at this
    point.

  * OS support: Minor changes to signal handling required, currently
    implemented for Linux and Solaris.

  * Performance note: Does not currently replace pseudo-atomic entirely,
    except on Windows.  Only once further work has been done to reduce
    use of signals will pseudo-atomic become truly redundant.  Therefore
    use of safepoints on POSIX currently still implies the combined
    performance overhead of both mechanisms.

  * Design alternatives exist for some choices made here.  In particular,
    this commit places the safepoint trap page into the SBCL binary for
    simplicity.  It is likely that future changes to allow slam-free
    runtime changes will have to go back to a hand-crafted address
    parameter.

  * This feature has been extracted from work related to Windows
    support and backported to POSIX.

Credits: Uses the CSP-based stop-the-world protocol by Anton Kovalenko,
based on the safepoint and threading work by Dmitry Kalyanov.  Use of
safepoints for SBCL originally researched by Paul Khuong.
45 files changed:
package-data-list.lisp-expr
src/code/early-impl.lisp
src/code/gc.lisp
src/code/target-signal.lisp
src/code/target-thread.lisp
src/compiler/fndb.lisp
src/compiler/generic/objdef.lisp
src/compiler/generic/parms.lisp
src/compiler/ir2tran.lisp
src/compiler/policies.lisp
src/compiler/x86-64/backend-parms.lisp
src/compiler/x86-64/c-call.lisp
src/compiler/x86-64/macros.lisp
src/compiler/x86-64/parms.lisp
src/compiler/x86-64/system.lisp
src/compiler/x86/c-call.lisp [changed mode: 0644->0755]
src/compiler/x86/macros.lisp
src/compiler/x86/parms.lisp
src/compiler/x86/system.lisp
src/runtime/GNUmakefile
src/runtime/alloc.c
src/runtime/breakpoint.c
src/runtime/bsd-os.c
src/runtime/cpputil.h [new file with mode: 0644]
src/runtime/dynbind.c
src/runtime/dynbind.h
src/runtime/funcall.c
src/runtime/gc-common.c [changed mode: 0644->0755]
src/runtime/gencgc.c [changed mode: 0644->0755]
src/runtime/globals.h
src/runtime/interrupt.c
src/runtime/interrupt.h
src/runtime/linux-os.c
src/runtime/runtime.h
src/runtime/safepoint.c [new file with mode: 0644]
src/runtime/sunos-os.c
src/runtime/thread.c
src/runtime/thread.h
src/runtime/win32-os.c [changed mode: 0644->0755]
src/runtime/x86-64-arch.c
src/runtime/x86-64-assem.S
src/runtime/x86-arch.c
src/runtime/x86-assem.S
src/runtime/x86-linux-os.c
src/runtime/x86-sunos-os.c