sbcl.git
11 years agoupdate to unicode 6.2
Christophe Rhodes [Wed, 13 Mar 2013 12:33:24 +0000 (12:33 +0000)]
update to unicode 6.2

11 years agoComplete cut-to-width
Paul Khuong [Sat, 18 May 2013 00:22:44 +0000 (20:22 -0400)]
Complete cut-to-width

 * Insert logand/mask-signed-field even around references to variables
   in modular arithmetic: avoid recursive rewriting by disabling the
   transform when the destination is a direct logand/mask-signed-field
   combination.

 * Fixes lp#1026634 (reported by Anton Marsden on sbcl-devel).

11 years agoMore efficient MASK-SIGNED-FIELD
Paul Khuong [Fri, 17 May 2013 21:44:12 +0000 (17:44 -0400)]
More efficient MASK-SIGNED-FIELD

 Word => signed-word and {word, signed-word} => fixnum conversions
 are implemented with unchecked move VOPs.

11 years agoInsert typechecks before RAW-INSTANCE-INIT in structure constructors
Paul Khuong [Fri, 17 May 2013 21:21:55 +0000 (17:21 -0400)]
Insert typechecks before RAW-INSTANCE-INIT in structure constructors

 * Usually, FTYPE declarations ensure that happens, but multiple
   inlining of the same structure constructor cause strangeness.

 * Fixed lp#1177703, reported by Jan Moringen.

11 years agoMore robust erroneous local call detection
Paul Khuong [Fri, 17 May 2013 20:54:06 +0000 (16:54 -0400)]
More robust erroneous local call detection

 * When possible, convert known bad calls into calls to error-signaling
   stubs.

 * Fixes lp#504121 (and likely other occurrences of
   "failed AVER (ZEROP (HASH-TABLE-COUNT ...))."

11 years agoCOMPILE-FILE shouldn't "attempt to dump invalid structure" anymore
Paul Khuong [Fri, 17 May 2013 20:08:00 +0000 (16:08 -0400)]
COMPILE-FILE shouldn't "attempt to dump invalid structure" anymore

 * When CAST nodes detect definite type mismatch, they are replaced
   with debugging instrumentation to provide source locations at
   compile and run -time. When code is generated internally, the
   source can include literal internal data structures. Skip those
   when recovering source locations.

 * Fixes lp#943953 and a bunch of equally baffling duplicates.

11 years agoRecover full backtraces with generic arithmetic on x86 and x86-64
Paul Khuong [Fri, 17 May 2013 19:25:50 +0000 (15:25 -0400)]
Recover full backtraces with generic arithmetic on x86 and x86-64

 * Errors in generic arithmetic (or comparisons) used to hide the caller
   in the backtrace: it was replaced with a frame in the anonymous
   assembly stub.

 * Regression since 1.0.24.35, fixes lp#800343.

 * Also remove a misleading FIXME in typed-accessor-definitions
   (reported by Matt Novenstern in lp#1171646).

11 years agoAdd a stub for %other-pointer-p.
Stas Boukarev [Thu, 16 May 2013 17:08:48 +0000 (21:08 +0400)]
Add a stub for %other-pointer-p.

Otherwise the VOP isn't translated on literal objects, and
sb-sequence:do-sequence stops working on literal vectors. Having a
stub allows constant folding to work.

Reported by adeht on #lisp.

11 years agoloop: remove code size-estimation.
Stas Boukarev [Thu, 16 May 2013 12:51:47 +0000 (16:51 +0400)]
loop: remove code size-estimation.

Loop has a facility to determine whether it's ok to duplicate variable
initialization and stepping code when the variable preceding it has
different initialization and stepping forms. The code which determines
code size is quite strange and it may have been relevant 20 years ago
on primitive implementations, but not anymore, and people who really
care about code size would use functions, which will also improve code
readability.

As a side effect, it fixes a bug which was present in the
estimate-code-size function.

Fixes lp#1178989.

11 years agoFix describe-object for characters.
Stas Boukarev [Mon, 13 May 2013 15:40:20 +0000 (19:40 +0400)]
Fix describe-object for characters.

Don't prefix lines with ":_".

11 years agoearly-alieneval: Fix package-related thinko with saved-fp-and-pc logic.
Alastair Bridgewater [Sat, 11 May 2013 16:31:40 +0000 (12:31 -0400)]
early-alieneval: Fix package-related thinko with saved-fp-and-pc logic.

  * Forgot a package prefix for GET-LISP-OBJ-ADDRESS, because the
function symbol was exported from SB!ALIEN-INTERNALS yet defined
in SB!ALIEN, and the prefix wouldn't have been necessary from
SB!ALIEN-INTERNALS.

  * Thanks to Stas Boukarev for the heads-up.

11 years agocode/room: Completely rewrite MAP-ALLOCATED-OBJECTS.
Alastair Bridgewater [Tue, 30 Apr 2013 02:56:14 +0000 (22:56 -0400)]
code/room: Completely rewrite MAP-ALLOCATED-OBJECTS.

  * The old version of M-A-O consisted of bizaare toplevel logic,
a scheme for figuring out what each heap object was and its size
that did not parallel what the garbage collector used and may or
may not have been correct, and relied heavily on inlining to
reduce consing.

  * This new version of M-A-O uses straightforward toplevel logic,
a scheme for figuring out what each heap object is and its size
that directly parallels what the garbage collector uses and is
verifiably correct, and relies heavily on the aligned unboxed
pointer to fixnum equivalence to reduce consing.

  * The new interface to M-A-O no longer includes the optional
"careful" argument, as it gains us nothing once the underlying
mechanism is so obviously correct.  sb-introspect has been updated
appropriately.

  * The way the new implementation walks the heap and page table
requires direct access to a "static" global variable in gencgc.c,
so the "static" attribute has been removed.

  * This implementation has been lightly tested on an x86-64 and
PPC, and it seems to work quite well, but there are still some
fairly obvious non-optimalities in terms of generated code (as
seen in the trace-file output from the cross compiler).  It does
pass the two test cases that exhausted the heap on PPC with the
previous implementation.

11 years agocode/room: Improve type-format database initialization for simple vector types.
Alastair Bridgewater [Sat, 27 Apr 2013 12:31:22 +0000 (08:31 -0400)]
code/room: Improve type-format database initialization for simple vector types.

  * There has been a longstanding FIXME comment on a piece of code
which contains a hand-maintained list of specialized vector types
and the shift count for converting the length from elements to
octets.

  * It turns out that all of this information, plus the type names
that we currently do a song-and-dance with INTERN, SUBSEQ, and
MISMATCH to obtain, plus information for the string types, is
available from *SPECIALIZED-ARRAY-ELEMENT-TYPE-PROPERTIES*.  And
*S-A-E-T-P* is guaranteed to be up-to-date, as it's too central to
our implementation of UPGRADED-ARRAY-ELEMENT-TYPE and MAKE-ARRAY
for it to be allowed to break.

  * So, replace nasty KLUDGE of an initialization for simple
vector types with something more principled, making it explicit
which properties need to be derived and which are simply already
available, and picking off the one specialized array type that
needs to be handled differently (SIMPLE-ARRAY-NIL).

11 years agoNEWS updates.
Alastair Bridgewater [Sat, 11 May 2013 13:48:47 +0000 (09:48 -0400)]
NEWS updates.

  * Forgot to add a NEWS update to my recent commit involving the
internal-error logic.

  * And clarify that only vectors of boxed items may be stack-
allocated on PPC.

11 years agocode/interr: Hook internal error contexts into the saved-fp-and-pc mechanism.
Alastair Bridgewater [Wed, 8 May 2013 01:46:43 +0000 (21:46 -0400)]
code/interr: Hook internal error contexts into the saved-fp-and-pc mechanism.

  * This covers the unfortunate case of a signal handler not
having an unbroken stack frame chain to the interrupted context,
which actually occurs on threaded x86-64 FreeBSD systems.

  * Use the existing saved-fp-and-pc mechanism, used for
ALIEN-FUNCALL to cover for code compiled -fomit-frame-pointer to
treat the internal error context as an alien funcall point.

11 years agoAllow inlining more calls to INVOKE-WITH-SAVED-FP-AND-PC during XC.
Alastair Bridgewater [Thu, 9 May 2013 21:16:58 +0000 (17:16 -0400)]
Allow inlining more calls to INVOKE-WITH-SAVED-FP-AND-PC during XC.

  * The INVOKE-WITH-SAVED-FP-AND-PC mechanism was defined in
ALIENCOMP, which occurs well after the first uses of ALIEN-FUNCALL,
thus preventing it from being inlined when used during XC (by
default, only on x86).

  * Fix, by relocating the mechanism from SB!C to
SB!ALIEN-INTERNALS and from COMPILER;ALIENCOMP to
CODE;EARLY-ALIENEVAL.

  * Also relocate and publish symbols for all of the magic from
SB!ALIEN-INTERNALS.

11 years agosb-introspect:find-definition-sources-by-name: more defoptimizer types.
Stas Boukarev [Tue, 7 May 2013 18:47:31 +0000 (22:47 +0400)]
sb-introspect:find-definition-sources-by-name: more defoptimizer types.

Look for sb-c:ir2-convert and sb-c::stack-allocate-result defoptimizer types.

11 years agoMake CONTAINING-INTEGER-TYPE take N-WORD-BITS into account.
Lutz Euler [Mon, 6 May 2013 17:37:23 +0000 (19:37 +0200)]
Make CONTAINING-INTEGER-TYPE take N-WORD-BITS into account.

Replace the hardcoded 32s in the function with N-WORD-BITS. This in turn
allows SOURCE-TRANSFORM-NUMERIC-TYPEP to find better transformations
for type checks for types larger than fixnum but smaller than a machine
word also under 64-bit word size. The most important improvement this
achieves is to avoid generic arithmetic for the bounds tests in these
cases.

For example, the test (TYPEP X '(UNSIGNED-BYTE 63)) runs about four
times as fast on x86-64 with this change.

(Tests for the exact types (SIGNED-BYTE 64) and (UNSIGNED-BYTE 64) are
unaffected as compiling them takes another code path, which already
generates well optimized code.)

11 years agoMake %EMIT-ALIGNMENT be more friendly to multi-byte NOPs.
Lutz Euler [Mon, 6 May 2013 12:04:02 +0000 (14:04 +0200)]
Make %EMIT-ALIGNMENT be more friendly to multi-byte NOPs.

When %EMIT-ALIGNMENT needs to tighten the alignment, it used to emit
a fixed-size skip first and an alignment note afterwards. On x86-64,
where block headers are aligned using multi-byte NOPs, this could
lead to emitting one more such NOP than needed to span the desired
range, unnecessarily increasing the number of machine instructions
the processor needs to decode.

To avoid that, change %EMIT-ALIGNMENT to only emit an alignment note
(covering both the fixed-size skip and the alignment note from the
original version) in this situation.

An example of the difference, from the disassembly of
SB-C::FLATTEN-LIST:

Before:

  896: L0:   8F4508           POP QWORD PTR [RBP+8]
  899:       0F1F00           NOP
  89C:       0F1F4000         NOP
  8A0: L1:   4881F917001020   CMP RCX, 537919511

Afterwards:

  896: L0:   8F4508           POP QWORD PTR [RBP+8]
  899:       0F1F8000000000   NOP
  8A0: L1:   4881F917001020   CMP RCX, 537919511

11 years agoBetter type derivation for APPEND, NCONC, LIST.
Stas Boukarev [Sun, 5 May 2013 16:51:15 +0000 (20:51 +0400)]
Better type derivation for APPEND, NCONC, LIST.

The result types of APPEND/NCONC depend on the last argument and the
presence of conses in the middle.
For example (append 42) => 42, (append nil nil 42) => 42,
(append (list 1) 42) => (1 . 42), etc.

LIST returns NIL in case of no arguments and a cons in other
cases. That fact required an adjustment for a values-list optimizer,
which removed all arguments from a LIST call making it change the type
from LIST to NULL and confusing things.

Closes lp#538957

11 years agoMicro-optimize values-list.
Stas Boukarev [Sat, 4 May 2013 22:54:51 +0000 (02:54 +0400)]
Micro-optimize values-list.

Compare a register with nil-value directly, without going through a
temporary register.

11 years agosb-introspect:find-definition-sources-by-name: find VOPs by name.
Stas Boukarev [Sat, 4 May 2013 00:14:21 +0000 (04:14 +0400)]
sb-introspect:find-definition-sources-by-name: find VOPs by name.

(sb-introspect:find-definition-sources-by-name x :vop) now
also returns VOPs which do not translate any functions.

11 years agoCommiting fix by Doug Katzman: disassembler missing ",8" on SHLD
Martin Cracauer [Fri, 3 May 2013 22:19:30 +0000 (18:19 -0400)]
Commiting fix by Doug Katzman:  disassembler missing ",8" on SHLD

11 years agoNEWS: Updates for recent PPC changes.
Alastair Bridgewater [Fri, 3 May 2013 03:37:56 +0000 (23:37 -0400)]
NEWS: Updates for recent PPC changes.

  * I recently committed a small batch of PPC changes, but none of
them had NEWS entries.  This was not quite an oversight, as the
original changes were written prior to the 1.1.7 release, but now
that they've been committed they should at least be mentioned as
NEWS.

11 years agoCorrect integer-length on fixnums on x86-64 when n-fixnum-tag-bits > 1.
Stas Boukarev [Wed, 1 May 2013 10:15:45 +0000 (14:15 +0400)]
Correct integer-length on fixnums on x86-64 when n-fixnum-tag-bits > 1.

Use SAR, not SHR for untagging, to preserve the sign.
Thanks to Paul Khuong.

11 years agotests/dynamic-extent.impure.lisp: One of the dx-vector test terms was misplaced.
Alastair Bridgewater [Thu, 25 Apr 2013 19:02:12 +0000 (15:02 -0400)]
tests/dynamic-extent.impure.lisp: One of the dx-vector test terms was misplaced.

  * MAKE-ARRAY-ON-STACK-1 tries to create a specialized vector,
but was being called from a test that only claims to handle
vectors suitable for a precisely-scavenged control stack.

  * Fix, by moving the call to the next test, which is for
specialized vectors (and thus only runs on conservative-stack
systems).

11 years agoppc support for stack-allocatable-vectors
Alastair Bridgewater [Thu, 25 Apr 2013 18:55:13 +0000 (14:55 -0400)]
ppc support for stack-allocatable-vectors

  * This turned out to be fairly straightforward.  Unlike in a
heap-allocation-only regime, where a VOP is required to :TRANSLATE
ALLOCATE-VECTOR, the :STACK-ALLOCATABLE-VECTORS feature enables an
LTN-ANNOTATE optimizer for ALLOCATE-VECTOR that substitutes
invocations of one of two named VOPs.

  * To convert from the old regime to the new, rename the old VOP
to fit the new naming scheme, and write a new VOP to do the stack
allocation.

  * As a cleaning-up-a-loose-end matter, lose the :TRANSLATE
option for the old VOP.

  * And as a "being somewhat cute about things" matter, make the
support for stack-allocatable-vectors selectable at build time,
which should provide a quick overview of how to make this work on
some other platform, should anyone else be interested later on.

11 years agogencgc: Compute bytes_allocated correctly during dynamic space pickup.
Alastair Bridgewater [Wed, 24 Apr 2013 17:13:50 +0000 (13:13 -0400)]
gencgc: Compute bytes_allocated correctly during dynamic space pickup.

  * Rather than computing bytes_allocated based on the number of
pages prior to the "alloc pointer" (really the heap high-water
mark), accumulate it based on the number of ALLOCATED pages.

  * Fixes some lossage in write_generation_stats(), which seems to
be the only place where this value is checked against reality.

11 years agoAdd test cases for non-consing WITHOUT-GCING and WITH-PINNED-OBJECTS.
Alastair Bridgewater [Wed, 24 Apr 2013 17:12:23 +0000 (13:12 -0400)]
Add test cases for non-consing WITHOUT-GCING and WITH-PINNED-OBJECTS.

  * Neither of these two constructs should cons under normal
circumstances, but WITH-PINNED-OBJECTS is occasionally broken in
this respect on some backends.  May as well make it explicit and
official.

11 years agocompiler/{sparc,ppc}/macros: with-pinned-objects improvements.
Alastair Bridgewater [Wed, 24 Apr 2013 17:07:35 +0000 (13:07 -0400)]
compiler/{sparc,ppc}/macros: with-pinned-objects improvements.

  * For all precise gencgc backends, with-pinned-objects uses an
explicit "pin list".  This pin list should be stack-allocated.

  * Declare the pin list to be TRULY-DYNAMIC-EXTENT, for both
backends.  This won't actually do anything unless the backend
also supports :stack-allocatable-fixed-objects or more than two
objects are to be pinned at once (one-arg LIST and two-arg LIST*
are both converted to CONS by the compiler, and CONS falls under
:stack-allocatable-fixed-objects rather than
:stack-allocatable-lists).

11 years agoppc: Implement :stack-allocatable-fixed-objects
Alastair Bridgewater [Tue, 23 Apr 2013 17:23:01 +0000 (13:23 -0400)]
ppc: Implement :stack-allocatable-fixed-objects

  * Alter SYS:SRC;COMPILER;PPC;MACROS.LISP, WITH-FIXED-ALLOCATION
to accept a parameter for requesting stack allocation instead of
heap allocation.

  * Alter SYS:SRC;COMPILER;PPC;ALLOC.LISP, VOP FIXED-ALLOC to pass
the new stack-allocation parameter.

  * And add :stack-allocatable-fixed-objects to the PPC section in
make-config.sh.

11 years agobacktrace-interrupted-condition-wait now passes on darwin.
Jim Wise [Wed, 1 May 2013 01:23:05 +0000 (21:23 -0400)]
backtrace-interrupted-condition-wait now passes on darwin.

11 years agoMicro-optimize integer-length on fixnums on x86-64.
Stas Boukarev [Tue, 30 Apr 2013 19:32:43 +0000 (23:32 +0400)]
Micro-optimize integer-length on fixnums on x86-64.

INTEGER-LENGTH is implemented by using the BSR instruction, which
returns the position of the first 1-bit from the right. And that needs
to be incremented to get the width of the integer, and BSR doesn't
work on 0, so it needs a branch to handle 0.

But fixnums are tagged by being shifted left n-fixnum-tag-bits times,
untagging by shifting right n-fixnum-tag-bits-1 times (and if
n-fixnum-tag-bits = 1, no shifting is required), will make the
resulting integer one bit wider, making the increment unnecessary.
Then, to avoid calling BSR on 0, OR the result with 1. That sets the
first bit to 1, and if all other bits are 0, BSR will return 0,
which is the correct value for INTEGER-LENGTH.

11 years agoDocument the new :directory argument for run-program.
Stas Boukarev [Tue, 30 Apr 2013 09:52:57 +0000 (13:52 +0400)]
Document the new :directory argument for run-program.

11 years agoConvert the MOVE macro on x86-64 into a function.
Lutz Euler [Mon, 29 Apr 2013 21:18:27 +0000 (23:18 +0200)]
Convert the MOVE macro on x86-64 into a function.

This is possible as the macro is used just to simulate an inline
function. Converting MOVE into a true function shrinks the core by
448 KiB and may even make the compiler run faster due to reduced
instruction cache pressure.

Some background: Only on x86-64 MOVE is used with float SCs sometimes.
It therefore needs to select different machine instructions depending on
the SC of its destination argument. This compiles to so much code that
inlining it can't be justified, especially given that MOVE is used in
several hundred VOPs.

While at it, correct the comment at the top of the file for 64-bitness.

11 years agoFaster ISQRT on small (about fixnum sized) numbers.
Lutz Euler [Mon, 29 Apr 2013 20:57:41 +0000 (22:57 +0200)]
Faster ISQRT on small (about fixnum sized) numbers.

ISQRT is implemented using a recursive algorithm for arguments above 24
which is compiled using generic arithmetic only (as it must support both
fixnums and bignums).

Improve this by compiling this recursive part twice, once using generic
and once fixnum-only arithmetic, and dispatching on function entry into
the applicable part. For maximum speed, the fixnum part recurs directly
into itself, thereby avoiding further type dispatching.

This makes ISQRT run about three times as fast on fixnum inputs while
the generated code is about 40 percent larger (both measured on x86-64).
For bignums a speedup can be seen, too, as ISQRT always recurs into
fixnum territory eventually, but the relative gain obviously becomes
smaller very fast with increasing size of the argument.

I have changed the variable names in the recursive part; they no longer
have an "n-" prefix as this in SBCL by convention means "number of" and
as the argument of the recursive part is no longer visibly "n".

Slightly augment the test case.

11 years agoImprove scaling of type derivation for LOG{AND,IOR,XOR}.
Lutz Euler [Mon, 29 Apr 2013 20:35:01 +0000 (22:35 +0200)]
Improve scaling of type derivation for LOG{AND,IOR,XOR}.

If the types of the arguments of LOG{AND,IOR,XOR} are known to be ranges
of non-negative integers the compiler currently derives the range of the
result using straightforward implementations of algorithms from
"Hacker's Delight". These take quadratical time in the number of bits of
the inputs in the worst case, potentially leading to unacceptably long
compilation times. (The algorithms are based on loops over the bits of
the inputs, doing calculations during each iteration that are themselves
linear in the number of bits of their operands.)

Instead implement bit-parallel algorithms I have found that take linear
time in all cases. While their runtime therefore is limited to much
smaller values for large inputs, it is comparable to that of the current
algorithms for small inputs, too; the new deriver for LOGXOR is in fact
faster than the old one by a factor of two to ten already in the latter
case.

The (existing) test for these derivers compares their results with those
from a brute-force algorithm for all O(N^4) many pairs of input ranges
with endpoints from the set of N-bit unsigned integers. The brute-force
algorithm needs to consider O(N^2) input pairs for each pair of ranges,
making the total runtime O(N^6). Therefore the test normally runs with
N = 5. I have tested all three new derivers successfully with N = 7.

Replace LOG{AND,IOR,XOR}-DERIVE-UNSIGNED-{LOW,HIGH}-BOUND with
LOG{AND,IOR,XOR}-DERIVE-UNSIGNED-BOUNDS to make it possible to evaluate
expressions only once that the calculations for the low and the high
bound have in common. The callers always need both bounds anyway.

Adapt the test to this change. (It runs twice as fast now due to the
brute force loop calculating both bounds in one go.)

Add a test for the scaling behaviour. This needs a function to measure
runtimes over potentially large ranges; add this to test-util.lisp.

Fixes lp#1096444.

11 years agoSplit bitops-derive-type.lisp out of srctran.lisp.
Lutz Euler [Mon, 29 Apr 2013 20:35:01 +0000 (22:35 +0200)]
Split bitops-derive-type.lisp out of srctran.lisp.

The moved part contains DERIVE-TYPE methods for LOGAND, LOGIOR, and
friends. The split is motivated by srctran.lisp being too large and
by planned changes to these type derivers.

11 years agoFix init-var-ignoring-errors.
Stas Boukarev [Mon, 29 Apr 2013 19:40:41 +0000 (23:40 +0400)]
Fix init-var-ignoring-errors.

Actually set the variable to the default value in case of an error.

Caught by Nikodemus Siivola.

11 years agoAdd :directory argument to sb-ext:run-program.
Stas Boukarev [Mon, 29 Apr 2013 19:28:32 +0000 (23:28 +0400)]
Add :directory argument to sb-ext:run-program.

The implementation uses chdir(2) on Unices, the lpCurrentDirectory
argument to CreateProcessW on Windows.
Slightly adapted from the patch by Matthias Benkard.
Closes lp#791800

11 years agoHandle environment initialization better.
Stas Boukarev [Mon, 29 Apr 2013 17:15:57 +0000 (21:15 +0400)]
Handle environment initialization better.

Don't fail with mysterious errors and memory faults on startup during
initialization of *default-pathname-defaults* when the current
directory contains undecodable characters or is deleted. Similarly
catch decoding errors for things like *runtime-pathname* and
*posix-argv*.
Turn the errors into warnings, and ensure that streams are initialized
and the error messages can be printed.

11 years ago1.1.7: will be tagged as "sbcl-1.1.7"
Christophe Rhodes [Mon, 29 Apr 2013 14:12:05 +0000 (15:12 +0100)]
1.1.7: will be tagged as "sbcl-1.1.7"

11 years agofix formatting of most recent "changes" line in NEWS
Christophe Rhodes [Mon, 29 Apr 2013 14:11:21 +0000 (15:11 +0100)]
fix formatting of most recent "changes" line in NEWS

11 years agosort NEWS into enhancement/bug fix/optimization order
Christophe Rhodes [Tue, 23 Apr 2013 10:33:26 +0000 (11:33 +0100)]
sort NEWS into enhancement/bug fix/optimization order

11 years agoTrivial code cleanups
Paul Khuong [Sat, 20 Apr 2013 13:31:30 +0000 (15:31 +0200)]
Trivial code cleanups

 Declare a variable as ignored, and descriptors are 64 bit on
 x86-64. The latter was brought to my attention by Douglas Katzman.

11 years agoSubstitute constants with modular equivalents more safely
Paul Khuong [Sat, 20 Apr 2013 11:50:52 +0000 (13:50 +0200)]
Substitute constants with modular equivalents more safely

* Modular arithmetic sometimes lets us narrow constants down,
  especially with signed arithmetic. We now update the receiving
  LVAR's type conservatively when there are multiple uses; otherwise,
  conflicting type information results in spurious dead code
  elimination.

* Test case by Eric Marsden.

* Reported by Eric Marsden on sbcl-devel (2013-04-18).

11 years agoFix the build on OS X 10.8.0
Paul Khuong [Sat, 20 Apr 2013 11:43:00 +0000 (13:43 +0200)]
Fix the build on OS X 10.8.0

It seems our exception handler can be called before it's fully set up.
Handle that case without potentially leaking too many ports.

Reported by Gabriel Dos Reis on sbcl-devel.

11 years agoHandle multiple-valued forms in TRACE :PRINT.
Matthias Andreas Benkard [Tue, 16 Apr 2013 14:53:00 +0000 (16:53 +0200)]
Handle multiple-valued forms in TRACE :PRINT.

Closes: lp#457053.

11 years agoRemove an unused VOP %make-symbol on x86-64.
Stas Boukarev [Mon, 15 Apr 2013 23:47:24 +0000 (03:47 +0400)]
Remove an unused VOP %make-symbol on x86-64.

%make-symbol is handled by define-primitive-object now.
The old VOP was copied into alloc.lisp during the x86_64 port, got
removed from x86 before the merge. It wasn't even ported to x86-64,
and was never invoked during the 9 years it has been sitting there.

Also remove fast_random_state variable from the C runtime, it was used
by the VOP.

11 years agoDisassemble: print the size into the right stream.
Stas Boukarev [Mon, 15 Apr 2013 19:50:12 +0000 (23:50 +0400)]
Disassemble: print the size into the right stream.

Print the newly introduced size information to the provided stream,
not to *standard-output*.
Reported by Jan Moringen.

11 years agoremove stray debugging code from condition-related patches
Christophe Rhodes [Sun, 14 Apr 2013 05:49:57 +0000 (06:49 +0100)]
remove stray debugging code from condition-related patches

11 years agoHandle :ALLOCATION of condition slots correctly
Jan Moringen [Fri, 5 Apr 2013 09:59:37 +0000 (11:59 +0200)]
Handle :ALLOCATION of condition slots correctly

Previously, DEFINE-CONDITION failed to pass the :ALLOCATION slot
option to MAKE-CONDITION-SLOT.

A test case has been added.

fixes lp#1049404

11 years agoEvaluate condition default initargs once, even after redefinition
Jan Moringen [Fri, 5 Apr 2013 10:24:37 +0000 (12:24 +0200)]
Evaluate condition default initargs once, even after redefinition

There were two causes of this failure

* %DEFINE-CONDITION did not clear CONDITION-CLASSOID-HAIRY-SLOTS when
  a condition was redefined. This led to multiple copies of slots in
  CONDITION-CLASSOID-HAIRY-SLOTS and thus to initforms being evaluated
  multiple times. %DEFINE-CONDITION now clears
  CONDITION-CLASSOID-HAIRY-SLOTS before populating it again.

* (MAKE-INSTANCE CONDITION-CLASS) produced the call tree
  MAKE-INSTANCE
  + ALLOCATE-INSTANCE SLOT-OBJECT
    + MAKE-CONDITION
  + INITIALIZE-INSTANCE SLOT-OBJECT
    + SHARED-INITIALIZE SLOT-OBJECT
  MAKE-CONDITION  and SHARED-INITIALIZE both called initfunctions
  leading to multiple evaluations

A test case has been added.

fixes lp#1164969

11 years agoUse AMOP representation of canonicalized default initargs for conditions
Jan Moringen [Fri, 5 Apr 2013 10:31:06 +0000 (12:31 +0200)]
Use AMOP representation of canonicalized default initargs for conditions

This fixes two issues:

1. CLASS-DIRECT-DEFAULT-INITARGS did not work for condition
   classes (bug 1164970)

2. Constant functions as default initargs of condition classes did not
   work correctly (bug 539517)

The following things have been changed:

* CONDITION-CLASSOID-DEFAULT-INITARGS is now called
  CONDITION-CLASSOID-DIRECT-DEFAULT-INITARGS to better reflect its
  purpose.

* Previously, default initargs of condition classes where stored in a
  plist the values of which where constant initforms or
  initfunctions. Now default initargs of condition classes are always
  of the form

    (INITARG INITFORM THUNK)

  as described in AMOP.

* The SHARED-INITIALIZED :AFTER CONDITION-CLASS T method now stores
  the direct default initargs in the class plist. These are now of the
  correct form as described in the previous bullet point.

* The DOPLIST macro used to be defined in src/pcl/macros.lisp. It is
  now in src/code/early-extensions.lisp and exported from SB-INT. This
  was necessary to use DOPLIST in src/code/condition.lisp.

* Unit test for both problems have been added.

fixes lp#539517, fixes lp#1164970

11 years agoDisassemble: print the function size in bytes.
Stas Boukarev [Fri, 12 Apr 2013 15:27:50 +0000 (19:27 +0400)]
Disassemble: print the function size in bytes.

Print "; Size: 981 bytes" at the beginning of DISASSEMBLE output.

11 years agoLOGBITP and LOGTEST optimizations from x86.
Martin Cracauer [Thu, 11 Apr 2013 15:34:03 +0000 (11:34 -0400)]
LOGBITP and LOGTEST optimizations from x86.

Copy Nathan Froyd's optimizations for LOGBITP and LOGTEST
on x86 architecture into x86-64.

Committing change submitted by Doug Katzman.

11 years agoDon't signal an error on (setf (documentation nil 'function) "doc").
Stas Boukarev [Mon, 8 Apr 2013 10:12:55 +0000 (14:12 +0400)]
Don't signal an error on (setf (documentation nil 'function) "doc").

Signal a style-warning instead when trying to set documentation of NIL
for all other documentation types (except TYPE).

Reported by Zach Beane. Regression since 2e52fa05.

11 years agoCheck bounds of ELT on &more in safe code.
Stas Boukarev [Mon, 1 Apr 2013 13:59:28 +0000 (17:59 +0400)]
Check bounds of ELT on &more in safe code.

Disable &more optimizations for ELT if safety = 3.

11 years agotype=: Compare &key parameters of function types.
Stas Boukarev [Sun, 31 Mar 2013 17:27:14 +0000 (21:27 +0400)]
type=: Compare &key parameters of function types.

Compare key parameters in type=-args, mostly so that deftransforms
with key arguments could be redefined at runtime.

11 years agoStop emitting references to inexistant #n= forms in the pretty printer
Paul Khuong [Sat, 30 Mar 2013 20:06:32 +0000 (21:06 +0100)]
Stop emitting references to inexistant #n= forms in the pretty printer

 * Special logic was introduced in 2003 to avoid pprinting backquote-comma
   forms as ", foo" when ",foo" is unambiguous; the bug has likely been
   around since then.

 * Reported by Douglas Katzman on launchpad, and reduced by James M. Lawrence
   (lp#1161218)

11 years agoFix a compilation failure on svref of a symbol macro
Paul Khuong [Sat, 30 Mar 2013 18:22:46 +0000 (19:22 +0100)]
Fix a compilation failure on svref of a symbol macro

 Introduced in 0892423b (faster SVREF and (SETF SVREF) compilation)

 Thanks to James M. Lawrence for the quick report, with a reduced
 test case.

11 years agoremove sb-studio from commercial support section of the manual
Christophe Rhodes [Fri, 29 Mar 2013 20:24:51 +0000 (20:24 +0000)]
remove sb-studio from commercial support section of the manual

(thanks to Titus Barik)

11 years ago1.1.6: will be tagged as "sbcl-1.1.6"
Christophe Rhodes [Fri, 29 Mar 2013 19:38:35 +0000 (19:38 +0000)]
1.1.6: will be tagged as "sbcl-1.1.6"

11 years agotest environment fix for 64-bit PowerPC/Linux
Christophe Rhodes [Tue, 26 Mar 2013 12:45:35 +0000 (12:45 +0000)]
test environment fix for 64-bit PowerPC/Linux

(from Eric Marsden sbcl-devel 2012-03-26)

11 years agoDeclare types of END and TEST in N{LIST,VECTOR}-SUBSTITUTE-IF[-NOT]*
Jan Moringen [Tue, 5 Mar 2013 18:46:01 +0000 (19:46 +0100)]
Declare types of END and TEST in N{LIST,VECTOR}-SUBSTITUTE-IF[-NOT]*

The types of END and TEST are known because the respective callers are
defined with DEFINE-SEQUENCE-TRAVERSER which checks/COERCEs
appropriately.

11 years agoLazy length computation in DEFINE-SEQUENCE-TRAVERSER
Jan Moringen [Tue, 5 Mar 2013 18:13:06 +0000 (19:13 +0100)]
Lazy length computation in DEFINE-SEQUENCE-TRAVERSER

DEFINE-SEQUENCE-TRAVERSER used to unconditionally establish a binding
of LENGTH{,1,2} to the length of the processed sequence(s). This was
wasteful in the case of user-defined sequences whos implementations
could not access this information.

DEFINE-SEQUENCE-TRAVERSER now uses SYMBOL-MACROLET to provide LENGTH{,1,2}
symbols which evaluate to the respective sequence lengths, but the
sequence length is only computed when needed.

Uses of DEFINE-SEQUENCE-TRAVERSER now have to avoid forcing
LENGTH{,1,2} and thus END{,1,2} handling only appears in the list- and
vector-code-paths. The affected sequence functions are REDUCE,
DELETE[-IF[-NOT]], REMOVE[-IF[-NOT]], REMOVE-DUPLICATES,
DELETE-DUPLICATES, SUBSTITUTE[-IF[-NOT]], NSUBSTITUE[-IF[-NOT]],
COUNT[-IF[-NOT]], MISMATCH and SEARCH.

11 years agoRemove redundant LENGTH calls in NSUBSTITUTE[-IF[-NOT]]
Jan Moringen [Mon, 4 Mar 2013 10:26:35 +0000 (11:26 +0100)]
Remove redundant LENGTH calls in NSUBSTITUTE[-IF[-NOT]]

NSUBSTITUTE, NSUBSTITUTE-IF and NSUBSTITUTE-IF used to contain

  (let ((length (length sequence))) ...

in the code path for lists. In the macroexpansion it became clear that
this recomputed and shadowed the LENGTH variables already established
by DEFINE-SEQUENCE-TRAVERSER.

A very brief test with list lengths between 5 and 500 suggests that
the speedup produced by removing the redundant computation can be
around 5 to 20 %.

11 years agoFix typo in comment in src/compiler/seqtran.lisp
Jan Moringen [Mon, 4 Mar 2013 10:25:24 +0000 (11:25 +0100)]
Fix typo in comment in src/compiler/seqtran.lisp

11 years agominor NEWS fixups
Christophe Rhodes [Fri, 22 Mar 2013 12:14:33 +0000 (12:14 +0000)]
minor NEWS fixups

11 years agoFix SEQUENCE:SEARCH, test seq. functions with user-defined sequences
Jan Moringen [Sun, 10 Mar 2013 15:28:55 +0000 (16:28 +0100)]
Fix SEQUENCE:SEARCH, test seq. functions with user-defined sequences

Extending the tests in tests/seq.impure.lisp to user-defined sequences
revealed that the previous implementation produced incorrect results
for some inputs.

SEQUENCE:WITH-SEQUENCE-ITERATOR now accepts NIL in the list of
variables and generates ignored bindings for these elements.

The new implementation is also slightly faster (at least for the
inputs in tests/seq.impure.lisp).

fixes lp#1153312

11 years agomicro-optimize sane-package a tiny bit more
Christophe Rhodes [Sat, 16 Mar 2013 12:05:31 +0000 (12:05 +0000)]
micro-optimize sane-package a tiny bit more

11 years agofaster SVREF and (SETF SVREF) compilation
Nikodemus Siivola [Sun, 17 Mar 2013 11:54:17 +0000 (13:54 +0200)]
faster SVREF and (SETF SVREF) compilation

11 years agomake-array transform error on unknown element-type.
Stas Boukarev [Sun, 17 Mar 2013 08:53:47 +0000 (12:53 +0400)]
make-array transform error on unknown element-type.

Check for the type to be known, otherwise give up transforming.
Based on a patch by James Kalenius.
Fixes lp#1156095.

11 years agoOptimize pprinting of heavily nested lists.
Stas Boukarev [Sat, 16 Mar 2013 12:33:29 +0000 (16:33 +0400)]
Optimize pprinting of heavily nested lists.

Declare types of PREFIX and SUFFIX slots of PRETTY-STREAM to be
(simple-array character (*)), not just simple-string.

11 years agoReduce consing for find-package.
Stas Boukarev [Sat, 16 Mar 2013 12:09:03 +0000 (16:09 +0400)]
Reduce consing for find-package.

Don't use return-from inside restart-case, it causes consing even when
the branch with restart-case is not taken.

11 years agoOptimize CAD*R for &MORE args.
Stas Boukarev [Thu, 14 Mar 2013 11:29:10 +0000 (15:29 +0400)]
Optimize CAD*R for &MORE args.

Call %rest-ref when possible, and SECOND-FOURTH are optimized by
extension too.

11 years agoAccessing &MORE arguments checks bounds.
Stas Boukarev [Thu, 14 Mar 2013 10:09:54 +0000 (14:09 +0400)]
Accessing &MORE arguments checks bounds.

(funcall (lambda (&rest args) (car args))) => garbage,
because &more accessing didn't check bounds.

Fixes lp#1154946.

11 years agoBetter errors for package operations.
Stas Boukarev [Thu, 14 Mar 2013 08:11:13 +0000 (12:11 +0400)]
Better errors for package operations.

Add some missing errors, make other errors to be of type
sb-kernel:simple-package-error.

Fixes lp#1154776.

DELETE-PACKAGE should be signalling a continuable error, but wasn't
since 1.0.37.44.

11 years agoSlightly better arglist for defmethod.
Stas Boukarev [Wed, 13 Mar 2013 08:29:26 +0000 (12:29 +0400)]
Slightly better arglist for defmethod.

(defmethod name &rest args) instead of just (defmethod &rest args).

11 years agoformat: Signal an error for ~<~@>
Stas Boukarev [Sun, 10 Mar 2013 16:15:53 +0000 (20:15 +0400)]
format: Signal an error for ~<~@>

CLHS doesn't allow @ to appear in the closing directive of ~<~>.

Patch by Jan Moringen.
Fixes lp#1153148

11 years agoclear-output: call stream-clear-output on gray streams.
Stas Boukarev [Sun, 10 Mar 2013 15:05:59 +0000 (19:05 +0400)]
clear-output: call stream-clear-output on gray streams.

clear-output should call sb-gray:stream-clear-output instead of
sb-gray:stream-force-output.

Fixes lp#1153257.

11 years agoNew keyword argument for SB-C:DEFKNOWN: :overwrite-fndb-silently
Paul Khuong [Mon, 4 Mar 2013 05:13:28 +0000 (00:13 -0500)]
New keyword argument for SB-C:DEFKNOWN: :overwrite-fndb-silently

 While not useful in the compiler itself, some libraries (not only
 contribs) define their own VOPs, transforms, etc., and the error
 when clobbering pre-existing defknowns made these libraries hard
 to reload.

 Use with :allow-other-keys for backward compatibility.

11 years agoFix a test-case in threads.impure.lisp on -sb-thread.
Stas Boukarev [Sun, 3 Mar 2013 11:09:40 +0000 (15:09 +0400)]
Fix a test-case in threads.impure.lisp on -sb-thread.

A test was using make-thread without ensuring that sb-thread is enabled.

Fixes lp#1141795

11 years agoPrevent a make-array transform from modifying source forms.
Stas Boukarev [Sat, 2 Mar 2013 20:54:34 +0000 (00:54 +0400)]
Prevent a make-array transform from modifying source forms.

That causes repeated compilations of inlined functions to accumulate
changes made by the transform.

Thanks to Bart Botta.
(regression since 1.0.42.11-bis)

11 years agoImprove the failure output of the test :range-reduction :x87.
Lutz Euler [Sat, 2 Mar 2013 19:49:30 +0000 (20:49 +0100)]
Improve the failure output of the test :range-reduction :x87.

Namely, output the function, argument, expected and actual result.

11 years agoSilence a warning from the test harness for unthreaded builds.
Lutz Euler [Sat, 2 Mar 2013 18:52:19 +0000 (19:52 +0100)]
Silence a warning from the test harness for unthreaded builds.

"The variable THREADS is defined but never used.", so, in WITH-TEST only
bind THREADS under #+SB-THREAD as all places where this variable is used
are guarded by this feature expression, too.

11 years ago1.1.5: will be tagged as "sbcl-1.1.5"
Christophe Rhodes [Tue, 26 Feb 2013 11:42:11 +0000 (11:42 +0000)]
1.1.5: will be tagged as "sbcl-1.1.5"

11 years agoRevert "upgrade asdf to 2.29, per request by Faré (sbcl-devel 2013-02-16)"
Christophe Rhodes [Mon, 25 Feb 2013 10:25:32 +0000 (10:25 +0000)]
Revert "upgrade asdf to 2.29, per request by Faré (sbcl-devel 2013-02-16)"

This reverts commit 5bf941f419b6cd275feb3ee44ca264596fbd9e8e.

11 years agoprohibit adding name of a package to itself as a local nickname
Nikodemus Siivola [Thu, 21 Feb 2013 11:18:34 +0000 (13:18 +0200)]
prohibit adding name of a package to itself as a local nickname

  Seems useless, confusing, and probably unintentional. Make it a
  continuable error, though. Thanks to Rudi Schlatte for thinking
  about this.

  So, NO MORE:

   (in-package :foo)
   (add-package-local-nickname :foo :bar)
   'foo::x ; => BAR::X

11 years agosuffix PACKAGE-LOCALLY-NICKNAMED-BY with -LIST
Nikodemus Siivola [Thu, 21 Feb 2013 10:46:07 +0000 (12:46 +0200)]
suffix PACKAGE-LOCALLY-NICKNAMED-BY with -LIST

  Less confusing, and more in line with PACKAGED-NICKNAMED-BY-LIST &co.

  (Thanks to Rudi Schlatte for heads-up.)

11 years agoupgrade asdf to 2.29, per request by Faré (sbcl-devel 2013-02-16)
Christophe Rhodes [Wed, 20 Feb 2013 11:49:48 +0000 (11:49 +0000)]
upgrade asdf to 2.29, per request by Faré (sbcl-devel 2013-02-16)

11 years agoupdate LIST-QUEUE-CONTENTS docstring, add note
Nikodemus Siivola [Fri, 8 Feb 2013 00:45:18 +0000 (19:45 -0500)]
update LIST-QUEUE-CONTENTS docstring, add note

11 years agoReplace sb-concurrency:queue implementation.
James M. Lawrence [Wed, 14 Nov 2012 00:18:43 +0000 (19:18 -0500)]
Replace sb-concurrency:queue implementation.

Singly-linked queue is faster and conses less.

11 years agoit's print-read consistency, not read/print consistency
Nikodemus Siivola [Thu, 7 Feb 2013 20:16:47 +0000 (22:16 +0200)]
it's print-read consistency, not read/print consistency

  Doesn't really matter, I guess, but let's not confuse terminology if
  we can avoid it. (Kudos to Zach Beane for pointing this out.)

11 years agofix manual build
Nikodemus Siivola [Mon, 4 Feb 2013 16:49:36 +0000 (18:49 +0200)]
fix manual build

11 years agoFix (setf documentation) regression.
Stas Boukarev [Tue, 5 Feb 2013 15:25:46 +0000 (19:25 +0400)]
Fix (setf documentation) regression.

When built with sb-doc enabled (the default), it crashes the build
because it uses a not yet defined function, sb-impl::fun-name.

Reported by Janis Dzerins.

11 years agoTest-suite results colorization.
Stas Boukarev [Tue, 5 Feb 2013 10:53:06 +0000 (14:53 +0400)]
Test-suite results colorization.

Failures in red, unexpected success in green. Works on Windows and on
terminals with ANSI escape code support.
Can be disabled with --no-color.

11 years agoFix (documentation closure) test.
Stas Boukarev [Mon, 4 Feb 2013 12:08:07 +0000 (16:08 +0400)]
Fix (documentation closure) test.

Take into account the idea that
(setf (documentation #'function t) "doc")
(setf (documentation 'function 'function) "doc")

should do the same.

11 years agoBuild on newer glibc.
Stas Boukarev [Mon, 4 Feb 2013 12:06:22 +0000 (16:06 +0400)]
Build on newer glibc.

Newer glibc don't like the usage of #define __USE_GNU, use _GNU_SOURCE
instead.
Fixes lp#1095036

11 years agoFix (documentation #'function t)
Stas Boukarev [Mon, 4 Feb 2013 11:21:22 +0000 (15:21 +0400)]
Fix (documentation #'function t)

(defun test () "xx" nil)
(setf (documentation 'test 'function) "test")
(list (documentation #'test t) (documentation 'test 'function)))
returned ("xx" "test").