Nikodemus Siivola [Sat, 19 Nov 2011 14:39:59 +0000 (16:39 +0200)]
GC documentation tweaks
* Fold documentation of (SETF GC-LOGFILE) into that of GC-LOGFILE.
* Document default value of GENERATION-NUMBER-OF-GCS-BEFORE-PROMOTION.
* Order the dictionary entries in the manual's GC section more logically.
I hope.
Nikodemus Siivola [Sat, 19 Nov 2011 14:37:03 +0000 (16:37 +0200)]
export DYNAMIC-SPACE-SIZE from SB-EXT
Nikodemus Siivola [Sat, 19 Nov 2011 14:35:18 +0000 (16:35 +0200)]
default gen.bytes_consed_between_gc to same 5% of dynamic space size
...the previous default was 2,000,000 bytes, not 20Mb as the
documentation claimed. Oops.
Nikodemus Siivola [Sat, 19 Nov 2011 12:38:26 +0000 (14:38 +0200)]
default nursery to 5% of total dynamic space size on GENCGC
5% seems like a reasonable compromise between latency and throughput.
Also change a few related stray size_t types to os_vm_size_t, which
necessitates moving runtime options saving bits into their own header file.
Nikodemus Siivola [Sat, 19 Nov 2011 12:16:47 +0000 (14:16 +0200)]
unsigned long -> os_vm_size_t refactoring
Replace a number of GC related unsigned longs with os_vm_size_t, make it
available in on the lisp-side as well, and use where appropriate.
Makes BYTES-CONSED-BETWEEN-GCS and its SETF-version also support large
nurseries.
Nikodemus Siivola [Fri, 18 Nov 2011 19:08:16 +0000 (21:08 +0200)]
threading NEWS, and thanks to supporters
Update NEWS with the recent threading work.
Many thanks to all the IndieGoGo donors who have made these improvements --
and more to come -- possible.
www.indiegogo.com/SBCL-Threading-Improvements-1
In addition some 80 donors who didn't choose any perks at all, or were
content with a warm and fuzzy feeling, thanks are owed to:
Abhishek Reddy
Alexander Shendi
Alexander Skobelev
Alexandre Abreu
Andreas Franke
Andreas Fredriksson
Andreas Fuchs
AntonVodonosov
Arnaud Betremieux
Atte Hinkka
Austin Haas
Benjamin Tovar
Bong Munoz
Bozhidar Batsov
Brandon Werner
Brit Butler
Bruce O'Neel
CHIBA Masaomi
Carl Gay
Chad
Chaitanya Gupta
Charlie McMackin
Christian Walther
Copyleft Solutions
Cyrus Harmon
Dan Ballard
Daniel Collin
Danny Woods
Dave Newton
David BIltcliffe
David Lamkins
Eric Blossom
Erik Winkels
Francisco Vides Fernández
Gabriel Giovannetti
Gary Klimowicz
Gary Waters
Geir Tjørhom
Gene Diveglia
Geoff Cant
Geoff Wozniak
Hans Huebner
Hein Hermans
Henri Kyrki
Henry Lenzi
Heow Goodman
Hiroyuki Tokunaga
Ivan Boldyrev
Ivan Rocha
Ivan Shvedunov
James Wright
Jan Moringen
Jeff Palmucci
Jerry Errett
Johannes Grødem
Jonathan Smith
Jorge Gajon
Joseph Iacobucci
Josh Marchan
José Antonio Ortega Ruiz
Jovanovic Milan
Jānis Džeriņš
Kamil Shakirov
Kan-Ru Chen
Karsten Poeck
Kevin Raison
Kim Minh Kaplan
Lars Brinkhoff
Lee Hinman
Leslie Polzer
Liam Healy
Lin Wen Chun
Luke Crook
Luís Oliveira
Manabu Takayama
Mark Hepburn
Martin Muggli
Masatoshi SANO
Mason Smith
Mathias Dhuicq
Mathias Hellevang
Matthew Curry
Matthew Swank
Matthias Hölzl
Michael Kuijn
Milo McCheese
Morten Nygaard Åsnes
Natalie Masse Hooper
Nathan Hartman
Nicolas Neuss
Nikolaus Demmel
Norman Jaffe
Ole Arndt
Paul Nathan
Petter Egesund
Philippe Brochard
Piotr Esden-Tempski
Reuben Cornel
Rich Hickey
Robert Postill
Robert Smith
RobertSanders
Ryan Pavlik
Sean Bryant
Seth Carbon
Seth Ladygo
Slawek Zak
Slobodan Milnović
Stephen Balousek
Steve Carney
Tim Howe
Tim Ritchey
Tim Showalter
Timo Myyrä
Todd Alan Kurtz
View Software Services Ltd / P Baccou
Vincent Manis
Vsevolod Domkin
William Hay
Wukix Inc.
Xristos Kalkanis
Yoshinori Tahara
Yousuke Ushiki
Zach Beane
Zach Kost-Smith
agriff
cpc26
esologic
gabalz
hexstream
indiegogo87
lokedhs
mcturra2000
serjkl
tim67
vsedach
zellerin
Nikodemus Siivola [Fri, 18 Nov 2011 18:05:38 +0000 (20:05 +0200)]
userspace CONDITION-WAIT and interrupts
GC and signals cause WITHOUT-THREAD-WAITING-FOR to mark the thread as
temporarily not waiting for anything, restoring the old status on unwind.
This is fine for mutex deadlock detection, but now that the same slot is
used for userspace condition variable wakeups we end up in trouble:
T1: enqueue self on waitqueue, marked as waiting on it.
T1: receives an interrupt and is marked as not waiting anymore while the
interrupt is handled.
T2: delivers a wakeup to the queue, sees T1 as not waiting anymore and
drops it from the queue.
T1: resumes waiting, but isn't on the queue, and never receives a wakeup.
Extra Bonus:
If T1 times out or unwinds for any reason, it sees itself as not having
been woken up, and with interrupts disabled tries to unqueue itself
from the queue -- ending up in an uninterruptible endless loop.
The Fix:
WITHOUT-THREAD-WAITING-FOR no longer restores the waiting-for information
for waitqueues, effectively causing a bogus wakeup.
Nikodemus Siivola [Fri, 18 Nov 2011 14:37:20 +0000 (16:37 +0200)]
sb-bsd-sockets: gethostbyname and gethostbyaddr are not thread safe
...or re-entrant. Need to disable interrupts and grab a lock.
Affects only platforms without getaddrinfo.
Correct the size of memory leak fixed in last commit in NEWS -- it
was more than one word per call.
Nikodemus Siivola [Fri, 18 Nov 2011 14:33:35 +0000 (16:33 +0200)]
sb-bsd-sockets: check for MAKE-ALIEN success in GET-PROTOCOL-BY-NAME
Currently of malloc fails it returns a null alien.
Yuck.
Nikodemus Siivola [Fri, 18 Nov 2011 14:21:26 +0000 (16:21 +0200)]
sb-bsd-sockets: GET-ADDRESS-INFO foreign memory leak
Two issues:
* We were using MAKE-ALIEN and not freeing the memory.
* We were calling FREE-ADDRINFO, not FREEADDRINFO: the first is an
SB-GROVEL generated deallocator, the second is freeaddrinfo()...
Nikodemus Siivola [Fri, 18 Nov 2011 12:53:47 +0000 (14:53 +0200)]
small package lock documentation cleanup
"cause result in a..." Feh. Me good english yes.
Also mention the compile-time warning for clarity.
Nicolas Edel [Fri, 18 Nov 2011 10:49:22 +0000 (12:49 +0200)]
pass errno from exec() to parent in spawn()
Open a pipe, set FD_CLOEXEC.
Child: if exec() fails, grab errno and write it to pipe.
Parent: try to read from the pipe -- if you get something, it means the
child didn't exec and the reason is in the pipe. Wait for the child to exit
and return -1 and set errno to whatever the child got.
Also use _exit() instead of exit() when dying in the child after exec
failure -- running exit hooks there would probably be bad.
(Somewhat edited from Nicolas' original patch.)
Signed-off-by: Nikodemus Siivola <nikodemus@random-state.net>
Nikodemus Siivola [Thu, 17 Nov 2011 12:11:18 +0000 (14:11 +0200)]
semaphore notification objects
Nikodemus Siivola [Thu, 17 Nov 2011 15:06:04 +0000 (17:06 +0200)]
scarier INTERRUPT-THREAD and TERMINATE-THREAD documentation
Try to put the fear of asynch unwinds into the reader.
Nikodemus Siivola [Wed, 16 Nov 2011 15:27:15 +0000 (17:27 +0200)]
missing CAS-locks and barriers
* %WAITQUEUE-ENQUEUE was missing the CAS-lock, as was checking for
the wakeup.
* Put back the spin-before-yielding loop into WITH-CAS-LOCK, which
I'd removed for some reason.
* PPC has threads, and really needs barriers. x86oids have made me
lazy, and now we pay the price. In particular:
** THREAD-WAITING-FOR: a read barrier in the non-futex
CONDITION-WAIT -- the corresponding writes are protected
by CAS and hence provide a write barrier already.
...and just for symmetry and because this makes my poor
head hurt add write and read barriers to other places where
it is read from / written to.
** WITH-CAS-LOCK: a read barrier for the READ-FORM. Not strictly
necessary perhaps, as THREAD-YIELD most probably provides a
barrier, but this is easier to read. Since the corresponding
writes should use CAS, we're OK.
Nikodemus Siivola [Mon, 7 Nov 2011 12:49:57 +0000 (14:49 +0200)]
pthread_cond_broadcast is not asynch signal safe
AKA /less/ GC deadlocks on Darwin.
To be specific, it can cause our GC to deadlock on Darwin, with all lisp
threads spinning on the same global spinlock in the bowels of the
pthread_cond_wait implementation. That was fun to figure out.
The test (:interrupt-thread :interrupt-consing-child) is a good one
for catching this: try to run it repeatedly under an earlier SBCL
under Darwin, and sooner or later it will hang.
...with this commit, we're still using pthread_cond_broadcast, but
blocking signals around the relevant bits, which --experimentally--
makes the aforementioned test pass "somewhat more consistently".
It can still hang, but those hangs seem to be related to deferrable
signals being indefinitely blocked in one of the threads -- no idea
as of yet why.
Summa Summarum: this is a bit of a sorry bandaid, waiting for
a better solution. (Probably using realtime semaphores, which
/should/ be signal-handler safe.)
Stas Boukarev [Wed, 16 Nov 2011 18:16:52 +0000 (22:16 +0400)]
Fix typo in the man-page markup code.
Patch by Kenneth Westerback on lp#891114
Nikodemus Siivola [Wed, 16 Nov 2011 16:18:23 +0000 (18:18 +0200)]
sb-bsd-sockets: foreign memory leak in GET-PROTOCOL-BY-NAME
I blame WITH-ALIEN usage -- it masks the MAKE-ALIEN calls
from the casual eye.
Paul Khuong [Tue, 15 Nov 2011 21:20:06 +0000 (16:20 -0500)]
Plug two more CTYPE leaks into fasls
* (setf aref) would dump the declared element type on compile-time
type mismatch.
* same for function return value types (e.g. via (declare (values ...)))
Paul Khuong [Tue, 15 Nov 2011 16:53:50 +0000 (11:53 -0500)]
Plug a CTYPE leak into fasls via SETQ
Type mismatch from SETQing lexical variables used to dump CTYPE
structs directly. Splice a type specifier in instead during
IR1 conversion of SETQ so that the source form remains dumpable.
Reported with the test case by Xach on #lisp.
Fixes lp#890750.
Nikodemus Siivola [Mon, 14 Nov 2011 14:18:41 +0000 (16:18 +0200)]
document GRAB-MUTEX in the manual
lp#884099
Nikodemus Siivola [Mon, 14 Nov 2011 12:56:00 +0000 (14:56 +0200)]
symlinks and RENAME-FILE and DELETE-DIRECTORY
Both followed symlinks too eagerly.
* Presumably anyone doing (rename-file "link-to-foo" "bar") wants to rename
the link and not the file it points to -- which has the unpleasant
side-effect of breaking the selfsame link.
Make it so.
* It is less clear what someone doing (delete-directory "link-to-dir")
expects to happen -- so take the conservative option and signal an error,
and document this.
Nikodemus Siivola [Mon, 14 Nov 2011 13:56:09 +0000 (15:56 +0200)]
sb-concurrency: GATE tweak, fix building without threads
* OPEN-GATE wasn't interrupt-safe. Don't want to have an interrupt unwind
after opening the gate but before broadcasting on the condition variable.
* Disable tests needing threads on unithread builds, add one that
doesn't need threads.
Also: many thanks to Tobias Rittweiler on whose code the GATE implementation
is based!
Nikodemus Siivola [Mon, 14 Nov 2011 10:17:27 +0000 (12:17 +0200)]
sb-concurrency: add Allegro-style gate objects
Paul Khuong [Sun, 13 Nov 2011 20:00:21 +0000 (15:00 -0500)]
More numerically stable %hypot (ABS of complex floats) on win32
Based on a patch by Robert Smith.
Nikodemus Siivola [Wed, 8 Jun 2011 07:58:59 +0000 (10:58 +0300)]
extensible CAS and CAS extensions
DEFINE-CAS-EXPANDER and DEFCAS are analogous to DEFINE-SETF-EXPANDER and
DEFSETF, including CAS-functions similar to SETF-functions:
(defun (cas foo) (old new ...) ...)
THis is exported from SB-EXT for users to play with, and used to implement
our CAS places internally.
Add support for CAS of:
* SLOT-VALUE
* STANDARD-INSTANCE-ACCESS
* FUNCALLABLE-STANDARD-INSTANCE-ACCESS
In case of SLOT-VALUE we don't yet support any optimizations or specify
results when SLOT-VALUE-USING-CLASS or friends are in play -- perhaps later
we can add
(CAS SLOT-VALUE-USING-CLASS) &co
in order to support it for arbitrary instances.
Adding support for permutation vector optimization should not be too hard
either, but let's let the dust settle first...
Nikodemus Siivola [Sat, 12 Nov 2011 13:09:41 +0000 (15:09 +0200)]
clean leftover SB_LUTEX gunk from the runtime
Missed a spot...
Nikodemus Siivola [Fri, 11 Nov 2011 16:51:18 +0000 (18:51 +0200)]
package snafu on unithreaded build
Christophe Rhodes [Fri, 11 Nov 2011 16:47:30 +0000 (16:47 +0000)]
fix out-of-line structure predicates on obsolete standard-instances
Apply the same fix to typep-to-layout that I did over five years ago
to the various inline / compiler transforms. Include an out-of-line
test case.
Christophe Rhodes [Fri, 11 Nov 2011 15:29:46 +0000 (15:29 +0000)]
improve layout-invalid error message
It helps if we pass the right initialization forms to make-condition.
Alastair Bridgewater [Wed, 9 Nov 2011 17:49:28 +0000 (12:49 -0500)]
Make MAKE-LISP-OBJ pickier on CHENEYGC.
* Move the valid_lisp_pointer_p() guts from gencgc.c to
gc-common.c, updating header files and staticness as required.
Also remove all of the debug output conditional on
gencgc_verbose (which is obviously gencgc-specific).
* Make the lisp-side VALID-LISP-POINTER-P not-gencgc-specific.
* Always use VALID-LISP-POINTER-P in MAKE-LISP-OBJ instead of
using some simple bounds-check on CHENEYGC.
Alastair Bridgewater [Wed, 9 Nov 2011 17:30:40 +0000 (12:30 -0500)]
arch-assem.S: Update fun-end breakpoint magic for pickier make-lisp-obj.
* We're about to cause SB-KERNEL:MAKE-LISP-OBJ to use the same
validation on CHENEYGC as it always has on GENCGC.
* In order to not break function-end breakpoints, update them
all now to have the same header structure as on PPC (which had
to be made to work on GENCGC some time back).
* While we're here, add a comment to each copy pointing to the
PPC version as having an actual explanation for the magic.
* And update the PPC version commentary to the soon-to-be
reality of MAKE-LISP-OBJ always verifying pointers, instead of
only verifying pointers on GENCGC.
* Finally, remove the no-longer-necessary code in debug-int
that set the header value, leaving a historic-information
comment behind.
Alastair Bridgewater [Wed, 9 Nov 2011 16:48:19 +0000 (11:48 -0500)]
gencgc: Make MAKE-LISP-OBJ of SIMPLE-FUN object addresses work.
* This turned out to be a bug in the gencgc guts,
looks_like_valid_lisp_pointer_p() was doing pointer arithmetic
when it should have been converting the pointer to an integer.
Nikodemus Siivola [Thu, 10 Nov 2011 17:09:37 +0000 (19:09 +0200)]
fix unthreaded build
CONDITION-WAIT on threadless builds now reads TIMEOUT.
Stray MUTEX/LOCK naming confusion.
#+sb-thread on more mailbox test.
#!+sb-thread %WAIT-FOR-MUTEX for cleanliness.
Nikodemus Siivola [Thu, 10 Nov 2011 15:18:22 +0000 (17:18 +0200)]
SPINLOCK-NAME not deprecated since 1.0.5.x, but 1.0.53.11...
Nikodemus Siivola [Thu, 10 Nov 2011 14:08:55 +0000 (16:08 +0200)]
tweak threads.impure.lisp tests
* Enable (:CONDITION-WAIT :DEADLINES :LP-512914) outside futex platforms.
* Mark :BACKTRACE as broken on Darwin after all, still.
Nikodemus Siivola [Thu, 10 Nov 2011 14:06:19 +0000 (16:06 +0200)]
use RELATIVE-DECODED-TIMES in serve-event
OAOO, yum.
Nikodemus Siivola [Tue, 23 Aug 2011 12:50:04 +0000 (15:50 +0300)]
unify locks
Remove spinlocks, make spinlock functions redirect to mutexes
instead. (Compile-time deprecation style-warning for spinlocks.)
Jim Wise [Thu, 10 Nov 2011 15:05:43 +0000 (10:05 -0500)]
Adjust for Solaris /bin/sh.
Nikodemus Siivola [Thu, 10 Nov 2011 13:05:16 +0000 (15:05 +0200)]
timeouts on JOIN-THREAD
Marking the return convention experimental for now, as I'm
not sure if
...we should signal a separate condition type for timeouts.
...we should have a separate :TIMEOUT-VALUE argument.
...if that value should default to value of DEFAULT.
Pfff. Interfaces are hard -- let's go shopping!
Nikodemus Siivola [Thu, 10 Nov 2011 09:27:15 +0000 (11:27 +0200)]
timeouts on semaphores and mailboxes, fix timeouts on condition variables
* Accidentally put in the version of condition variable timeouts that just
looked like a spurious wakeup instead of returning NIL without grabbing
the mutex. Ooops -- fixed that.
* The issue with mailbox tests on Darwin at least appears to be related
to our usage of pthread functions inside signal handlers.
Nikodemus Siivola [Thu, 10 Nov 2011 11:23:51 +0000 (13:23 +0200)]
make it possible to build only selected contribs
Not for users as such, but for poking at specific contribs with a faster
turnaround.
Jim Wise [Thu, 10 Nov 2011 03:25:19 +0000 (22:25 -0500)]
At least one of the Tests which hang on Darwin also hang on SunOS.
Make (not (or darwin sunos)) for the moment, and I'll tey to narrow this
down tomorrow.
sb-concurrency otherwise builds and tests great with new thread stuff on
Solaris/X86 -- on to ../../tests!
Nikodemus Siivola [Tue, 16 Aug 2011 19:46:06 +0000 (22:46 +0300)]
killing lutexes, adding timeouts
* Remove all lutex-specific code from the system.
** Use SB-FUTEX for futex-capable platforms, and plain SB-THREAD
otherwise.
** Make non-futex mutexes unfair spinlocks for now, using WAIT-FOR to
provide timeouts and backoff.
** Build non-futex condition variables on top of a queue and WAIT-FOR.
Performance implications: SB-FUTEX builds should perform pretty much the
same, or improve a bit. Threaded non-futex builds are affected as follows:
1. Threads idling on semaphores or condition variables aren't quite as
cheap. Just how costly depends on the OS. On Darwin 1000 idle threads
can chew up a bit over 50% CPU. I will try to address this later.
2. Contested locking around operations that take considerably longer
than a single timeslice suffers mild degradation.
3. Contested locking around operations that don't take long is an order
of magnitude performant.
4. Highly active semaphores perform much better. (Follows from #3.)
* GRAB-MUTEX gets timeout support on all platforms.
* CONDITION-WAIT gets timeout support.
* Disable a bunch of prone-to-hang thread tests on Darwin. (All of them
were already prone to hang prior to this commit.)
* Enable a bunch tests that now /pass/ on Darwin. \o/ This doesn't mean that
the threaded Darwin is fully expected to pass all tests yet, but let's say
it's more likely to do so.
...but still not robust enough to enable threads on Darwin by default.
* GET-MUTEX/GRAB-MUTEX get refactored into two main parts: %TRY-MUTEX and
%WAIT-ON-MUTEX, which are also used directly from CONDITION-WAIT where
appropriate.
Jim Wise [Wed, 9 Nov 2011 18:54:10 +0000 (13:54 -0500)]
Skip testl fcntl.flock.2 on NetBSD.
Not sure what's going on with this one -- getting a return status
of '0' from child process, but don't see a path through code that
will produce this. Will work on this further.
Jim Wise [Wed, 9 Nov 2011 14:18:02 +0000 (09:18 -0500)]
Adjust for NetBSD location of perl.
NetBSD does not ship with perl by default, but if it's present, it will
be in /usr/pkg/bin. Would be nice to find another portable way to do this.
Nikodemus Siivola [Wed, 9 Nov 2011 11:24:54 +0000 (13:24 +0200)]
MAP-DIRECTORY didn't :CLASSIFY-SYMLINKS by default
...even though it said it did.
Given
foo/bar => ../src/bar
src/bar/quux.asd
now
(directory "foo/*/*.asd")
finds the .asd as expected.
Jim Wise [Tue, 8 Nov 2011 19:48:21 +0000 (14:48 -0500)]
NetBSD also fails on test based on opening /dev/stdout from a script.
Add it to Darwin in platforms which skip this test.
Paul Khuong [Mon, 7 Nov 2011 19:18:38 +0000 (14:18 -0500)]
Correct address computation in atomic-incf/aref for wide fixnums
Reported by Martin Cracauer.
Fixes lp#887220.
Juho Snellman [Sun, 6 Nov 2011 20:31:00 +0000 (21:31 +0100)]
1.0.53: will be tagged as "sbcl-1.0.53"
Eric Marsden [Mon, 31 Oct 2011 12:34:39 +0000 (14:34 +0200)]
fix SEARCH vector vector transform
Didn't handle empty sequences correctly.
Didn't handle NIL as KEY correctly.
Nikodemus Siivola [Sun, 30 Oct 2011 19:51:30 +0000 (21:51 +0200)]
make DELETE-FILE respect *DEFAULT-PATHNAME-DEFAULTS*
MERGE-PATHNAMES to get an absolute pathname. (Using TRUENAME would be wrong,
since then we would delete files pointed to by symbolic links, and not the
symbolic links themselves -- a nasty regression that would be!)
Also remove the "for error checking" TRUENAME call from there: unlink will
give us an errno that tells what we need to know -- and lo! there is one
race condition less in the system.
Previously using relative pathnames it was possible to accidentally delete
the wrong file.
Fixes lp#882877.
NB: currently DELETE-DIRECTORY and RENAME-FILE use TRUENAME with just the
aforementioned unfortunate consequence, but I'm hesitant to change them
during the freeze -- so dealing with this issue in them will have to
wait a bit.
Nikodemus Siivola [Sun, 30 Oct 2011 19:51:02 +0000 (21:51 +0200)]
missing NEWS for previous commit
Robert Brown [Sun, 30 Oct 2011 11:44:33 +0000 (13:44 +0200)]
fix GENCGC DYNAMIC-USAGE on 64-bit platforms
Fixes lp#881445.
Paul Khuong [Sun, 30 Oct 2011 15:34:33 +0000 (11:34 -0400)]
Unbreak the build on SPARC
Broken in
b2d132a93 (last commit). The cross-compiler can be a tad
paranoid.
Paul Khuong [Sun, 30 Oct 2011 06:42:15 +0000 (02:42 -0400)]
Fix constant character comparisons for SPARC/sb-unicode
SPARC only supports (SIGNED-BYTE 13) for literal values. Only emit
comparison with literal characters up to (CODE-CHAR 4095).
Reported by Eric Marsden on sbcl-devel.
Fixes lp#883519.
Paul Khuong [Sun, 30 Oct 2011 06:32:41 +0000 (02:32 -0400)]
Eliminate an infinite recursion in TYPE-UNION of INTERSECTION types
Reported by Eric Marsden on sbcl-devel.
Fixes lp#883498.
Paul Khuong [Sun, 30 Oct 2011 06:02:03 +0000 (02:02 -0400)]
Take inline trampoline into account when optimizing fall-through jumps
The IR2-level optimisation bug manifests itself as randomly bogus
code in the presence of tail and local calls to the same function.
Reported by Eric Marsden on sbcl-devel.
Test case by Anton Kovalenko.
Fixes lp#883500
Nikodemus Siivola [Sat, 29 Oct 2011 18:13:07 +0000 (21:13 +0300)]
fix ROTATE-BYTE on 64-bit words using constant negative rotation
Fixes lp#882151.
Nikodemus Siivola [Tue, 16 Aug 2011 16:36:28 +0000 (19:36 +0300)]
waiting for arbitrary events SB-EXT:WAIT-FOR
While using this to wait for other threads isn't good style,
sometimes it is _much_ easier to just state the thing you're
waiting for than build the synchronization to make it nice.
And sometimes the event lives in the external world, in which case
you really need to poll anyways:
(wait-for (probe-file pathname))
Nikodemus Siivola [Tue, 23 Aug 2011 12:31:35 +0000 (15:31 +0300)]
nuke the age-old experimental-thread.patch
Not pertinent anymore.
Alastair Bridgewater [Wed, 26 Oct 2011 14:38:15 +0000 (10:38 -0400)]
Minor lowtag-handling cleanup in genesis.
* Instead of explicitly testing a lowtag against two or four
constants (with scary reader conditionals for making the decision)
to determine if a given lowtag is an other-immediate, introduce a
function, IS-OTHER-IMMEDIATE-LOWTAG, paralleling IS-FIXNUM-LOWTAG,
with commentary, operating along the same lines as a similar
function in runtime.h.
Alastair Bridgewater [Tue, 25 Oct 2011 22:43:36 +0000 (18:43 -0400)]
room: KLUDGE-reduction.
* Now that the thread structure doesn't have a lowtag, we can
remove the KLUDGE that prevented even FIXNUMs from being treated
as though they were thread-object-sized instead of a single word.
Alastair Bridgewater [Tue, 25 Oct 2011 22:39:29 +0000 (18:39 -0400)]
threads: Thread objects don't need a lowtag.
* It was a cute hack, in a way, to force the existing genesis
machinery to produce assembler symbols for thread structure slots.
But it's still a hack, and needs to die. And now it can.
Alastair Bridgewater [Tue, 25 Oct 2011 22:35:03 +0000 (18:35 -0400)]
genesis: Export assembly slot offsets for primitive-objects without lowtags.
* If a primitive-object has no lowtag, export its slot offsets
to assembly language as if it had a lowtag of zero.
* While we're here, use SYMBOL-VALUE instead of EVAL to find the
numeric value of a lowtag.
Alastair Bridgewater [Tue, 25 Oct 2011 20:43:13 +0000 (16:43 -0400)]
Fix MAYBE-WITH-PINNED-OBJECTS for PPC/GENCGC.
* GENCGC has working WITH-PINNED-OBJECTS on all targets, not
just x86oids. Not using it when necessary is bad, especially
since non-x86oids don't automatically pin references from the
control stack. Fixed.
Alastair Bridgewater [Tue, 25 Oct 2011 14:25:25 +0000 (10:25 -0400)]
Fix unhandled error in float.pure.lisp on non-x86oids.
* SB-VM::TOUCH-OBJECT doesn't exist on non-x86oids, and the
package is locked. Disable reading of forms that refer to it
on non-x86oids.
Alastair Bridgewater [Tue, 25 Oct 2011 14:13:58 +0000 (10:13 -0400)]
Fix debug.impure.lisp / BUG-310175 for :stack-allocatable-lists targets.
* Not all platforms stack-allocate. Some platforms (PPC) stack-
allocate some things, but not most things.
* PPC, in particular, stack allocates for LIST and LIST* (the
:stack-allocatable-lists feature), but doesn't stack allocate for
CONS. And it turns out that the compiler transforms one-arg-LIST
and two-arg-LIST* to CONS.
* Use two-arg-LIST to force the :stack-allocatable-lists code
path, and mark the test as failing on non-:stack-allocatable-lists
targets.
Alastair Bridgewater [Mon, 24 Oct 2011 22:02:50 +0000 (18:02 -0400)]
Fix fixnum and unsigned-fixnum array cleanups.
*
dd04bd449535e9016b5652a708a3cac2ca24c87d removes the specialized
array types with specific fixnum widths in favor of more generic
fixnum and unsigned-fixnum array types.
* In SYS:SRC;CODE;ROOM.LISP, a mistake was made in converting over
to the newer representations, involving an alist of type tag names
to a constant related to the size of array elements. The mistake
was even made inconsistently, so that neither 32-bit nor 64-bit
targets behaved correctly.
* Fixed, to use sb!vm:word-shift instead of literal constants.
* Original report and bisection by akovalenko on #sbcl.
Alastair Bridgewater [Mon, 24 Oct 2011 19:25:11 +0000 (15:25 -0400)]
Fix FP traps on OSX/x86.
* De-cripple SB-INT:SET-FLOATING-POINT-MODES for this platform.
* Enable restoring the FPU control word during interrupt handling
on this platform (RESTORE_FP_CONTROL_FROM_CONTEXT).
* Implement restoring the FPU control word on this platform
(os_restore_fp_control).
* Update :FAILS-ON information for the now-passing tests.
* Update the commentary on test float.pure.lisp /
(ADDITION-OVERFLOW BUG-372) to more accurately reflect when it will
provide useful data (only when running float.pure.lisp separately).
Alastair Bridgewater [Mon, 24 Oct 2011 18:30:32 +0000 (14:30 -0400)]
Fix x86oid OSX signal handling emulation assembly fragments.
* Both x86 and x86-64 signal_emulation_wrapper include a small
assembly fragment to simulate "sigreturn" by means of an invalid
instruction trap. This fragment has to load two different pointers
into specific registers before the trap, but historically just told
the compiler to load them into registers and then moved them into
the correct registers, leading to the possibility of clobbering one
of the values. Fixed, by informing the compiler to place them into
the correct registers to begin with.
Alastair Bridgewater [Mon, 24 Oct 2011 02:36:24 +0000 (22:36 -0400)]
Fix FP traps on OSX/x86-64.
* De-cripple SB-INT:SET-FLOATING-POINT-MODES for this platform.
* Enable restoring the FPU control word during interrupt handling
on this platform (RESTORE_FP_CONTROL_FROM_CONTEXT).
* Implement restoring the FPU control word on this platform
(os_restore_fp_control).
* Update :FAILS-ON information for the now-passing tests.
* Insert an addtional copy of test float.pure.lisp /
(ADDITION-OVERFLOW BUG-372) to detect failure to restore the FPU
control word in signal handling, with appropriate commentary.
Jim Wise [Mon, 24 Oct 2011 13:38:25 +0000 (09:38 -0400)]
Fix HEAD ref lookups, and compatibility for non-bash shells.
Jim Wise [Mon, 10 Oct 2011 14:17:08 +0000 (10:17 -0400)]
Update to work with non-bash versions of expr.
Alastair Bridgewater [Sat, 22 Oct 2011 21:10:38 +0000 (17:10 -0400)]
Clean up build process for cross-compiled targets.
* Over time, the process for producing an SBCL build for another
target architecture or OS has become more difficult and less
documented.
* Move all make.sh argument processing to make-config.sh.
* Have make-config.sh produce a file, output/build-config,
containing shell commands to set up important build parameters
such as where to find GNUMAKE, what SBCL_XC_HOST is, and so on.
* Source output/build-config in most of the make*.sh scripts.
* The practical upshot of all this is that a cross-compile
build is now a matter of alternating between target and host,
calling make-config.sh, make-host-1.sh, make-target-1.sh,
make-host-2.sh, make-target-2.sh, and following up with a
make-target-contrib.sh on the target, and you wind up with a
usable product. And, as make-config.sh does all of the arg
parsing, you can pass --xc-host= or --dynamic-space-size= or
whatever and it all works out.
Alastair Bridgewater [Thu, 24 Jun 2010 00:24:16 +0000 (20:24 -0400)]
Unwind-to-frame-and-call-VOP doesn't need static symbols.
* The UNWIND procedure takes as parameters a target block and an
unknown-values start/count pair. The old implementation was passing
the block, a zero count, and a garbage start. Pass the function to
call as the start, instead of storing it as a static symbol value as
is done now or reserving an extra stack slot somewhere relative to
the unwind block.
* Delete the static symbol formerly used for this.
* This has been done for both x86 and x86-64.
Paul Khuong [Sat, 22 Oct 2011 01:38:00 +0000 (21:38 -0400)]
Fix a long-standing bug in (PRIMITIVE-TYPE [MEMBER type])
A refactoring in 1.0.12.18 resulted in overly-optimistic primitive
type.
Reported by Eric Marsden on sbcl-devel.
Paul Khuong [Sat, 22 Oct 2011 01:02:17 +0000 (21:02 -0400)]
Fix another assumption w.r.t fixnum width and n-lowtag-bits
This time in LOGBITP.
Reported by Eric Marsden on sbcl-devel.
Alastair Bridgewater [Fri, 1 Apr 2011 01:02:22 +0000 (21:02 -0400)]
describe: Better description for complex setf-expanders.
* Rather than simply reporting the documentation string (if any), also
report the lambda-list of the expansion function and the associated
source location.
Alastair Bridgewater [Fri, 1 Apr 2011 00:58:14 +0000 (20:58 -0400)]
setf: Record the original lambda-list for complex setf-expander functions.
* Added an extra parameter to ASSIGN-SETF-MACRO for the lambda-list.
* In ASSIGN-SETF-MACRO, when working with an EXPANDER (as opposed to
an INVERSE), set the %FUN-LAMBDA-LIST of the EXPANDER to the value
passed as the new parameter.
* In all call sites for ASSIGN-SETF-MACRO (two uses in DEFSETF, one in
DEFINE-SETF-EXPANDER), pass the new lambda-list parameter appropriately.
Alastair Bridgewater [Thu, 31 Mar 2011 20:07:19 +0000 (16:07 -0400)]
setf: excise GET-SETF-METHOD and related detritus.
* GET-SETF-METHOD is the CLtL1 version of GET-SETF-EXPANSION, and is
neither used in SBCL nor exported from any package. Kill it.
* Also kill the DEFKNOWN in the compiler for a (different)
GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE (also a CLtL1
function, neither used nor implemented in SBCL).
Alastair Bridgewater [Thu, 31 Mar 2011 20:00:48 +0000 (16:00 -0400)]
setf: pre-defined setf-expanders should handle multiple value places gracefully.
* The GETF, LOGBITP, LDB and MASK-FIELD setf-expanders all take a
PLACE argument, the setf-expansion for which was being obtained via
GET-SETF-METHOD, which is the CLtL1 version of GET-SETF-EXPANSION, but
throws an error if a PLACE multiple values. This also pre-dates the
adoption of VALUES places.
* The most reasonable interpretation of the spec appears to be that
any values after the first are to be ignored upon reading and set to NIL
upon writing.
* To do so, change each use to SB!XC:GET-SETF-EXPANSION instead of
GET-SETF-METHOD, and bind any symbols in the list of new value locations
to NIL before invoking the setter form.
Alastair Bridgewater [Thu, 31 Mar 2011 19:33:40 +0000 (15:33 -0400)]
setf: read-modify-write macros should deal with multi-value places gracefully.
* In PUSH, PUSHNEW, POP, REMF, INCF, DECF and DEFINE-MODIFY-MACRO the
setf-expansion was being obtained via GET-SETF-METHOD, which is the
CLtL1 version of GET-SETF-EXPANSION, but throws an error if a PLACE has
multiple values. This also pre-dates the adoption of VALUES places.
* The most reasonable interpretation of the spec appears to be that
any values after the first are to be ignored upon reading and set to NIL
upon writing.
* To do so, change each use to SB!XC:GET-SETF-EXPANSION instead
of GET-SETF-METHOD, and bind any symbols in the list of new value
locations to NIL before invoking the setter form.
Alastair Bridgewater [Thu, 31 Mar 2011 19:28:48 +0000 (15:28 -0400)]
setf: Don't use DO to "zip up" temporaries in read-modify-write macros.
* Alter POP, REMF and DEFINE-MODIFY-MACRO to use (MAPCAR #'LIST
DUMMIES VALS) when building LET*-bindings instead of some crazy DO loop
involving PUSH and NREVERSE.
* While we're here, introduce a new temporary in POP rather than
destructively modify a binding.
Alastair Bridgewater [Fri, 21 Oct 2011 16:06:01 +0000 (12:06 -0400)]
Fix build on x86-64/darwin.
* It turns out that darwin preprocesses assembly files slightly
differently from every other platform. Possibly something related
to the rather VMSish -fdollars-in-identifiers option to gcc.
* Use parens to break the preprocessor "macro" we're trying to
use away from the dollar-sign literal-constant marker it's getting
merged with.
* Reported by nikodemus in #sbcl.
Alastair Bridgewater [Sun, 9 Oct 2011 21:06:28 +0000 (17:06 -0400)]
More unboxed-byte-addresses-are-word-addresses damage.
* In the binding stack tests, the binding stack pointer is altered
by adding two to SB-VM::*BINDING-STACK-POINTER*. This "works" when
n-fixnum-tag-bits is equal to word-shift, but is badly wrong when
they differ.
* Fixed by adding a variable to hold the actual delta required,
based on the difference between n-fixnum-tag-bits and word-shift.
* Incidentally, how on earth does this test work on threaded PPC?
PPC has the BSP in a register, not a variable, and there are no
memory barriers around the synchronization for GCs. How does the
(incf sb-vm::*binding-stack-pointer*) not die from an unbound
symbol? And, really, it looks like it doesn't matter if a thread
dies or lands in the debugger: If the process doesn't die screaming,
the test always passes, even if it only does a single GC.
* And, while we're on the topic, how on earth does this test work
on x86? The memory-barrier argument should apply there as well.
Wait, I know! The CPU still gets timer interrupts, and the kernel
effectively provides a barrier then. And the "it doesn't matter"
argument also applies here: If it doesn't deadlock the system
completely, the main thread will kill everything off and call it a
success after four seconds anyway.
Alastair Bridgewater [Sun, 14 Feb 2010 15:56:01 +0000 (10:56 -0500)]
63-bit fixnums on 64-bit targets.
* This is mostly just a matter of spreading the PADn lowtags around,
one or two cases of adjusting a constant, and some KLUDGEing around in
the runtime to make everything work for 1 <= n-fixnum-tag-bits <= 3.
* Yes, this means that you can change n-fixnum-tag-bits before
building in order to return to a 61-bit fixnum world. Or you can have
62-bit fixnums if you want.
Alastair Bridgewater [Mon, 30 Nov 2009 23:09:03 +0000 (18:09 -0500)]
Reorder 64-bit lowtags.
* Move 64-bit lowtags around so that all non-fixnum tags have the low
bit set.
* Fix up print_obj() to compensate for the layout change.
* Fix up is_lisp_pointer() to compensate for the layout change.
* Change other_immediate_lowtag_p() to take advantage of the
distribution of other-immediate lowtags.
Alastair Bridgewater [Wed, 2 Dec 2009 22:18:55 +0000 (17:18 -0500)]
x86-64 disentwingling of fixnums and words.
* This is mostly constant fixups and supplying scaling factors in
places.
* Where possible, I have used constructs that will simply generate the
correct code no matter what the width of a fixnum is. In other places,
I have used an explicit check for the historic case and provided and
alternate code sequence for when it no longer applies.
* Thanks to Paul Khuong for helping with the finding and fixing of
many of these places.
Alastair Bridgewater [Sun, 14 Feb 2010 16:30:50 +0000 (11:30 -0500)]
General disentwingling of fixnums and words.
* Historically, n-fixnum-tag-bits has been equal to word-shift and has
been (1- n-lowtag-bits). This led to implementors using constants and
calculations which happened to be right by coincidence rather than by
design.
* Fix all places not part of the support for a particular backend to
use the defined-correct constants and calculations for the operations
being performed.
* Thanks to Paul Khuong for helping with the finding and fixing of
many of these coincidences.
Alastair Bridgewater [Mon, 28 Dec 2009 16:40:24 +0000 (11:40 -0500)]
Improve some test cases for fixnum-width independence
* In arith.pure.lisp, some test cases were defined in terms of
n-lowtag-bits instead of n-fixnum-tag-bits.
* In sb-aclrepl, the bignum used for testing fit within an
(signed-byte 63), the largest possible fixnum type on a 64-bit system.
* Thanks to Paul Khuong for finding and fixing the arith.pure.lisp
tests.
Alastair Bridgewater [Sat, 20 Feb 2010 23:43:13 +0000 (18:43 -0500)]
Fixnum and unsigned-fixnum array cleanups.
* Rename {arraytype}-{elementtype1} to {arraytype}-{elementtype2} for
{arraytype} in (SIMPLE-ARRAY VECTOR), {elementtype1} in
(UNSIGNED-BYTE-29 UNSIGNED-BYTE-60 SIGNED-BYTE-30 SIGNED-BYTE-61) and
{elementtype2} in (UNSIGNED-FIXNUM SIGNED-FIXNUM) across the board
(predicates, tag names, etc.).
* Cleanup of related conditional compilation.
* Export n-fixnum-bits (the remaining fixnum representation constant)
from sb!vm instead of having it as an internal symbol of sb!pcl.
* Original patch by Paul Khuong.
Alastair Bridgewater [Sun, 27 Dec 2009 16:53:45 +0000 (11:53 -0500)]
Change x86oid modular arithmetic to work if fixnum width changes.
* This is largely (signed-byte {30,61}) => fixnum and smod{30,61} =>
modfx.
* Thanks to Paul Khuong for the initial patch.
Alastair Bridgewater [Sun, 14 Feb 2010 21:29:08 +0000 (16:29 -0500)]
Fix definition of most-FOOative-fixnum.
* Define in terms of n-positive-fixnum-bits, not some relation between
n-word-bits and n-lowtag-bits.
Alastair Bridgewater [Sun, 14 Feb 2010 15:39:18 +0000 (10:39 -0500)]
Introduce sb!vm::fixnum-lowtags
* This is defined as a list of the exported SB!VM -LOWTAG symbols
bound to integers that are zero when masked with fixnum-tag-mask (in
short, the names of the fixnum lowtags).
* Replace all direct references to the fixnum lowtags with something
based on fixnum-lowtags.
* Introduce the corresponding change to genesis, with the predicate
is-fixnum-lowtag instead of testing against specific lowtags.
* Introduce the corresponding change to the runtime, making fixnump()
check against fixnum-tag-mask instead of comparing individual fixnum
tags.
* And, while we're redefining fixnump() in terms of the significant
part of the lowtag, do the same with other_immediate_lowtag_p().
Alastair Bridgewater [Wed, 23 Dec 2009 13:35:11 +0000 (08:35 -0500)]
Clean up all use of the *-space-free-pointers.
* These are symbols whose value slots contain unboxed word-aligned
byte pointers. Thus, they appear to lisp as fixnums. They are not,
however, guaranteed to be word pointers.
* Shift by n-fixnum-tag-bits instead of shifting by word-shift or
scaling by n-word-bytes in order to obtain byte pointers.
Alastair Bridgewater [Mon, 28 Dec 2009 21:31:02 +0000 (16:31 -0500)]
Redefine symbol TLS slot indices.
* Instead of having symbol TLS slots be fixnum indices treat them as
byte offsets from the base of the thread structure.
* This has no effect on the compiler or backends.
* TLS slot allocation must now be done in terms of words, not fixnums.
* In %{set-,}symbol-value-in-thread, use get-lisp-obj-address instead
of scaling the TLS index.
* Use explicit WORD_SHIFT instead of make_fixnum() / fixnum_value() in
the runtime.
Alastair Bridgewater [Sat, 20 Feb 2010 23:40:50 +0000 (18:40 -0500)]
Improved GC lossage
* Change size_lose() and scav_lose() to indicate the widetag of the
header of the losing object rather than of the pointer to the losing
object.
* Patch from Paul Khuong.
Stas Boukarev [Tue, 11 Oct 2011 20:20:31 +0000 (00:20 +0400)]
(format t "a~0&b") shouldn't print any newlines.
Fixes lp#867684.
Juho Snellman [Sun, 9 Oct 2011 02:21:04 +0000 (04:21 +0200)]
1.0.52: will be tagged as "sbcl-1.0.52"