sbcl.git
10 years agoReduce consing during SUBTYPEP on classes.
Stas Boukarev [Sat, 26 Oct 2013 14:42:22 +0000 (18:42 +0400)]
Reduce consing during SUBTYPEP on classes.

sb-pcl::class-has-a-forward-referenced-superclass-p, used in the
implementation of subtypep on classes, conses because SOME can't
perform the required inlining when used on the sequences of unknown
type. (See lp#1070635)

10 years agoUse new MAP-RESTARTS in FIND-RESTART, COMPUTE-RESTARTS; fix FIND-RESTART
Jan Moringen [Fri, 20 Sep 2013 20:49:11 +0000 (22:49 +0200)]
Use new MAP-RESTARTS in FIND-RESTART, COMPUTE-RESTARTS; fix FIND-RESTART

* Both FIND-RESTART and COMPUTE-RESTARTS traverse, filter and select
  active restarts, potentially for a particular condition and
  potentially calling restart test functions. This common behavior has
  been factored into the new function MAP-RESTARTS.

* Remove *CONDITION-RESTARTS*; use new slot ASSOCIATED-CONDITIONS in
  RESTART structure instead.

* As stated in bug 774410, when given a RESTART instance, FIND-RESTART
  did not test whether the restart was still active and whether the
  restart had been associated to a different condition in the
  meantime. This behavior has been changed by calling MAP-RESTARTS which
  checks activity and association to conditions (sadly, making

    (find-restart RESTART-INSTANCE CONDITION-OBJECT)

  a bit slower than before).

* INVOKE-RESTART is also affected by the changes for bug
  774410. However, it does not respect restart test functions when
  called with a RESTART instance (This is underspecified in CLHS and
  other implementations behave in various ways. However, behaving
  differently would make some restarts un-invokable).

* As suggested in bug 769615, (find-restart SYMBOL ...) now calls
  MAP-RESTARTS instead of COMPUTE-RESTARTS, consing less and executing
  faster in many cases.

* New (find-restart :recheck-conditions-and-tests :bug-774410) test from
  Jean-Philippe Paradis from original bug report in
  tests/condition.impure.lisp checks the new behavior.

Fixes lp#769615, lp#774410

10 years agoMake some RESTART slots read-only
Jan Moringen [Fri, 20 Sep 2013 20:19:30 +0000 (22:19 +0200)]
Make some RESTART slots read-only

The RESTART slots FUNCTION, REPORT-FUNCTION, INTERACTIVE-FUNCTION and
TEST-FUNCTION are never mutated and can thus be read-only.

10 years agoComments and rearrangements in {defboot,target-error}.lisp
Jan Moringen [Fri, 20 Sep 2013 20:15:53 +0000 (22:15 +0200)]
Comments and rearrangements in {defboot,target-error}.lisp

Add and/or extend explanatory comments for the special
variables *HANDLER-CLUSTERS*, *RESTART-CLUSTERS*
and *CONDITION-RESTARTS*.

Slightly rearranged RESTART-NAME and RESTART-REPORT.

10 years agoSilence some unused variable warnings in tests/condition.[im]pure.lisp
Jan Moringen [Sat, 23 Mar 2013 12:04:35 +0000 (13:04 +0100)]
Silence some unused variable warnings in tests/condition.[im]pure.lisp

10 years agofix symlink handling (generally and on OS X) in run-sbcl.sh
Christophe Rhodes [Mon, 21 Oct 2013 11:41:35 +0000 (12:41 +0100)]
fix symlink handling (generally and on OS X) in run-sbcl.sh

Patch from Stelian Ionescu, lp#1242643

10 years agosignal errors for bad initialization of slot definitions
Christophe Rhodes [Mon, 21 Oct 2013 11:15:04 +0000 (12:15 +0100)]
signal errors for bad initialization of slot definitions

In order to get slot definition initialization right, move the
readers/writers slots to direct slot definitions, and write code to
detect all the bad cases documented in the MOP dictionary at
initialization time.  Condition slots also need changing, to have
separate initform and initfunction information.  Moving the slots
breaks metacircle resolution, naturally, so rewrite that to find the
relevant reader/writer information from the direct slots at runtime.
The irony of having to rewrite metacircle detection and resolution for
a bug tagged "easy" on launchpad is not lost on me.

Originally reported by Bruno Haible at some point in prehistory,
probably around December 2004, lp#309072.

10 years agoWarn when wrapping constants with THE of multiple value types
Paul Khuong [Sat, 19 Oct 2013 21:47:47 +0000 (17:47 -0400)]
Warn when wrapping constants with THE of multiple value types

IR1 translation was too eager in eliminating redundant THE forms
when the value is a constant.  We now also make sure that the
asserted type accepts single values.

Reported by Nathan Trapuzzano on sbcl-help.

10 years agoRemove duplicate implementations of (setf aref/sbit/bit).
Stas Boukarev [Fri, 18 Oct 2013 11:18:36 +0000 (15:18 +0400)]
Remove duplicate implementations of (setf aref/sbit/bit).

Since (setf aref/sbit/bit) have to work with
(setf (apply #'aref array subscripts)), they had both a setf expander
and a setf-function, but it can be implemented with just a
setf-function. All other accessors are still done using
(defsetf accessor %setaccessor), I haven't found a technical reason to
prefer one to another, other than (setf accessor) being a nicer name.

Fixes lp#1241095.

10 years agoAdd some missing FNDB declarations.
Stas Boukarev [Thu, 17 Oct 2013 16:53:18 +0000 (20:53 +0400)]
Add some missing FNDB declarations.

10 years agoStop (describe (make-instance 'generic-function)) from crashing.
Stas Boukarev [Thu, 17 Oct 2013 15:16:41 +0000 (19:16 +0400)]
Stop (describe (make-instance 'generic-function)) from crashing.

All the describy things can be pried out of a generic function only if
it's a standard-generic-function.
Also add an FNDB entry for FUNCTION-LAMBDA-EXPRESSION.

10 years agofunction-lambda-expression: Return the name of a generic function.
Stas Boukarev [Thu, 17 Oct 2013 15:05:29 +0000 (19:05 +0400)]
function-lambda-expression: Return the name of a generic function.

The third value of
(function-lambda-expression (defgeneric foo ()))
is now FOO, and not
(LAMBDA (&REST SB-PCL::ARGS) :IN SB-PCL::MAKE-INITIAL-DFUN)
Reported by Marco Baringer.

10 years agotests: don't require ASDF.
Stas Boukarev [Thu, 17 Oct 2013 07:50:23 +0000 (11:50 +0400)]
tests: don't require ASDF.

With the new scheme, ASDF is not needed at all to load contribs, but
even in the past the contribs which needed it would have loaded it
automatically.

10 years agoFix where tests are trying to find contribs.
Stas Boukarev [Thu, 17 Oct 2013 07:33:26 +0000 (11:33 +0400)]
Fix where tests are trying to find contribs.

10 years agoFix release-related things
Juho Snellman [Thu, 17 Oct 2013 02:56:46 +0000 (04:56 +0200)]
Fix release-related things

contrib changes need to be reflected in binary-distribution.sh
and documentation building too.

10 years agoDeliver each contrib as a single FASL. Don't implicitly require ASDF or source code...
Francois-Rene Rideau [Sat, 23 Feb 2013 12:52:39 +0000 (07:52 -0500)]
Deliver each contrib as a single FASL. Don't implicitly require ASDF or source code at runtime.

Also, move contrib output to obj/sbcl-home/, asdf cache to obj/asdf-cache/
Update sb-grovel and other contribs and their tests for asdf3.

Fixes lp#1132254.

10 years agorun-program: Improve argument escaping on WIN32.
Stas Boukarev [Wed, 16 Oct 2013 16:36:22 +0000 (20:36 +0400)]
run-program: Improve argument escaping on WIN32.

The rules of how #\\ should be escaped depend on whether it's followed
by #\" or not.

Fixes lp#1239242.

10 years agorun-program: Add support for :environment on WIN32.
Stas Boukarev [Wed, 16 Oct 2013 13:25:58 +0000 (17:25 +0400)]
run-program: Add support for :environment on WIN32.

10 years agoDisable some sb-concurrency tests on win32.
Stas Boukarev [Wed, 16 Oct 2013 13:10:37 +0000 (17:10 +0400)]
Disable some sb-concurrency tests on win32.

Some mailbox tests are hanging stopping from building other contribs.

10 years agosb-bsd-sockets: Rearrange how get-host-by-name/address are defined.
Stas Boukarev [Wed, 16 Oct 2013 10:36:34 +0000 (14:36 +0400)]
sb-bsd-sockets: Rearrange how get-host-by-name/address are defined.
#+/-sb-bsd-sockets-addrinfo have different definitions of
get-host-by-name and get-host-by-address. Instead of having
(defun get-host-by-name ()
  #+sb-bsd-sockets-addrinfo (call-getaddrinfo-flavour)
  #-sb-bsd-sockets-addrinfo
  (implementaiton-using gethostbyname))

define
#+sb-bsd-sockets-addrinfo
(defun get-host-by-name ()
  (implementaiton-using getaddrinfo))

#-sb-bsd-sockets-addrinfo
(defun get-host-by-name ()
  (implementaiton-using gethostbyname))

10 years agosb-introspect:find-definition-sources-by-name: support globals.
Stas Boukarev [Tue, 15 Oct 2013 14:29:02 +0000 (18:29 +0400)]
sb-introspect:find-definition-sources-by-name: support globals.

(sb-ext:defglobal x ...) couldn't be found.

10 years agoFor consistency with other shell scripts here, use #!/bin/sh.
Jim Wise [Sun, 13 Oct 2013 21:23:38 +0000 (17:23 -0400)]
For consistency with other shell scripts here, use #!/bin/sh.

This (alone) used #!/bin/bash, but does not seem to depend on it.

10 years agoFix on Solaris by accounting for /bin/sh there.
Jim Wise [Sun, 13 Oct 2013 21:22:19 +0000 (17:22 -0400)]
Fix on Solaris by accounting for /bin/sh there.

Solaris' /bin/sh does not grok $(...), so use `...` instead.

Note that all recent versions of Solaris have included /bin/bash, but
I'm not sure the impact of using #!/bin/bash instead of #!/bin/sh on
some of our other platforms.

10 years agoFix (compile '(setf function)).
Stas Boukarev [Sun, 13 Oct 2013 17:04:30 +0000 (21:04 +0400)]
Fix (compile '(setf function)).

COMPILE was defined as
(name &optional (definition (or (macro-function name) (fdefinition name))))

The call to macro-function caused an error when called on '(setf x).
Change it to
(or (and (symbolp name) (macro-function name))
    (fdefinition name))

Reported by Douglas Katzman.

10 years agoFix another regression in dumping specialized vectors.
Stas Boukarev [Sat, 12 Oct 2013 17:45:49 +0000 (21:45 +0400)]
Fix another regression in dumping specialized vectors.

It should read "CEILING", not "*".

Reported by Jan Moringen.

10 years agodon't consider an interpreted->compiled function change interesting
Christophe Rhodes [Wed, 9 Oct 2013 20:41:10 +0000 (21:41 +0100)]
don't consider an interpreted->compiled function change interesting

fix from Douglas Katzman, lp#1042405

10 years agohexstr / cold-print fixes from Douglas Katzman
Christophe Rhodes [Mon, 7 Oct 2013 12:33:48 +0000 (13:33 +0100)]
hexstr / cold-print fixes from Douglas Katzman

10 years agoPrevent personality setting on Linux from going in circles.
Stas Boukarev [Sat, 5 Oct 2013 16:59:22 +0000 (20:59 +0400)]
Prevent personality setting on Linux from going in circles.

Apparently, setuid causes ADDR_NO_RANDOMIZE to be stripped away.
Stop restarting SBCL itself indefinitely by adding an
SBCL_IS_RESTARTING environment variable and consulting it before
trying to restart again.
Reported by Teemu Likonen.

10 years agoAdd a test-case for the previous commit.
Stas Boukarev [Thu, 3 Oct 2013 18:55:18 +0000 (22:55 +0400)]
Add a test-case for the previous commit.

10 years agoForward referenced classoid-cells can now be loaded from FASLs.
Stas Boukarev [Thu, 3 Oct 2013 16:28:05 +0000 (20:28 +0400)]
Forward referenced classoid-cells can now be loaded from FASLs.

When
(defun x (x)
  (typep x 'bar))

(defclass bar ()
  ())

is compiled twice, the typecheck is optimized and a classoid-cell is
dumped into the FASL, but upon load in a new instance it's
reconstructed using FIND-CLASSOID-CELL with :errorp t, resulting in an
error, defeating the stated reason for indirection.

Fixes lp#746132.

10 years agomake-values-type-cached: Hardcode values of (sxhash t/nil)).
stas [Thu, 3 Oct 2013 13:52:46 +0000 (17:52 +0400)]
make-values-type-cached: Hardcode values of (sxhash t/nil)).

To avoid relying on the xc host.

10 years agoOptimize the compiler a bit.
Stas Boukarev [Thu, 3 Oct 2013 00:13:03 +0000 (04:13 +0400)]
Optimize the compiler a bit.

Optimize make-values-type-cached by adding a declaration or two.
Building SBCL sans contribs goes from 1:52 to 1:39.

10 years agoOptimize sb-bsd-sockets::(get-host-by-name get-host-by-address).
Stas Boukarev [Tue, 1 Oct 2013 23:10:21 +0000 (03:10 +0400)]
Optimize sb-bsd-sockets::(get-host-by-name get-host-by-address).

Add declarations to reduce SAP consing.

10 years agoBetter error when calling an undefined alien function on x86-64.
Stas Boukarev [Tue, 1 Oct 2013 17:03:00 +0000 (21:03 +0400)]
Better error when calling an undefined alien function on x86-64.

(sb-alien:alien-funcall
 (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.

10 years agoOptimize RETURN-MULTIPLE on x86-64.
Stas Boukarev [Tue, 1 Oct 2013 16:17:00 +0000 (20:17 +0400)]
Optimize RETURN-MULTIPLE on x86-64.

Replace REP MOVS with simple instructions.

RETURN-MULTIPLE is used to copy the multiple value down the stack.
The following code becomes around 5 times faster on a modern CPU,
passing more values is faster as well, but not by as much.

(defun m ()
  (declare (optimize speed (safety 0)))
  (values 1 2 3 4))

(defun b ()
  (declare (optimize speed (safety 0)))
  (let (*)
    (m)))

10 years agoFix is_linkage_table_addr in win32-os.c
Stas Boukarev [Mon, 30 Sep 2013 22:27:23 +0000 (02:27 +0400)]
Fix is_linkage_table_addr in win32-os.c

The aptly misnamed function in_range_p doesn't actually take START and
END of the range as arguments, but START and SIZE.
change
in_range_p(addr, LINKAGE_TABLE_SPACE_START, LINKAGE_TABLE_SPACE_END)
to
in_range_p(addr, LINKAGE_TABLE_SPACE_START, LINKAGE_TABLE_SPACE_SIZE)

10 years agoalter ftype declarations in genesis.lisp
Christophe Rhodes [Mon, 30 Sep 2013 16:03:10 +0000 (17:03 +0100)]
alter ftype declarations in genesis.lisp

change (or descriptor symbol) to (or symbol descriptor) to work
around a CCL bug regarding type test elision.

10 years agoimprove SXHASH on fixnums
Christophe Rhodes [Mon, 30 Sep 2013 14:46:26 +0000 (15:46 +0100)]
improve SXHASH on fixnums

Remove one redundant LOGAND; also, use the whole of the fixnum
range on 64-bit platforms.

10 years agobetter SB-INT:MIX
Christophe Rhodes [Mon, 30 Sep 2013 14:43:59 +0000 (15:43 +0100)]
better SB-INT:MIX

Use a large prime multiplier rather than 3 in the linear mix.  Potentially
slower, particularly on x86 without :pentium4 where it might get implemented
as a large bunch of LEAs, but better output.

10 years ago1.1.12: will be tagged as "sbcl-1.1.12"
Christophe Rhodes [Mon, 30 Sep 2013 13:15:36 +0000 (14:15 +0100)]
1.1.12: will be tagged as "sbcl-1.1.12"

10 years agowindows: fix sb-bsd-sockets build by adding shutdown() support
Nikodemus Siivola [Thu, 26 Sep 2013 08:40:45 +0000 (11:40 +0300)]
windows: fix sb-bsd-sockets build by adding shutdown() support

10 years agoRestore win32 build.
Stas Boukarev [Wed, 25 Sep 2013 19:42:34 +0000 (23:42 +0400)]
Restore win32 build.

The changes to special binding made binding space to contain
tls-indexes instead of symbols, but on windows WITH-TLS-EA macro
causes the tls-index to be an absolute address, storing which caused
problems when UNBIND performed its own address resolution.

Reported by Elliot Slaughter.

10 years agoFix OPEN with :io and :if-does-not-exist nil.
Stas Boukarev [Tue, 24 Sep 2013 18:04:59 +0000 (22:04 +0400)]
Fix OPEN with :io and :if-does-not-exist nil.

No need to call unix-stat, truename is already bound to the result of
PROBE-FILE.

Reported by Eric Marsden.

10 years agoADJOIN shouldn't constant fold.
Stas Boukarev [Mon, 23 Sep 2013 17:25:51 +0000 (21:25 +0400)]
ADJOIN shouldn't constant fold.

ADJOIN creates new lists, so it shouldn't be constant folded. The
problem materialized when more %adjoin-* helper functions received an
fndb entry with foldable attribute copied, causing more cases to be
folded.

Reported by Eric Marsden.

10 years agoTest for broken copy-more-arg harder
Paul Khuong [Sun, 22 Sep 2013 01:05:14 +0000 (21:05 -0400)]
Test for broken copy-more-arg harder

* It takes 17 fixed arguments for (threaded) PPC to fail.  Test
  for up to 33 arguments now.

* Also, add some comments to explain why SP shouldn't be set to its
  final value eagerly when the stack frame is smaller than the fixed
  arguments: accessing slots past SP is a bad idea when interrupts
  could hit and overwrite these values.  In such cases, leave SP
  pointing to the end of the source vector, and only move it back to
  the end of the destination vector after the copy loop.

10 years agoSmaller initial stack frame size on x86oids
Paul Khuong [Sat, 21 Sep 2013 22:34:30 +0000 (18:34 -0400)]
Smaller initial stack frame size on x86oids

Now that copy-more-arg is fixed, stack frames can be initialised
at 3 slots (some raw constants in the codegen seems to depend on
each frame spanning at least that many slot).

10 years agoFix copy-more-arg on x86 and x86-64
Paul Khuong [Sat, 21 Sep 2013 19:11:49 +0000 (15:11 -0400)]
Fix copy-more-arg on x86 and x86-64

Parsing of non-fixed (&optional, &key and &rest) arguments used to
fail when there were more fixed arguments than slots in the stack
frame. Fix this on x86oids by copying non-fixed arguments in the
correct direction, depending on whether there are more fixed args
or stack frame slots.

This bug is more visible on x86oids since 3b98d3 (Smaller stack
frames on x86oids), but may still plague other platforms.  These
platforms still have larger initial stack frame size (8 slots), so
the issue remains as hard to trigger as it's been for more than a
decade.

Reported by Jan Moringen, and reduced by Stas Boukarev.

Also add a test, marked as failing on !x86oids.

10 years agoFix a regression in binding specials.
Stas Boukarev [Sat, 21 Sep 2013 22:35:47 +0000 (02:35 +0400)]
Fix a regression in binding specials.

Got two lines mixed up, where order is important.

Caught by Paul Khuong.

10 years agoOptimize special variable binding on sb-thread.
Stas Boukarev [Thu, 19 Sep 2013 19:30:09 +0000 (23:30 +0400)]
Optimize special variable binding on sb-thread.

Remove a level of indirection when unbinding special bindings, instead
of saving a symbol on the binding stack, and then accessing its
tls-index to unbind it, save the tls-index directly, saving one memory
read.

10 years agoFix loading specialized vectors from fasls.
Stas Boukarev [Thu, 19 Sep 2013 02:24:25 +0000 (06:24 +0400)]
Fix loading specialized vectors from fasls.

Previously vectors were dumped and loaded based on the hand crafted
typecase forms, which was quite fragile.
After the dumping part was rewritten to consult
sb-vm:*specialized-array-element-type-properties*, the loading part
broke down.
Change the way it's done altogether, simplifying things significantly.
Instead of having separate FOPs for signed and unsigned vectors,
writing bit size of elements, just dump the widetag and use just a
single FOP, fop-spec-vector. Floating point dumping routines now use
fop-spec-vector too.

10 years agorewrite DUMP-I-VECTOR
Christophe Rhodes [Wed, 18 Sep 2013 10:20:58 +0000 (11:20 +0100)]
rewrite DUMP-I-VECTOR

Simple, easy-to-understand cross-compiler version with limited
functionality; target version generated from sb-vm:*S-A-E-T-P*
so stands some chance of being correct.

Problem in previous version noted by Douglas Katzman (report
sbcl-devel 2013-09-16)

10 years agoRemove a level of indirection in *linkage-info*.
Stas Boukarev [Mon, 16 Sep 2013 19:56:40 +0000 (23:56 +0400)]
Remove a level of indirection in *linkage-info*.

Don't store the address in a linkage-info structure, only the linkage-info-address
slot was ever used. Store the address directly.

10 years agoRestore building of +sb-unicode with -sb-unicode.
Stas Boukarev [Mon, 16 Sep 2013 19:53:30 +0000 (23:53 +0400)]
Restore building of +sb-unicode with -sb-unicode.

Some host definitions slipped in during cross-compilation.
char-code-limit => sb!xc:char-code-limit.
**character-primary-compositions** was initialized at xc-time, move it to cold init.

Thanks to Christophe Rhodes for the latter.

10 years agoSET-FUNCALLABLE-INSTANCE-FUNCTION is user interface
Christophe Rhodes [Mon, 16 Sep 2013 11:34:49 +0000 (12:34 +0100)]
SET-FUNCALLABLE-INSTANCE-FUNCTION is user interface

It should therefore not trigger AVER failures if the user gets the
order of arguments wrong, but report the problem sanely.  The fix
in this commit is only semi-sane; it would be nice to report an
expected-type of SB-MOP:FUNCALLABLE-STANDARD-OBJECT rather than
SB-KERNEL:FUNCALLABLE-INSTANCE, but there are slightly tricky
bootstrap issues to sort out to get that to work.

10 years agominor optimization to restart-case
Christophe Rhodes [Fri, 13 Sep 2013 13:30:13 +0000 (14:30 +0100)]
minor optimization to restart-case

The generated non-local transfer functions go to a tag which will
always be in scope whenever the restart can be invoked, so wrap the
GO in a scary (safety 0) optimization declaration.  This fixes
lp#1023721 (but not the issue raised in comment #1, which would be
solved naturally if lp#383078 is addressed).

Include a test which deliberately breaks the normal dynamic-extent
lifetime for restarts; restarts generated by RESTART-CASE and friends
in fact have indefinite extent, even though once they're out of the
dynamic-extent of their creating/binding operator you can't really do
anything with them (INVOKE-RESTART signals a control-error if the
restart given is not active, and there's no way to reactivate a
restart).  However, the temptation to make the restart function
have dynamic-extent allocation must be resisted, because of the
indefinite lifetime of the restart object itself.

10 years agoNEWS update for RESTART-CASE clause parsing
Christophe Rhodes [Fri, 13 Sep 2013 09:36:37 +0000 (10:36 +0100)]
NEWS update for RESTART-CASE clause parsing

fixes lp#1203585

10 years agoSimplify RESTART-BIND and improve documentation string
Jan Moringen [Tue, 16 Jul 2013 21:15:02 +0000 (23:15 +0200)]
Simplify RESTART-BIND and improve documentation string

* Mention syntax in documentation string.

* Simplify implementation using a location function PARSE-BINDING and
  DESTRUCTURING-BIND.

10 years agoRemove convoluted keyword argument processing in RESTART-CASE
Jan Moringen [Sun, 21 Jul 2013 22:09:03 +0000 (00:09 +0200)]
Remove convoluted keyword argument processing in RESTART-CASE

* Replace a combination of TRANSFORM-KEYWORDS, PARSE-KEYWORD-PAIR and
  WITH-KEYWORD-PAIRS with a relatively simple local function
  PARSE-KEYWORDS-AND-BODY; Gets rid of KLUDGE regarding
  WITH-KEYWORD-PAIRS

* Add a smoke test and more cases for the :MALFORMED-CLAUSES test in
  tests/condition.pure.lisp; Gets rid of the "fair amount of
  rearrangement ... should be tested" FIXME

* Fix "test case from Gerd Moellmann" in tests/clos.impure.lisp which
  contained an invalid RESTART-CASE form uncovered by the above change

10 years agomore restrictive test naming
Christophe Rhodes [Wed, 11 Sep 2013 11:24:43 +0000 (12:24 +0100)]
more restrictive test naming

restrict test names to trees of integers and external symbols in
CL/KEYWORD/SB- packages.

10 years agorename recently-added tests
Christophe Rhodes [Wed, 11 Sep 2013 05:10:20 +0000 (06:10 +0100)]
rename recently-added tests

use only keyword symbols in the names to assist in continuous
integration

10 years agodetect cpl-protocol-violations early
Christophe Rhodes [Tue, 10 Sep 2013 22:24:46 +0000 (23:24 +0100)]
detect cpl-protocol-violations early

Don't try to eagerly finalize classes which will cause
cpl-protocol-violations to be signalled.  (lp#309076)

10 years agoFix a regression in sb-safepoint.
Stas Boukarev [Tue, 10 Sep 2013 17:40:42 +0000 (21:40 +0400)]
Fix a regression in sb-safepoint.

WITH_GC_AT_SAFEPOINTS_ONLY is actually a fancy macro, which wraps the
form following it in some code. In a recent change that wasn't
accounted for and resulted in bad consequences. Add {} around the code
after WITH_GC_AT_SAFEPOINTS_ONLY.
Reported by Jan Moringen.

10 years agoMicro-optimize move-immediate on x86-64.
Stas Boukarev [Mon, 9 Sep 2013 15:54:05 +0000 (19:54 +0400)]
Micro-optimize move-immediate on x86-64.

Use XOR X, X when the immediate is 0.

10 years agoFix CHAR-EQUAL on base-chars on non-sb-unicode.
Stas Boukarev [Mon, 9 Sep 2013 15:43:58 +0000 (19:43 +0400)]
Fix CHAR-EQUAL on base-chars on non-sb-unicode.

BASE-CHAR-P, called by TWO-ARG-CHAR-EQUAL, isn't properly implemented
on non-sb-unicode, the transform by which it gets transformed into
(typep x 'base-char) is disabled, causing an infinite loop.
Since testing for base-char-p is usually redundant on #-sb-unicode,
don't define it there at all. This will catch inadvertent uses.
In the few places where it's currently used, it's can be safely
omitted.

Reported by Jan Moringen.

10 years agorename SB-SIMPLE-STREAMS utility function
Christophe Rhodes [Mon, 9 Sep 2013 14:09:42 +0000 (15:09 +0100)]
rename SB-SIMPLE-STREAMS utility function

At least, I think it was simply intended to be a utility function,
but the FILE-NAMESTRING name is unfortunate, as that's a CL function,
and (for other reasons) SB-SIMPLE-STREAMS claims to implement CL in
the package lock sense, so this was not noticed at the time.

This fixes lp#884603; I am unconvinced that the namestring logic is
actually correct (keeping the distinction between NAMESTRING and
NATIVE-NAMESTRING clear) but I'll wait for an actual user to complain
about that before thinking too hard.

10 years agobetter ctor fallback-generators
Christophe Rhodes [Mon, 9 Sep 2013 11:42:30 +0000 (12:42 +0100)]
better ctor fallback-generators

The logic surrounding default-initargs in the presence of "hairy"
methods on make-instance and friends was not quite right, leading
to evaluation of the wrong things at the wrong times.  Patch by
Jan Moringen with extra test cases (lp#1179858).

10 years agobetter comment describing INDEX type
Christophe Rhodes [Mon, 9 Sep 2013 09:21:54 +0000 (10:21 +0100)]
better comment describing INDEX type

merged ideas from Paul Khuong and Jan Moringen, from
<http://paste.lisp.org/display/138734>

10 years agosb-safepoint: Fix interrupts during GC.
Stas Boukarev [Sun, 8 Sep 2013 23:19:18 +0000 (03:19 +0400)]
sb-safepoint: Fix interrupts during GC.

In interrupt_handle_now, move

context_sap = alloc_sap(context);
info_sap = alloc_sap(info);

after WITH_GC_AT_SAFEPOINTS_ONLY(), otherwise the allocation will
break the running GC.
Fixes lp#1133018.

10 years agoLDB/DPB do not check for negative indexes.
Stas Boukarev [Sat, 7 Sep 2013 19:01:37 +0000 (23:01 +0400)]
LDB/DPB do not check for negative indexes.

Calling (lambda (x y) (ldb (byte x y) 100)) with -1 -2 didn't raise an
error.

Reported by Bart Botta.

10 years agoAdjust SETcc instruction encoding on x86-64.
Stas Boukarev [Sat, 7 Sep 2013 05:48:35 +0000 (09:48 +0400)]
Adjust SETcc instruction encoding on x86-64.

Avoid emitting REX for legacy registers.

10 years agoImprove knownfun declarations.
Stas Boukarev [Fri, 6 Sep 2013 22:03:08 +0000 (02:03 +0400)]
Improve knownfun declarations.

Make some types more accurate, add some
:derive-type #'result-type-first/last-arg.
Add missing %adjoin/member/assoc-test/not/key defknowns.

10 years agoRemove a wrong IGNORE declaration.
Stas Boukarev [Fri, 6 Sep 2013 17:58:24 +0000 (21:58 +0400)]
Remove a wrong IGNORE declaration.

An incorrect ignore declaration was used with #!-sb-package-locks,
even though the ignored variables are used without sb-package-locks
too.

Patch by Douglas Katzman.

10 years agoSave some space in WITH-OUTPUT-TO-STRING.
Stas Boukarev [Fri, 6 Sep 2013 14:23:40 +0000 (18:23 +0400)]
Save some space in WITH-OUTPUT-TO-STRING.

Not passing :element-type 'character to MAKE-STRING-OUTPUT-STREAM
saves a few bytes, since it's the default value.

10 years agoFix for sb-gmp bignum result allocation (lp#1206191)
Christophe Rhodes [Fri, 6 Sep 2013 11:43:40 +0000 (12:43 +0100)]
Fix for sb-gmp bignum result allocation (lp#1206191)

Patch based on 59e72c69c00abf9095d82e9a7b65f9c1b54d105c from
<https://github.com/sfrank/sb-gmp> (thanks to Stephan Frank)

10 years agoFix sb-gmp:mpz-pow for non-bignum bases
Christophe Rhodes [Fri, 6 Sep 2013 11:28:21 +0000 (12:28 +0100)]
Fix sb-gmp:mpz-pow for non-bignum bases

Don't declare types, and we don't need the check-type either

10 years agoOptimize CHAR-EQUAL on constant and base-char args.
Stas Boukarev [Thu, 5 Sep 2013 19:29:51 +0000 (23:29 +0400)]
Optimize CHAR-EQUAL on constant and base-char args.

The open-code transform for base-char arguments was never invoked, it
should have been defined on TWO-ARG-CHAR-EQUAL, not CHAR-EQUAL. And
enable it only for (> speed space).

Add a check for base-char into the TWO-ARG-CHAR-EQUAL function, and
invoke the optimized code, the same the transform uses.

Optimize (char-equal #\c x) by transforming it into a call to
(char-equal-constant x #\c #\C), which does
(or (char= #\c char) (char= #\C char)), or directly to that expression
with (> speed space).

(char-equal #\- x) is transformed to (char= #\- x).

10 years agoAdd defknowns for TWO-ARG-CHAR-* functions.
Stas Boukarev [Thu, 5 Sep 2013 17:49:58 +0000 (21:49 +0400)]
Add defknowns for TWO-ARG-CHAR-* functions.

This avoids the checks for multiple values.

10 years agoAdd a transform for EQUALP.
Stas Boukarev [Thu, 5 Sep 2013 16:39:53 +0000 (20:39 +0400)]
Add a transform for EQUALP.

Similar to the EQUAL one.

Also fix a bug in the EQUAL transform when types which include
specialized arrays inside them were resulting in EQUAL being
incorrectly folded to NIL.

10 years agoDocument extensible sequence protocol
Christophe Rhodes [Thu, 5 Sep 2013 16:29:02 +0000 (17:29 +0100)]
Document extensible sequence protocol

Based on patch by Jan Moringen from lp#994528

10 years agoOptimize some comparison functions for EQ cases.
Stas Boukarev [Thu, 5 Sep 2013 14:35:12 +0000 (18:35 +0400)]
Optimize some comparison functions for EQ cases.

Add (or (eq x y) ...) to bit-vector-=, two-arg-char-equal, pathname=.

10 years agoImprove the EQUAL transform.
Stas Boukarev [Thu, 5 Sep 2013 13:10:08 +0000 (17:10 +0400)]
Improve the EQUAL transform.

Transform to EQL when at least one argument is not of type
(or string cons pathname bit-vector).
Transform (equal (the pathname x) (the pathname y)) to (pathname= x y).

Closes lp#1220084, based on the patch by Elias Martenson.

10 years agoMicro-optimize calling assembly routines on x86oids.
Stas Boukarev [Wed, 4 Sep 2013 22:10:19 +0000 (02:10 +0400)]
Micro-optimize calling assembly routines on x86oids.

Do not check for multiple values in the :full-call return sequence, it
always returns just one value and CLC is issued before returning.

10 years agoMicro-optimize calling alloc_tramp on x86_64.
Stas Boukarev [Wed, 4 Sep 2013 09:30:17 +0000 (13:30 +0400)]
Micro-optimize calling alloc_tramp on x86_64.

In allocation-tramp, instead of using R11 temp-reg for storing the
address of alloc_tramp, use alloc-tn, because the result of
alloc_tramp will be stored there and its value doesn't have to be
preserved. And most of the time it will be allocated to a
non-64-bit-mode register, allowing to save 2 bytes on encoding.

10 years agoAdd SOCKET-SHUTDOWN in contrib/sb-bsd-sockets
Jan Moringen [Thu, 1 Aug 2013 16:54:12 +0000 (18:54 +0200)]
Add SOCKET-SHUTDOWN in contrib/sb-bsd-sockets

* The new generic function SOCKET-SHUTDOWN shuts down a socket for
  input, output or both. Calls shutdown(3posix)

* Test shutdown.{client,server}.{ub8,character}.{output,io} test
  shutting down TCP stream sockets from the client and server side for
  different element-types and directions

10 years agoHandle compiler-error in LOAD when it's not run from inside EVAL.
Stas Boukarev [Mon, 2 Sep 2013 05:44:38 +0000 (09:44 +0400)]
Handle compiler-error in LOAD when it's not run from inside EVAL.

When LOAD is run from the --load option or from within a new thread,
it doesn't go though EVAL and doesn't inherit its compiler-error
handler.

Fixes lp#1219601.

10 years agoslep-non-consing test: prevent from sleeping too much.
Stas Boukarev [Sat, 31 Aug 2013 06:17:18 +0000 (10:17 +0400)]
slep-non-consing test: prevent from sleeping too much.

Some platforms can't sleep for short amounts of time, add a
sb-ext:with-timeout around it and don't report it as a failure, since
there's basically nothing that can be fixed in such cases.

10 years agoMicro-optimize gc scavenge.
Stas Boukarev [Sat, 31 Aug 2013 03:29:06 +0000 (07:29 +0400)]
Micro-optimize gc scavenge.

Instead of putting the amount by which to increment the pointer and
then adding it at the end of the loop, increment the pointer
directly. Makes it slightly faster when compiled with GCC.

10 years agoRemove a couple of unused variables in the C runtime.
Stas Boukarev [Fri, 30 Aug 2013 23:36:19 +0000 (03:36 +0400)]
Remove a couple of unused variables in the C runtime.

10 years agotests/subr.sh: Fix sed invocation for Solaris.
Stas Boukarev [Fri, 30 Aug 2013 01:09:24 +0000 (05:09 +0400)]
tests/subr.sh: Fix sed invocation for Solaris.

10 years agotests/run-compiler.sh: use gcc, not cc.
Stas Boukarev [Fri, 30 Aug 2013 00:40:31 +0000 (04:40 +0400)]
tests/run-compiler.sh: use gcc, not cc.

10 years agoFix floating point exceptions persisting on Solaris.
Stas Boukarev [Thu, 29 Aug 2013 23:56:36 +0000 (03:56 +0400)]
Fix floating point exceptions persisting on Solaris.

(/ 0d0 0d0)
(cosh 90)

signaled an invalid-operation exception, and not overflow, on COSH,
because the previous error wasn't cleared. Clear the exception flags
in the sigfpe handler.

10 years agoPPRINT (setf . a) correctly.
Stas Boukarev [Thu, 29 Aug 2013 22:34:22 +0000 (02:34 +0400)]
PPRINT (setf . a) correctly.

It was printed as (setf a).

Reported by Douglas Katzman.

10 years agoFix building on Solaris x86-64.
Stas Boukarev [Thu, 29 Aug 2013 20:21:28 +0000 (00:21 +0400)]
Fix building on Solaris x86-64.

sb-unix:unix-select used macros which expanded into many forms,
limited by sb-unix:fd-setsize, which on Solaris-x86-64 is 65536, as
opposed to 1024 on Linux. This resulted in long compile times which
were likely to exhaust the heap.
Use functions instead of macros.

10 years agoImprove the test float.impure.lisp / (RANGE-REDUCTION PRECISE-PI).
Lutz Euler [Wed, 28 Aug 2013 21:09:05 +0000 (23:09 +0200)]
Improve the test float.impure.lisp / (RANGE-REDUCTION PRECISE-PI).

The way the test calculated its expected values was flawed and worked
correctly only accidentally due to the specific test values used and
to allowing a relatively large margin of error.

This commit corrects these calculations, removes some test values and
adds others and tightens the error margin. I do not expect this to cause
the test's outcome on any platform to change.

The flaw was to reduce the arguments by taking the remainder of
truncating modulo 2 pi. This allows precise calculations only of the
sine and the tangent of values slightly above even multiples of pi, but
not for example for the sine of an argument near an odd multiple of pi.
Instead the reduction is now done by taking the remainder of rounding
to the nearest multiple of pi/2 so that all arguments near the zeroes
of both sine and cosine reduce to values near zero.

This change was prompted when the test unexpectedly failed with some
values from gcc bug 43490 which I tried when investigating lp #1137924.

10 years agoPROBE-FILE on symlinks to pipes inside /proc on Linux.
Stas Boukarev [Wed, 28 Aug 2013 14:46:30 +0000 (18:46 +0400)]
PROBE-FILE on symlinks to pipes inside /proc on Linux.

PROBE-FILE now can access symlinks to pipes and sockets in
/proc/pid/fd/ on Linux.
query-file-system already has code for handling broken symlinks,
resolving the directory part, use it on files for which realpath(3)
fails, which includes pipes and socket links in /proc.

Reported by Eric Schulte.

10 years agoRemove debug-deinit, unused.
Stas Boukarev [Fri, 23 Aug 2013 22:32:00 +0000 (02:32 +0400)]
Remove debug-deinit, unused.

Its body consist of
;; Nothing to do right now. Once there was, maybe once there
;; will be again.

Once there is something to do, it can easily be put back.

10 years agoRemove an unused variable, *unwind-to-frame-function*.
Stas Boukarev [Fri, 23 Aug 2013 22:12:41 +0000 (02:12 +0400)]
Remove an unused variable, *unwind-to-frame-function*.

It isn't used for about three years now.

10 years ago1.1.11: will be tagged as "sbcl-1.1.11"
Christophe Rhodes [Wed, 28 Aug 2013 13:16:56 +0000 (14:16 +0100)]
1.1.11: will be tagged as "sbcl-1.1.11"

10 years agofix NEWS header
Christophe Rhodes [Wed, 28 Aug 2013 13:16:29 +0000 (14:16 +0100)]
fix NEWS header

10 years agoRevert "Clean up %more-arg-values."
Stas Boukarev [Sat, 24 Aug 2013 21:37:17 +0000 (01:37 +0400)]
Revert "Clean up %more-arg-values."

This reverts commit 1e5296127f5b384a2171646747021ebeee73b801.
It breaks slime, a better solution to come in the next release cycle.