sbcl Log

Commit Date  
[4e815e] (8.1 kB) by Douglas Katzman Douglas Katzman

Assign thread-local storage indices at load-time on x86-64

This also includes a disassembler enhancement.

2014-04-03 05:05:05 View
[e2327c] (7.9 kB) by Stas Boukarev Stas Boukarev

Remove unnecessary package qualifiers.

2014-03-21 04:09:39 View
[ff2ddc] (7.9 kB) by Stas Boukarev Stas Boukarev

Better error when calling an undefined alien function on x86-64.

(sb-alien:extern-alien "nnnn" (function sb-alien:void)))
now says "The alien function "nnnn" is undefined." instead of
"Attempt to call an undefined alien function."

This is achieved by storing the address of the linkage table entry in
RBX before the call. Should be trivial to port to other platforms.

2013-10-01 17:03:00 View
[37d382] (7.8 kB) by David Lichteblau David Lichteblau

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

- 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.

2012-12-05 18:08:23 View
[daa6f0] (7.8 kB) by David Lichteblau David Lichteblau

Foreign callbacks

Allow alien callbacks to be invoked in pthreads created outside of
the Lisp runtime:

Add new runtime functions attach_os_thread, detach_os_thread
allowing such threads to acquire a `struct thread' temporarily,
turning them into Lisp threads.

In a main deviation from the Windows branch (which has a similar
feature), this mechanism does not involve user-land thread (fiber)
mechanisms to switch between stacks. Instead, Lisp code merely runs
on the existing pthread's stack.

Currently a safepoint-only feature, because only safepoint-based
builds already go through a convenient trampoline function for
callbacks, but a backport of this feature to non-safepoint builds
might be straightforward.

2012-12-12 13:30:52 View
[8ede17] (7.7 kB) by David Lichteblau David Lichteblau

Safepoint protocol upgrade

Upgrade to the new stop-the-world protocol from the Windows branch,
dating back to late 2011, an all-in-one readability and correctness

Replace per-thread qrl locks with one process-wide lock for all
operations relating to GC state and the threads' CSP area. Use
condition variables for notifications on GC state changes.

Thanks to Anton Kovalenko.

2012-10-31 17:06:00 View
[f05756] (7.7 kB) by David Lichteblau David Lichteblau

Extend use of the linkage table to static symbols

- Formerly static symbols are static no more:

- Always use the linkage table, even in cross compilation. The
runtime retrieves the resulting list of foreign symbols and installs
linkage table entries before calling into Lisp for the first time.

- Simplify/remove various win32 foreign symbol special cases.

- Almost remove scratch().

Conditional on feature SB-DYNAMIC-CORE; required on Windows and optional
on other platforms supporting the linkage table.

With this feature, changes to src/runtime can be built using make,
without requiring a step to update core files.

For LINKAGE-TABLE platforms only. Currently supported on x86 and
x86-64. (PowerPC does not yet work.) In the interest of simplicity,
disable this feature permanently on non-SB-THREAD platforms, because
these would require unpleasant changes to allocation macros.

Thanks to Anton Kovalenko.

2012-10-23 19:55:02 View
[3ea89b] (7.6 kB) by David Lichteblau David Lichteblau

Move the global safepoint to one page before static space

New attempt at finding an optimal location for the global safepoint
page. Hopefully this solution will cover all our use cases for
the foreseeable future.

- Relative to static space for architectures with small immediates.

- Also addresses the requirements of sb-dynamic-core, which needs
the safepoint to have an absolute address on x86(-64).

Hence, a new macro !gencgc-space-setup -- tweaks space parameters to
squeeze in the safepoint page, while also simplifying parms.lisp for
some platforms.

2012-10-29 12:43:07 View
[dd54f9] (4.1 kB) by David Lichteblau David Lichteblau

Use safepoints for INTERRUPT-THREAD

* In INTERRUPT-THREAD, stop threads using safepoints instead of

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

* This feature should ultimately be rolled into SB-SAFEPOINT, but
remains as a separate build option until both versions are equally
well-tested, and until other avoidable uses of signals have also
been replaced by safepoints.

* On the term "thruption": Earlier work on this feature sometimes
used "interrupt" to refer to INTERRUPT-THREAD, causing confusion
with the traditional meaning of "interrupt" as POSIX signal or WIN32
exception. To avoid such confusion, the runtime now refers to
INTERRUPT-THREAD as a "thruption", short for th(read) (inter)ruption.

* SIGPIPE is not used for threads running Lisp code, but a low-level
handler for SIGPIPE still exists which arranges for threads running
FFI code (in particular, threads blocked in poll, select,
futex_wait) to be interrupted.

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

Credits: This is a POSIX backport of Windows threading changes by
Anton Kovalenko and Dmitry Kalyanov.

2011-06-17 12:17:07 View
[e6f4c7] (4.0 kB) by David Lichteblau David Lichteblau

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

* 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

* 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.

2011-04-28 11:51:35 View
[035264] (3.9 kB) by Manfred Gahr Manfred Gahr , pushed by Nikodemus Siivola Nikodemus Siivola

fix --dynamic-space-size option handling

!CONFIGURE-DYNAMIC-SPACE-END actually ignored the number it read.

2011-12-05 21:37:53 View
[aadc83] (3.9 kB) by Nikodemus Siivola Nikodemus Siivola

smaller default dynamic-space size on GENCGC

512Mb for 32-bit platforms, 1Gb for 64-bit ones.

(OpenBSD/x86-64 is the exception using 444Mb to fit under default ulimits.)

2011-11-21 14:53:17 View
[27b74e] (3.7 kB) by Nathan Froyd Nathan Froyd fix static symbols for array dispatch tables

The array dispatch tables have gone through several renamings. Unfortunately,
the references to the names in compiler/generic/parms.lisp have not been
renamed as well. Do so, and micro-optimize generic array access slightly.

(Optimizing SYMBOL-VALUE on static/global symbols would help as well...)

2010-10-04 02:12:53 View
[fc6722] (3.7 kB) by Nikodemus Siivola Nikodemus Siivola now accepts --dynamic-space-size=<size> option users can build SBCL with the right default without
touching source.

Fixes lp#383222.

2010-09-30 08:36:38 View
[46c787] (2.9 kB) by Alastair Bridgewater Alastair Bridgewater threads: Consolidate thread-specific static symbols

* The x86, x86-64 and ppc backends all had the same three static
symbols used for threading. Rather than having each backend add
the same symbols to the static symbol list, add them to the list
of common static symbols. In the unlikely(?) event that we commit
a threaded port to mainline that doesn't use these symbols, we can
revisit this change.

2010-09-08 01:04:41 View
[2aa6e7] (2.8 kB) by Alastair Bridgewater Alastair Bridgewater gencgc: Implement object pinning for non-x86oids.

* Add a new static symbol for all non-x86oid gencgc targets,

* Bind *pinned-objects* to NIL during thread creation if it is

* During garbage collection, where x86oids preserve pointers on
the various thread stacks, use the same mechanism to preserve
pointers linked on *pinned-objects* for each thread.

* Change the PPC version of with-pinned-objects to rebind
*pinned-objects* with the new objects to pin prepended when using

2010-08-06 18:49:42 View
[4ec0d7] (2.7 kB) by Nikodemus Siivola Nikodemus Siivola GENCGC tuning parameters

in lisp, and let genesis tell C about them.

* Make various generations[gen].foo tweakable from lisp, give them
nice interface functions and document the same.

* Bits of manual prettification in related parts.

2009-11-19 16:08:37 View
[cf4908] (2.6 kB) by Nathan Froyd Nathan Froyd remove :PREFIX/:SUFFIX from DEFENUM for MORE GREPPABILITY

Searching for useful things like even-fixnum-lowtag in the source won't
find the actual definition due to cleverness with DEFENUM. This cleverness
is the source of several FIXMEs throughout the code. I can personally
remember being baffled at the magic of even-fixnum-lowtag and friends
magically springing into existence when I could not easily grep for their
definitions. In the interest of clarity, remove the cleverness and update
all relevent DEFENUMs.

In the interest of OAOO, move TRACE-TABLE-* constants to generic code while
we're at it, too. Doing the same thing for the *-TRAP constants is left
as an exercise for another day.

2009-05-08 20:58:23 View
[e5d969] (2.5 kB) by Gabor Melis Gabor Melis detect binding and alien stack exhaustion

Alien stack exhaustion machinery only works on x86oids.

2009-02-16 22:23:08 View
[ae09f8] (2.4 kB) by Gabor Melis Gabor Melis INTERRUPT-THREAD and timer improvements

The main thing accomplished by this commit is that it's finally
possible to use INTERRUPT-THREAD and TIMERS sanely:

- there is a per thread interruption queue, interruption are executed
in order of arrival

- the interruption has to explicitly enable interrupts with
WITH-INTERRUPTS if needed. In the absence of WITH-INTERRUPTS the
interruption itself is not interrupted and running out of stack is
not a problem.

- timers have an improved repeat mechanism

Implementation notes:

- INTERRUPT-THREAD is implemented on all platforms and builds (that
is, even without :SB-THREAD) by sending a signal to the current
thread (or process without thread). This allows us to hook into the
normal, interrupt deferral mechanism without having to commit OAOO
violations on the Lisp side. And it makes threaded, non-threaded
builds closer, hopefully easing testing.

- SIG_INTERRUPT_THREAD is SIGPIPE on all platforms. SIGPIPE is not
used in SBCL for its original purpose, instead it's for signalling a
thread that it should look at its interruption queue. The handler
(RUN_INTERRUPTION) just returns if there is nothing to do so it's
safe to receive spurious SIGPIPEs coming from the kernel.

- IN-INTERRUPTION does not unblock deferrables anymore, but arranges
for them to be unblocked when interrupts are enabled (see

- Thread interruption run wrapped in a (WITHOUT-INTERRUPTS

- Repeating timers reschedule themselves when they finished to the
current expiry time + repeat interval even if that's in the past.
Hence, a timer's schedule does not get shifted if it takes a long
time to run. If it takes more time than the repeat interval then it
may catch up on later invokations.

...)) even in run in a new thread.

- Enable previously failing tests.

- Add more tests.

- Automatically unschedule repeating timers if they take up all the

2009-02-16 22:16:20 View
[4f9b5c] (2.4 kB) by Gabor Melis Gabor Melis gc trigger improvements

- Make sure that gc never runs user code (after gc hooks and
finalizers) if interrupts are disabled and they cannot be enabled

- clean up maybe_gc: we know that in the interrupted context gc
signals are unblocked (see "check that gc signals are unblocked"
commit) so it's safe to simply enable them and call SUB-GC

2009-02-16 21:53:25 View
[edb227] (2.4 kB) by Gabor Melis Gabor Melis improvements to WITHOUT-GCING

- implement it with only one UNWIND-PROTECT (about 30% faster)
- in maybe_defer_handler defer interrupts if we are in the racy part
of WITHOUT-GCING, that is with interrupts enabled, gc allowed but
- check more invariants

2009-02-16 21:49:30 View
[269873] (2.4 kB) by Nikodemus Siivola Nikodemus Siivola call stub needed to switch between hpux heap-spaces

* Patch by Larry Valkama.

2009-01-04 07:35:53 View
[0bb093] (2.4 kB) by Gabor Melis Gabor Melis lose informatively when the tls is full

Instead of eventually producing a segv or some random corruption:

(progv (loop for i below 5000
collect (make-symbol (format nil "xxx~D" i)))
(loop for i below 5000 collect i))

2008-05-08 07:14:01 View
[c548f7] (2.2 kB) by Nikodemus Siivola Nikodemus Siivola ALLOW-WITH-INTERRUPTS and interrupt safe WITH-MUTEX &co

* Remove the *IN-INTERRUPTION* kludge, and replace it with a
general-purpose mechanism.

unless it is true and interrupts are inhibited.

local macros.

held before entry to WITHOUT-INTERRUPTS.

WITH-LOCAL-INTERRUPTS is equivalent to
(allow-with-interrups (with-interrupts ...))
but somewhat more efficient.

* Use the above to make WITH-MUTEX &co interrupt-safe, but still
interruptible: WITH-FOO becomes
(when (setf foo (allow-with-interrupts (get-foo)))
(with-local-interrupts ...))
(when foo
(release-foo foo))))
and GET-FOO wraps it's waiting section inside a WITH-INTERRUPTS.

* While at it, rewrite WITH-MUTEX &co to use CALL-WITH-FOO style

* Write CALL-WITH-SYSTEM-MUTEX as a more efficient alternative to:

(without-interrupt (with-mutex ...)) ; and
(without-gcing (with-mutex ...))

Similarly for CALL-WITH-RECURSIVE-SYSTEM-SPINLOCK, for the benefit
of PCL.

* No need to signal a WARNING for WITH-INTERRUPTS inside a WITHOUT-GCING,
as *ALLOW-WITH-INTERRUPTS* is always false there, so interrupts will
not be enabled.

2007-06-08 12:15:44 View
Older >

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks