sbcl.git
12 years agoFix ldb / %%ldb / rlwinm on PowerPC
Christophe Rhodes [Mon, 23 Apr 2012 15:17:47 +0000 (16:17 +0100)]
Fix ldb / %%ldb / rlwinm on PowerPC

Thanks to Bruce O'Neel for confirming the validity of the fix.

12 years agoTypo fixes in comments
Lutz Euler [Fri, 20 Apr 2012 17:48:51 +0000 (19:48 +0200)]
Typo fixes in comments

12 years agoFix typos in docstrings.
Lutz Euler [Fri, 20 Apr 2012 17:48:51 +0000 (19:48 +0200)]
Fix typos in docstrings.

In DEF-IR1-TRANSLATOR of TAGBODY and MACROLET.
LP #958931, thanks to Juanma Barranquero.

12 years agoteach IR1-TRANSFORM-TYPE-PREDICATE about alien types
Nikodemus Siivola [Fri, 20 Apr 2012 14:04:32 +0000 (17:04 +0300)]
teach IR1-TRANSFORM-TYPE-PREDICATE about alien types

  Convert to ALIEN-VALUE-TYPEP (new function). Avoids both the need to do the
  whole type parsing rigamarole at runtime, and checking for lisp-rep-type.

  Need to do this as late in the game as possible, because after we convert to
  ALIEN-VALUE-TYPEP, the rest of the system stops understanding it as a type
  test. (We really should have some sort of annotation for this sort of stuff,
  so we could convert whenever.)

12 years agoshow correct number of arguments for arg-count error frames
Nikodemus Siivola [Thu, 19 Apr 2012 21:06:20 +0000 (00:06 +0300)]
show correct number of arguments for arg-count error frames

  Or at least pretend harder. Ie. if the frame is a XEP frame,
  and the actual argument count is > number of parsed arguments,
  make up unprintable ersatz objects for the rest.

12 years agosanitize one of the recent c-string decoding tests
Nikodemus Siivola [Thu, 19 Apr 2012 19:37:08 +0000 (22:37 +0300)]
sanitize one of the recent c-string decoding tests

  No out-of-bounds accesses, thanks!

  ...and thanks to Nathan who spotted my bogosity.

12 years agoprettier encoding/decoding error messages
Nikodemus Siivola [Thu, 19 Apr 2012 14:25:29 +0000 (17:25 +0300)]
prettier encoding/decoding error messages

  ":ASCII stream encoding error on #<FD-STREAM ...>"

  ":ASCII stream decoding error on #<FD-STREAM ...>"

  ":ASCII c-string encoding error ...>"

  ":ASCII c-string decoding error ...>"

12 years agowrap a couple of long lines
Nikodemus Siivola [Thu, 19 Apr 2012 10:44:13 +0000 (13:44 +0300)]
wrap a couple of long lines

12 years agoassociate stream decoding and encoding errors with their restarts
Nikodemus Siivola [Thu, 19 Apr 2012 10:43:33 +0000 (13:43 +0300)]
associate stream decoding and encoding errors with their restarts

  ERROR call needs to appear inline for that to happen without
  extra acrobatics.

12 years agocorrect octets in c-string decoding errors
Nikodemus Siivola [Thu, 19 Apr 2012 10:41:28 +0000 (13:41 +0300)]
correct octets in c-string decoding errors

  Also add SAP-REF-OCTETS for grabbing a vector of bytes from
  memory. We'll need it elsewhere as well.

  Fixes lp#985505

12 years agoMicro-optimize machine code for some register tests on x86[-64].
Lutz Euler [Tue, 17 Apr 2012 18:52:09 +0000 (20:52 +0200)]
Micro-optimize machine code for some register tests on x86[-64].

Replace all occurrences of (INST OR REG REG) with (INST TEST REG REG)
in VOPs and assembly routines. This removes, for the next read of REG,
the dependency on this instruction, allowing more instruction-level
parallelism, so is potentially faster. Moreover, most of the time the
next instruction is a conditional branch, which allows processors that
support macro-op fusion to fuse the TEST (but not the OR) with this
branch instruction, reducing the resources needed to decode and execute
the two instructions, which again is potentially faster.

12 years agoMicro-optimization: Shorter encoding of MOVZX in more cases on x86-64
Lutz Euler [Tue, 17 Apr 2012 17:42:54 +0000 (19:42 +0200)]
Micro-optimization: Shorter encoding of MOVZX in more cases on x86-64

The assembler instruction MOVZX is already assembled as a straight
32-bit MOV when it is used to zero-extend a 32-bit source into a 64-bit
register, taking advantage of the processor's implicit zero extension,
sparing the REX prefix (if it was only needed to indicate the 64-bit
size) and thus reducing code size. Towards the same goal, change
zero-extensions of 8- or 16-bit sources into a 64-bit register to use
the corresponding 32-bit register as the destination instead, in the
process refactoring EMIT-MOVE-WITH-EXTENSION for more OAOO-ness.

12 years agoMicro-optimize some type tests on x86-64 for code size.
Lutz Euler [Tue, 17 Apr 2012 16:26:48 +0000 (18:26 +0200)]
Micro-optimize some type tests on x86-64 for code size.

In SIGNED-BYTE-64-P and CHECK-SIGNED-BYTE-64, if possible, spare a REX
prefix by using a 32-bit instead of a 64-bit register move instruction.

In UNSIGNED-BYTE-64-P and CHECK-UNSIGNED-BYTE-64 use AL instead of RAX
to test the lowtag.

12 years agoMicro-optimize LENGTH/LIST and VALUES-LIST on x86-64 for code size.
Lutz Euler [Tue, 17 Apr 2012 16:26:48 +0000 (18:26 +0200)]
Micro-optimize LENGTH/LIST and VALUES-LIST on x86-64 for code size.

As already common in several other places prefer a 32-bit temporary over
a 64-bit one for type checking in these VOPs to possibly spare a REX
prefix.

12 years agoMicro-optimize type tests using widetag on x86-64.
Lutz Euler [Tue, 17 Apr 2012 13:20:05 +0000 (15:20 +0200)]
Micro-optimize type tests using widetag on x86-64.

Change %TEST-HEADERS not to load the widetag of the value to be tested
into AL if only a single comparison is needed on it, instead do the
comparison directly with the memory operand. This is smaller and needs
fewer execution ressources.

This is a port of what is done on x86 already, with two modifications:

 * Widetag ranges starting with the smallest widetag or ending with the
   largest widetag use the memory operand here but go through AL on x86.

 * x86 exploits the specially choosen widetag values of components of
   compound types (like BASE-STRING) to test for these types with only
   an additional "and" operation but still only a single comparison.
   This can't be done on x86-64 currently as under 64-bit wordsize the
   widetag values are different and don't have the necessary property
   (namely to differ in only a single bit).

Additionally, when AL needs to be loaded, use EAX instead so as not to
write a partial register (as recommended by the processors' optimization
guides). Same code size, potentially faster.

Silence a "deleting unreachable code" warning during build by removing
an IF and the corresponding unreachable expression.

12 years agouse fixnums for x86-64 array accessor VOPs when possible
Nathan Froyd [Sun, 15 Apr 2012 23:45:51 +0000 (19:45 -0400)]
use fixnums for x86-64 array accessor VOPs when possible

Now that we have fixnums with 1-bit tags on x86-64, we can use them
directly for accessing arrays with 16- and 32-bit elements, rather
than converting to unsigned words first.

This patch is originally from Paul Khuong:

http://paste.lisp.org/display/128545

12 years agoCorrect disassembly of some SSE instructions on x86-64.
Lutz Euler [Sat, 14 Apr 2012 15:46:44 +0000 (17:46 +0200)]
Correct disassembly of some SSE instructions on x86-64.

CVTSD2SI, CVTSS2SI, CVTTSD2SI and CVTTSS2SI used to print a source
memory operand with a size indicator wrongly indicating the size of
the destination, for example "CVTTSS2SI RDX, QWORD PTR [RBP-8]".
Correct this by printing the memory reference without a size indicator
as the size of the source is implicit in the instruction. Remove an
argument type and a print function that were used only for these
instructions.

12 years agogencgc: tune the recent "more aggressive GC" changes
Nikodemus Siivola [Sat, 14 Apr 2012 08:08:45 +0000 (11:08 +0300)]
gencgc: tune the recent "more aggressive GC" changes

 * Don't account fresh objects against auto_gc_trigger unless they're larger
   than bytes_consed_between_gcs: smaller objects don't mess up the logic so
   badly, and it's better not to force early promotion of fresh objects unless
   we have to.

 * Put the unqueality in setting auto_gc_trigger the right way around...

 Fixes lp#981106 (regression from 6b1b11a6c51e1c29aee947f1fde7f91651ca3763)

12 years agomicro-optimize allocation sequences, special variable binding on x86-64
Nathan Froyd [Fri, 13 Apr 2012 17:58:41 +0000 (13:58 -0400)]
micro-optimize allocation sequences, special variable binding on x86-64

Move the ALLOC-REGION, PSEUDO-ATOMIC-BITS, and BINDING-STACK-* slots
closer to the beginning of the thread structure.  This change ensures
that the offsets for those slots are < 128 bytes, which in turns enables
shorter encodings for all accesses to this structure from Lisp code.

Code size of the C runtime was negligibly affected by this change.

12 years agos/8/n-word-bytes/ in x86-64's macros.lisp where appropriate
Nathan Froyd [Fri, 13 Apr 2012 17:54:22 +0000 (13:54 -0400)]
s/8/n-word-bytes/ in x86-64's macros.lisp where appropriate

12 years agomicro-optimize FIXNUMP on known (signed-byte 64) quantities on x86-64
Nathan Froyd [Fri, 13 Apr 2012 17:25:31 +0000 (13:25 -0400)]
micro-optimize FIXNUMP on known (signed-byte 64) quantities on x86-64

Also attempt to keep things working for those who want smaller fixnums.

12 years agouse LEA Y, [X+X] instead of LEA Y, [X*2] where appropriate on x86-64
Nathan Froyd [Fri, 13 Apr 2012 15:05:18 +0000 (11:05 -0400)]
use LEA Y, [X+X] instead of LEA Y, [X*2] where appropriate on x86-64

The former instruction is slightly smaller.  Keep the old form around
for people who want to compile x86-64 with smaller fixnums.

12 years agoformat: Signal errors when colinc and mincol are not positive integers.
Stas Boukarev [Fri, 13 Apr 2012 17:02:43 +0000 (21:02 +0400)]
format: Signal errors when colinc and mincol are not positive integers.

Various directives have colinc and mincol parameters, which should be
> 0 and >= 0 respectively.

12 years agosupport funcallable-instances in ROOM/map-allocated-objects
Christophe Rhodes [Fri, 13 Apr 2012 15:16:37 +0000 (16:16 +0100)]
support funcallable-instances in ROOM/map-allocated-objects

12 years agoFix bug in unsigned modular arithmetic using a signed implementation
Christophe Rhodes [Thu, 5 Apr 2012 18:55:05 +0000 (19:55 +0100)]
Fix bug in unsigned modular arithmetic using a signed implementation

If we aim to be clever by implementing an unsigned modular arithmetic
computation using signed arithmetic, we need to make sure that we
don't accidentally contaminate the computation with any extraneous
high bits.  This means that we must be sure to cut constants to the
appropriate width, as well as computations, so do so; this fixes
bug #974406 from Paul Dietz.  (In addition the change from cutting
to the requested width to the implementation width fixes #903821,
so Go Team!)

Test cases.  Minimally horrible test case for #903821; far worse
suggestions were made on #sbcl IRC...

12 years agominor fix to alien.impure.lisp test
Christophe Rhodes [Thu, 5 Apr 2012 15:54:56 +0000 (16:54 +0100)]
minor fix to alien.impure.lisp test

Don't signal a compiler-note with ERROR to indicate failure; it bypasses
the handlers and aborts the entire file.  Use (error "bad note: ~A" note)
instead

12 years agorun-program: proper handling of :if-input-does-not-exist NIL.
Stas Boukarev [Fri, 13 Apr 2012 12:09:27 +0000 (16:09 +0400)]
run-program: proper handling of :if-input-does-not-exist NIL.

:output existing-file :if-output-exists NIL and
:input non-existing-file :if-input-does-not-exist NIL signalled errors
instead of just returning NIL as specified.

Fixes lp#968836

12 years agopprint: Make sure that lists like (loop . 10) can be printed.
Stas Boukarev [Fri, 13 Apr 2012 11:38:53 +0000 (15:38 +0400)]
pprint: Make sure that lists like (loop . 10) can be printed.

pprint signaled an error when called on improper lists with
a car being a symbol from CL (loop, macrolet, flet, and some others).

12 years agoensure-directory-exists: didn't work when *d-p-d* had NAME or TYPE components.
Stas Boukarev [Fri, 13 Apr 2012 11:19:20 +0000 (15:19 +0400)]
ensure-directory-exists: didn't work when *d-p-d* had NAME or TYPE components.

(let ((*default-pathname-defaults* #p"/tmp/foo"))
     (ensure-directories-exist "/"))
signalled an error that "/" doesn't exist because it was checking for "/foo".

12 years agorobustify (deadlock-detection interrupts) test
Nikodemus Siivola [Fri, 13 Apr 2012 11:00:21 +0000 (14:00 +0300)]
robustify (deadlock-detection interrupts) test

    1. Make sure the desired "tricky" ordering happens.
    2. Make sure threads can't exit before they're intrerupted.

  Next time I commit a test that relies on SLEEP without a comment explaining
  (1) why it is necessary and there isn't a better alternative (2) what the
  ordering the tests is trying to achieve actually ise... please hit me with a
  stick. Hard.

12 years agocleanup: remove cast to (unsigned long) from print_ptr()
Nikodemus Siivola [Wed, 28 Mar 2012 11:16:54 +0000 (14:16 +0300)]
cleanup: remove cast to (unsigned long) from print_ptr()

12 years agocleanup: partial long cleanup in sniff_code_object and gencgc_apply_code_fixups
Nikodemus Siivola [Wed, 28 Mar 2012 10:40:47 +0000 (13:40 +0300)]
cleanup: partial long cleanup in sniff_code_object and gencgc_apply_code_fixups

  Feels more like an address arithmetic cleanup, though. :)

  Slowly...

12 years agocleanup: gencgc copy_unboxed_object and shared gc_general_copy_object
Nikodemus Siivola [Wed, 28 Mar 2012 10:40:35 +0000 (13:40 +0300)]
cleanup: gencgc copy_unboxed_object and shared gc_general_copy_object

  Implement the first in terms of the second: they're identical except for the
  calling convention. Move the second to gc-internal.h as an inline function.

  Also eliminates a couple of longs.

12 years agocleanup: use size_t for new_areas_index and max_new_areas
Nikodemus Siivola [Wed, 28 Mar 2012 06:03:46 +0000 (09:03 +0300)]
cleanup: use size_t for new_areas_index and max_new_areas

  Two longs down, umpteen to go.

12 years agogencgc: reclaim space more aggressively
Nikodemus Siivola [Fri, 30 Mar 2012 21:56:44 +0000 (00:56 +0300)]
gencgc: reclaim space more aggressively

 * When considering auto_gc_trigger, take the number of bytes about to be
   allocated into account.

 * If bytes_consed_between_gcs is more than the amount of free heap, set next
   GC to occur when half of the remaining free heap has been consumed.

 * Keep track of the size of the largest object allocated between two GCs.
   When collecting garbage, if there isn't enough space to allocate at least
   two such objects before collecting the last generation due a collection,
   extend the collection by one extra generation.

   This works around our tendency to immediately promote large objects to
   generation 1, due to auto_gc_trigger causing a GC _after_ the allocation.

 Fixes lp#936304.

12 years agoMAKE-LEXENV used NCONC on its arguments, which callers did not expect
Nikodemus Siivola [Thu, 29 Mar 2012 15:31:58 +0000 (18:31 +0300)]
MAKE-LEXENV used NCONC on its arguments, which callers did not expect

  Fixes lp#924276.

12 years agomore conservative classoid-name clearing
Nikodemus Siivola [Wed, 28 Mar 2012 13:46:04 +0000 (16:46 +0300)]
more conservative classoid-name clearing

  (SETF (FIND-CLASS X) NIL) should not clear the classoid name if X is
  not the proper name of the class.

  lp#941102

12 years agoplain T and OTHERWISE not allowed in CASE normal-clauses
Nikodemus Siivola [Wed, 28 Mar 2012 13:03:50 +0000 (16:03 +0300)]
plain T and OTHERWISE not allowed in CASE normal-clauses

  lp#959687

12 years agodon't refer to unix namestrings on windows
Nikodemus Siivola [Tue, 27 Mar 2012 07:53:19 +0000 (10:53 +0300)]
don't refer to unix namestrings on windows

12 years agosb-simple-streams: signal an error for bad stream classes in OPEN
Kambiz Darabi [Fri, 6 Jan 2012 08:11:36 +0000 (09:11 +0100)]
sb-simple-streams: signal an error for bad stream classes in OPEN

  Instead of silently returning NIL, signal an error if the class does not
  exist (if argument :class is a symbol) or is not a stream class.

  lp#969352

12 years agobetter REPLACE docstring
Nikodemus Siivola [Wed, 28 Mar 2012 07:00:00 +0000 (10:00 +0300)]
better REPLACE docstring

  lp#965592

12 years ago1.0.56: will be tagged as "sbcl-1.0.56"
Juho Snellman [Thu, 12 Apr 2012 21:07:37 +0000 (21:07 +0000)]
1.0.56: will be tagged as "sbcl-1.0.56"

12 years agoAdd workaround to a flaky semaphore timeout test.
Juho Snellman [Thu, 12 Apr 2012 15:10:25 +0000 (17:10 +0200)]
Add workaround to a flaky semaphore timeout test.

12 years agoAdd an entry for ASDF upgrade to NEWS
Juho Snellman [Mon, 2 Apr 2012 03:50:46 +0000 (05:50 +0200)]
Add an entry for ASDF upgrade to NEWS

12 years agoclarify the make.sh --with-feature and --without-feature syntax in INSTALL
Nikodemus Siivola [Fri, 6 Apr 2012 08:47:17 +0000 (11:47 +0300)]
clarify the make.sh --with-feature and --without-feature syntax in INSTALL

  Documentation-only, so going in despite the freeze.

12 years agocontrib/asdf: Import asdf 2.20 from upstream.
Juho Snellman [Sun, 25 Mar 2012 21:16:49 +0000 (23:16 +0200)]
contrib/asdf: Import asdf 2.20 from upstream.

   * lp#933112

12 years agoFix build on PPC/Darwin
Christophe Rhodes [Sun, 25 Mar 2012 06:41:21 +0000 (07:41 +0100)]
Fix build on PPC/Darwin

12 years agoFixup fewer complaints about hairy lexical environments
Christophe Rhodes [Sat, 24 Mar 2012 14:00:08 +0000 (14:00 +0000)]
Fixup fewer complaints about hairy lexical environments

In particular, if the function has been requested NOTINLINE, and that name
has never been INLINE or MAYBE-INLINE, there should be no compiler note.
Include a test case and a NEWS entry for posterity.

12 years agoDon't signal a note on NOTINLINE non-toplevel functions.
Stas Boukarev [Sat, 24 Mar 2012 13:28:30 +0000 (17:28 +0400)]
Don't signal a note on NOTINLINE non-toplevel functions.

When a function was declared NOTINLINE, and later defined not at the
toplevel, SBCL signaled a note saying that it can't inline it.

Fixes lp#963530.

12 years agoCloses https://bugs.launchpad.net/sbcl/+bug/911027
Martin Cracauer [Fri, 23 Mar 2012 17:39:54 +0000 (13:39 -0400)]
Closes https://bugs.launchpad.net/sbcl/+bug/911027

Fix copy-structure.  When copying from stack to heap, garbage could
end up in the heap making GC unhappy.  Thanks to James Knight.

12 years agoMake SBCL buildable by Clang.
Stas Boukarev [Sun, 11 Mar 2012 03:41:29 +0000 (07:41 +0400)]
Make SBCL buildable by Clang.

The only changes needed were a modification to use $CC when building
contribs, and inline declaration incompatibility for a couple of
functions.

Closes lp#658414.

12 years agoensure-directories-exist: Signal an error when trying to create a
Stas Boukarev [Thu, 8 Mar 2012 20:13:49 +0000 (00:13 +0400)]
ensure-directories-exist: Signal an error when trying to create a
directory with the same name as an existing file.

Previously (ensure-directories-exist "/foo/bar/"), where /foo/bar is a
regular file, just silently returned "/foo/bar/", NIL.

12 years agoClean up OpenBSD makefile fragments a little.
Joshua Elsasser [Sun, 19 Feb 2012 23:25:42 +0000 (15:25 -0800)]
Clean up OpenBSD makefile fragments a little.

It seems -export-dynamic is no longer necessary for
tools-for-build. Perhaps it never was, and I was just confused.

12 years agoRemove an OpenBSD note in the README which is no longer necessary.
Joshua Elsasser [Sun, 19 Feb 2012 22:53:51 +0000 (14:53 -0800)]
Remove an OpenBSD note in the README which is no longer necessary.

OpenBSD's behavior has not changed, but the default SBCL allocation
size was changed some time ago to work with the default OpenBSD
resource limits.

12 years agocoreparse.c: Fix a typo WORD_FTMX -> WORD_FMTX.
Stas Boukarev [Sun, 19 Feb 2012 04:00:08 +0000 (08:00 +0400)]
coreparse.c: Fix a typo WORD_FTMX -> WORD_FMTX.

12 years agogetf: Correct docstring.
Stas Boukarev [Sat, 11 Feb 2012 21:54:27 +0000 (01:54 +0400)]
getf: Correct docstring.

Use `PLACE' instead of `Place' when referring to the variable.

Fixes lp#930751

12 years agoweakening hairy integer types
Nikodemus Siivola [Mon, 23 Jan 2012 12:27:17 +0000 (14:27 +0200)]
weakening hairy integer types

 Fixes lp#913232.

 Deal with intersection types and unions including non-integer component
 types, such as:

   (OR (INTEGER * -1) (AND (SATISFIES ODDP) (INTEGER 1)))

12 years agomaybe-update-info-for-gf: Use KEYWORD-SPEC-NAME for keyword parameters.
Stas Boukarev [Sun, 22 Jan 2012 03:21:10 +0000 (11:21 +0800)]
maybe-update-info-for-gf: Use KEYWORD-SPEC-NAME for keyword parameters.

Use KEYWORD-SPEC-NAME instead of KEYWORDICATE to handle keyword
parameter definitions like ((:keyword var) default).

Patch by Andy Hefner.

12 years agoAdd patches from Aymeric Vincent to fix sb-posix on recentish NetBSD.
Jim Wise [Tue, 17 Jan 2012 16:14:41 +0000 (11:14 -0500)]
Add patches from Aymeric Vincent to fix sb-posix on recentish NetBSD.

There is some possibility that this will break one of the sb-posix tests on FreeBSD:

  The "rmdir" patch needs some input from FreeBSD users.
  "rmdir /" returns EBUSY on NetBSD. Given the recent commit
  2a9b33fc45842ec0335fef2988e07337ae8f1fc7 on october, 17. 2011, it looks
  like OpenBSD and Darwin return EISDIR, but it's clearly not the case of
  NetBSD with a (usual) FFS file system.

  In short, either sbcl is currently broken on FreeBSD wrt the rmdir test
  and my patch will fix it, or my patch will break it and we need to include
  freebsd in the list of OSes producing EISDIR upon "rmdir /".

12 years ago1.0.55: will be tagged as "sbcl-1.0.55"
Juho Snellman [Mon, 9 Jan 2012 02:08:08 +0000 (03:08 +0100)]
1.0.55: will be tagged as "sbcl-1.0.55"

12 years agoMark :no-consing :specialized-dx-vectors as failing on x86.
Juho Snellman [Mon, 9 Jan 2012 02:05:53 +0000 (03:05 +0100)]
Mark :no-consing :specialized-dx-vectors as failing on x86.

12 years agogit: add missing git hook scripts from SourceForge
Nikodemus Siivola [Mon, 2 Jan 2012 10:18:07 +0000 (12:18 +0200)]
git: add missing git hook scripts from SourceForge

  We've been using these for a while now, but I neglected to stash copies in
  the repository.

  Also instructions for updating them, since it isn't the most intuitive thing
  in the world.

12 years agotwiddle script.test.sh
Nikodemus Siivola [Mon, 2 Jan 2012 09:56:03 +0000 (11:56 +0200)]
twiddle script.test.sh

  Can't open /dev/stdout on all platforms -- but happily for the behaviour we
  want to test we don't have to.

  Also add a compile of variations on the theme.

12 years agoruntime: handle KERN_ABORTED in the darwin semaphore implementation
Nikodemus Siivola [Wed, 7 Dec 2011 09:26:45 +0000 (11:26 +0200)]
runtime: handle KERN_ABORTED in the darwin semaphore implementation

  Analogous to EINTR.

12 years agodefknown SC-NUMBER-OR-LOSE as foldable
Nikodemus Siivola [Tue, 6 Dec 2011 00:01:01 +0000 (02:01 +0200)]
defknown SC-NUMBER-OR-LOSE as foldable

  No point calling it all the time with constant arguments.

12 years agouse %VECTOR-RAW-BITS in %BIT-POSITION/[0|1]
Nikodemus Siivola [Fri, 30 Dec 2011 13:07:14 +0000 (15:07 +0200)]
use %VECTOR-RAW-BITS in %BIT-POSITION/[0|1]

 No need to pin, and it even performs a tiny bit better than using explicit
 word -> byte address computations.

12 years agopackage locks and compile-time effects of DEFCLASS
Nikodemus Siivola [Fri, 30 Dec 2011 12:54:52 +0000 (14:54 +0200)]
package locks and compile-time effects of DEFCLASS

  DEFCLASS FTYPE used to break SBCL, but package locks didn't catch it.

12 years agostack-allocatable fill-initialized specialized arrays, part tres
Nikodemus Siivola [Thu, 29 Dec 2011 18:32:31 +0000 (20:32 +0200)]
stack-allocatable fill-initialized specialized arrays, part tres

 lp#902351

 Mark %CHECK-BOUND as DX-SAFE, so that vectors of unknown size can be stack
 allocated.

12 years agofaster FIND and POSITION on bit-vectors
Nikodemus Siivola [Tue, 13 Dec 2011 15:45:34 +0000 (17:45 +0200)]
faster FIND and POSITION on bit-vectors

 Read data a word at a time for efficiency's sake.

 Could do even better with VOPs, but this already wins hugely on sparse
 vectors -- and works on all backends. (Tested on both little- and big-endian
 hosts.)

 This also makes constraint propagation in sparse universes a bit less sucky.

12 years agoFix control stack scavenging for dynamic-extent allocation.
Alastair Bridgewater [Fri, 2 Dec 2011 17:39:00 +0000 (12:39 -0500)]
Fix control stack scavenging for dynamic-extent allocation.

  * Non-CONS objects on the control stack can cause... problems
in scavenge().  Rewrite scavenge_control_stack() to contain the
appropriate (simpler) scavenge code directly.

12 years agoMove control-stack scavenging to gc-common.c.
Alastair Bridgewater [Thu, 10 Nov 2011 20:37:40 +0000 (15:37 -0500)]
Move control-stack scavenging to gc-common.c.

  * Instead of having slightly-divergent copies of the control
stack scavenging logic for both GENCGC and CHENEYGC, move the
GENCGC version (which is a separate function) to gc-common.c,
and alter CHENEYGC to use it instead of doing its own thing
inline.

12 years agotests: Raw instances shouldn't stack-allocate on most targets.
Alastair Bridgewater [Fri, 28 Oct 2011 23:04:25 +0000 (19:04 -0400)]
tests: Raw instances shouldn't stack-allocate on most targets.

  * We possibly should be testing to make sure that they /do/
cons, but we can live with not having an expected failure
message for a situation that would take a lot of careful work
on the compiler and GC to improve.

12 years agoDX structs with raw slots only allowed on conservative gencgc.
Alastair Bridgewater [Thu, 27 Oct 2011 13:16:08 +0000 (09:16 -0400)]
DX structs with raw slots only allowed on conservative gencgc.

  * Unless the control stack is conservatively scavenged, any
unboxed data could lead the GC to either corrupt the stack,
corrupt the heap, or just die screaming.

  * Thus, all unboxed data must be stored on the number stack
on such systems.  However, the number stack isn't scavenged
for boxed data, so we can't store any object that contains
both boxed and unboxed words if the unboxed words can appear
to the GC as anything other than a FIXNUM (thus, aligned
pointers are safe to store on the control stack).

  * All INSTANCE objects have a boxed slot, the LAYOUT slot.
If an instance also has raw slots then it cannot go on either
stack, and must be heap-allocated.

  * And none of this applies if the stack is conservatively
scavenged, which means (and gencgc c-stack-is-control-stack).
On such targets, we can dump whatever we want to the control
stack, and the GC won't complain at all.

12 years agoFix build on non-GENCGC targets.
Alastair Bridgewater [Wed, 14 Dec 2011 19:43:39 +0000 (14:43 -0500)]
Fix build on non-GENCGC targets.

  * Commit 8ee61a7761181511d15690246eb52d100e233935 introduced a
function with a parameter that is only used on gencgc targets.
Declare it to be ignored on non-gencgc targets.

12 years agox86: Better disassembly of segment-prefixes.
Lutz Euler [Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)]
x86: Better disassembly of segment-prefixes.

Thanks to Alastair Bridgewater who originally provided these changes
(and the headline above). I adapted his work to fit into the prefix
instruction infrastructure now available. Of his original comments
the following three still apply:

  * Establish a SEG prefix for segment overrides similar
to the X66 data-width prefix.

  * Have the SEG prefilter set an instruction property
for the specific segment being used.

  * Alter PRINT-MEM-ACCESS to output a suitable prefix
for memory addresses when the appropriate instruction
property has been set.

I have abstracted out the segment prefix printing into the new function
MAYBE-PRINT-SEGMENT-OVERRIDE, called from PRINT-MEM-ACCESS, not to make
the latter more lengthy.

Here is an example to show the difference in disassembler output:

Old:

;      0E6:       64               FS-SEGMENT-PREFIX
;      0E7:       8910             MOV [EAX], EDX
;      0E9:       64               FS-SEGMENT-PREFIX
;      0EA:       8B0528000000     MOV EAX, [#x28]

New:

;      0E6:       648910           MOV FS:[EAX], EDX
;      0E9:       648B0528000000   MOV EAX, FS:[#x28]

12 years agoImprove handling of x86[-64] prefix instructions in the disassembler.
Lutz Euler [Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)]
Improve handling of x86[-64] prefix instructions in the disassembler.

Make LOCK, REP, REX and #x66 true prefix instructions on x86[-64].
This changes only the disassembler part of the instruction definitions;
with respect to assembly LOCK already was a true prefix instruction and
REP/REPE/REPNE remain instructions in their own right.

Delete the scores of instruction formats and printer clauses that are
made obsolete by this change. Two printer clauses are still needed for
each of those SSE instructions that use the REX prefix in an infix
position.

An example of the changes in the disassembler output (on x86-64):
Old:

;     5FFC:       F0               LOCK
;     5FFD:       480FB171F9       CMPXCHG [RCX-7], RSI

New:

;       4C:       F0480FB171F9     LOCK CMPXCHG [RCX-7], RSI

12 years agoCorrections to disassembly of SHLD, SHRD and LEA on x86[-64].
Lutz Euler [Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)]
Corrections to disassembly of SHLD, SHRD and LEA on x86[-64].

The double shifts were wrongly matching the bit pattern of some CMOV
variants. Corrected by using another instruction format on x86-64 and
by adding a constraint on the WIDTH field on x86. This made it possible
to enable the variant with an immediate shift count. On x86-64, changed
the maximum immediate shift count from 31 to 63.

Also, on x86-64, one of the printers for LEA was missing a WIDTH field
restriction, thus wrongly matching a "MOV to segment register", too.

12 years agoMake some disassembler parameters effectual.
Lutz Euler [Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)]
Make some disassembler parameters effectual.

In the context of changing the treatment of prefix instructions in the
disassembler I came across somewhat broken code to parametrize it.
This might as well be repaired, so:

Correct the calculation of the DSTATE's ARGUMENT-COLUMN which is
intended to set a minimal field width for the opcode column. It needs
to take *DISASSEM-INST-COLUMN-WIDTH* and a few more column separators
into account. So as not to confuse users, restore the previous behaviour
by setting *DISASSEM-OPCODE-COLUMN-WIDTH* to 0.

Don't emit instruction bytes when *DISASSEM-INST-COLUMN-WIDTH* is 0.

Whitespace correction in ALIGNMENT-HOOK.

Playing with these two parameters allows to select different disassembly
formats (example from x86-64):

Current:

;      E11: L7:   4881FB17001020   CMP RBX, 537919511
;      E18:       0F8480000000     JEQ L13

(setf SB-DISASSEM::*DISASSEM-INST-COLUMN-WIDTH* 0)

;      E11: L7:   CMP RBX, 537919511
;      E18:       JEQ L13

(setf SB-DISASSEM:*DISASSEM-OPCODE-COLUMN-WIDTH* 8)

;      E11: L7:   CMP     RBX, 537919511
;      E18:       JEQ     L13

12 years agoMake the disassembler understand instruction prefixes.
Lutz Euler [Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)]
Make the disassembler understand instruction prefixes.

Instructions having NIL as their printer are treated as prefixes,
meaning that they are printed on the same line as the following
instruction. If an instruction's PRINT-NAME is NIL, too, this prefix
is not printed (but prefilters etc. are run). Any number of prefix
instructions can occur in immediate succession before a non-prefix
instruction.

This commit only provides the infrastructure; its impact is currently
limited as there aren't any instructions having NIL as their printer.

The motivation for this change comes from x86[-64]: One goal is to make
instructions using prefixes like LOCK and REP print nicer, the other
to reduce the combinatorial explosion of instruction formats in the
disassembler that is currently needed to deal with the possible
combinations of the REX and the operand size override (#x66) prefixes
and that would become unbearable once the aforementioned and the segment
override prefixes are added.

Extend the existing beginnings of support for prefix instructions in
MAP-SEGMENT-INSTRUCTIONS to collect prefix names and to print them at
the right time, which is at the next non-prefix instruction, when a
non-decodable instruction is encountered or at the end of the segment.
Change the semantics of DSTATE-INST-PROPERTIES: This list is now emptied
only after a non-prefix instruction has been processed.

Abstract out the filling of the column containing the instruction bytes
into the new function PAD-INST-COLUMN and use it in several places.

Clean up whitespace and improve line breaks.

12 years agoFix EQL constraint propagation on constant assigned closure variables
Paul Khuong [Tue, 13 Dec 2011 18:26:05 +0000 (13:26 -0500)]
Fix EQL constraint propagation on constant assigned closure variables

 * Constant lvars can now be references to assigned-to closure-
   converted lambda-vars, which don't have consets.  Just always use
   lvar-value, at the cost of a slight potential slowdown due to more
   calls to find-constant.

   Reported by Eric Marsden on sbcl-devel.

 * Also, canonicalize whitespace in dynamic-extent tests.

 Fixes lp#903838.

12 years ago(NO-CONSING SPECIALIZED-DX-VECTORS) fails on sunos/x86. Mark this.
Jim Wise [Tue, 13 Dec 2011 15:58:49 +0000 (10:58 -0500)]
(NO-CONSING SPECIALIZED-DX-VECTORS) fails on sunos/x86.  Mark this.

12 years agoprotect against read-time package-lock circumvention from LOCKED::(BAR)
Nikodemus Siivola [Mon, 12 Dec 2011 12:42:35 +0000 (14:42 +0200)]
protect against read-time package-lock circumvention from LOCKED::(BAR)

  Instead of binding *PACKAGE*, bind *READER-PACKAGE* which only
  affects the package READ-TOKEN interns into in the absence of a
  prefix.

  lp#902806

12 years agoremove etags as a build-time dependency
Nikodemus Siivola [Mon, 12 Dec 2011 12:34:56 +0000 (14:34 +0200)]
remove etags as a build-time dependency

  Do try to build TAGS by default, but if etags isn't there, don't
  make a fuss.

  lp#903145

12 years agoFix clisp-hosted build.
Joshua Elsasser [Sat, 10 Dec 2011 22:18:01 +0000 (14:18 -0800)]
Fix clisp-hosted build.

12 years agostack-allocatable fill-initialized specialized arrays, take 2
Nikodemus Siivola [Sat, 10 Dec 2011 21:01:19 +0000 (23:01 +0200)]
stack-allocatable fill-initialized specialized arrays, take 2

  Really fix lp#902537.

  Turns out multiple references to the stack allocated vector complicate
  things /just/ sufficiently the that DX machinery can't keep up. (I because
  the code that allocates and initializes the vector isn't substituted at the
  use-site due to multiple references.)

  While it would be nice to make it smart enough to deal with
  non-let-converted WITH-ARRAY-DATA, that looks a bit tricky... so instead
  simplify things in the FILL transform when the vector is a simple-array.

12 years agofaster VECTOR-SUBSEQ*
Nikodemus Siivola [Sat, 10 Dec 2011 17:07:53 +0000 (19:07 +0200)]
faster VECTOR-SUBSEQ*

  Use a WITH-ARRAY-DATA to get to the underlying vector, and use a widetag
  dispatch table to pick the correct SUBSEQ implementation for the underlying
  type.

  This is actually just as fast even for simple strings as STRING-SUBSEQ*, so
  throw it out.

  Also make inlining SUBSEQ conditional on SPEED > SPACE now that the
  out-of-line version doesn't suck so much.

  Fixes lp#902537.

12 years agostack-allocatable fill-initialized specialized arrays
Nikodemus Siivola [Sat, 10 Dec 2011 00:25:51 +0000 (02:25 +0200)]
stack-allocatable fill-initialized specialized arrays

 I *think* we had this working earlier already, but it's been broken at least
 for a while now since there were no tests for it.

 Add a DEFKNOWN to the array byte bashers, providing the RESULT-ARG -- and
 make them return the sequence.

 Replace the unused and bitrotted UNSAFE IR1 attribute with its inverse:
 DX-SAFE, and use that togather with RESULT-ARG to allow multiple refs to
 potentially DX leafs. Still accept UNSAFE in DEFKNOWNs occurring in
 user-code, but ignore it and give a style-warning.

 For now, add DX-SAFE to LENGTH and VECTOR-LENGTH, which is enough for our
 purposes.

 Fixes lp#902351.

12 years agoremove MUFFLE-CONDITION from the FILL transform
Nikodemus Siivola [Fri, 9 Dec 2011 23:12:27 +0000 (01:12 +0200)]
remove MUFFLE-CONDITION from the FILL transform

  It hides failure to stack allocate results of a MAKE-ARRAY with non-zero
  initial-element and non-T element-type.

  Part of lp#902351.

12 years agomake DESCRIBE report IR1 attributes for known functions
Nikodemus Siivola [Sat, 10 Dec 2011 10:27:08 +0000 (12:27 +0200)]
make DESCRIBE report IR1 attributes for known functions

12 years agofix errors from stack allocation compiler notes
Nikodemus Siivola [Fri, 9 Dec 2011 20:51:55 +0000 (22:51 +0200)]
fix errors from stack allocation compiler notes

  AKA, error reporting is hard.

12 years agoWITH-SPINLOCK compatibility layer was broken
Nikodemus Siivola [Fri, 9 Dec 2011 19:00:44 +0000 (21:00 +0200)]
WITH-SPINLOCK compatibility layer was broken

  Copy-paste damage from WITH-RECURSIVE-LOCK, looks like.  We don't have a
  WITH-LOCK and never did, should be WITH-MUTEX.

12 years agorefactor FOP table and stack handling
Nikodemus Siivola [Fri, 9 Dec 2011 18:39:49 +0000 (20:39 +0200)]
refactor FOP table and stack handling

 Just two special variables *FOP-TABLE* and *FOP-STACK*.

 Both hold a simple-vector, whose first index holds the index of the last
 element. These are always freshly allocated -- no more *FREE-FOP-TABLES*
 dirtying up the old generations.

 Define a semi-opaque interface for manipulating the stack and the
 table. (Mainly replacing explicit SVREF's with REF-FOP-TABLE.)

 ...and lo! Our fasl-loading speed sucks 5-10% less.

12 years agodelete *FASL-SYMBOL-BUFFER*
Nikodemus Siivola [Fri, 9 Dec 2011 15:04:52 +0000 (17:04 +0200)]
delete *FASL-SYMBOL-BUFFER*

  Instead allocate the right-sized string every time, and add
  :NO-COPY option to INTERN* and use it in AUX-FOP-INTERN to
  avoid copying when interning.

12 years agorename FOP-INTERN AUX-FOP-INTERN for clarity
Nikodemus Siivola [Fri, 9 Dec 2011 15:00:00 +0000 (17:00 +0200)]
rename FOP-INTERN AUX-FOP-INTERN for clarity

  ...so as not to confuse it with actual FOPs.

12 years agouse FAST-READ-BYTE in LOAD-S-INTEGER
Nikodemus Siivola [Fri, 9 Dec 2011 14:56:10 +0000 (16:56 +0200)]
use FAST-READ-BYTE in LOAD-S-INTEGER

  No reason not to.

12 years agooptimize READ-STRING-AS-[BYTES|UNSIGNED-BYTE-32]
Nikodemus Siivola [Fri, 9 Dec 2011 08:26:00 +0000 (10:26 +0200)]
optimize READ-STRING-AS-[BYTES|UNSIGNED-BYTE-32]

  Use FAST-READ-BYTE / FAST-READ-U-INTEGER, and add a separate
  READ-BASE-STRING-AS-BYTES.

  This actually makes a difference in FASL-loading speed.

12 years agoeasier to read FAST-READ-U-INTEGER expansion
Nikodemus Siivola [Fri, 9 Dec 2011 13:42:04 +0000 (15:42 +0200)]
easier to read FAST-READ-U-INTEGER expansion

12 years agoFAST-READ-BYTE refactoring
Nikodemus Siivola [Fri, 9 Dec 2011 08:23:24 +0000 (10:23 +0200)]
FAST-READ-BYTE refactoring

  Change PREPARE-FOR-FAST-READ-BYTE into WITH-FAST-READ-BYTE.

  DONE-WITH-FAST-READ-BYTE is gone.

  FAST-READ-BYTE is a local inline function instead of a macro.

12 years agoMake COERCE on characters more standard-conforming.
Lutz Euler [Fri, 9 Dec 2011 20:25:08 +0000 (21:25 +0100)]
Make COERCE on characters more standard-conforming.

Characters could be coerced to subtypes of CHARACTER to which they
don't belong. Also, character designators that are not characters
could be coerced to proper subtypes of CHARACTER. Make all of these
instead signal an error as required by CLHS COERCE.

Add test cases, both for unicode-enabled and non-unicode-enabled SBCL.

Fixes lp#841312.

12 years agoAdd tools-for-build/determine-endianness to .gitignore.
Alastair Bridgewater [Fri, 9 Dec 2011 16:23:44 +0000 (11:23 -0500)]
Add tools-for-build/determine-endianness to .gitignore.

  * Nothing more need be said.