sbcl.git
12 years agoFixnum and unsigned-fixnum array cleanups.
Alastair Bridgewater [Sat, 20 Feb 2010 23:43:13 +0000 (18:43 -0500)]
Fixnum and unsigned-fixnum array cleanups.

  * Rename {arraytype}-{elementtype1} to {arraytype}-{elementtype2} for
{arraytype} in (SIMPLE-ARRAY VECTOR), {elementtype1} in
(UNSIGNED-BYTE-29 UNSIGNED-BYTE-60 SIGNED-BYTE-30 SIGNED-BYTE-61) and
{elementtype2} in (UNSIGNED-FIXNUM SIGNED-FIXNUM) across the board
(predicates, tag names, etc.).

  * Cleanup of related conditional compilation.

  * Export n-fixnum-bits (the remaining fixnum representation constant)
from sb!vm instead of having it as an internal symbol of sb!pcl.

  * Original patch by Paul Khuong.

12 years agoChange x86oid modular arithmetic to work if fixnum width changes.
Alastair Bridgewater [Sun, 27 Dec 2009 16:53:45 +0000 (11:53 -0500)]
Change x86oid modular arithmetic to work if fixnum width changes.

  * This is largely (signed-byte {30,61}) => fixnum and smod{30,61} =>
modfx.

  * Thanks to Paul Khuong for the initial patch.

12 years agoFix definition of most-FOOative-fixnum.
Alastair Bridgewater [Sun, 14 Feb 2010 21:29:08 +0000 (16:29 -0500)]
Fix definition of most-FOOative-fixnum.

  * Define in terms of n-positive-fixnum-bits, not some relation between
n-word-bits and n-lowtag-bits.

12 years agoIntroduce sb!vm::fixnum-lowtags
Alastair Bridgewater [Sun, 14 Feb 2010 15:39:18 +0000 (10:39 -0500)]
Introduce sb!vm::fixnum-lowtags

  * This is defined as a list of the exported SB!VM -LOWTAG symbols
bound to integers that are zero when masked with fixnum-tag-mask (in
short, the names of the fixnum lowtags).

  * Replace all direct references to the fixnum lowtags with something
based on fixnum-lowtags.

  * Introduce the corresponding change to genesis, with the predicate
is-fixnum-lowtag instead of testing against specific lowtags.

  * Introduce the corresponding change to the runtime, making fixnump()
check against fixnum-tag-mask instead of comparing individual fixnum
tags.

  * And, while we're redefining fixnump() in terms of the significant
part of the lowtag, do the same with other_immediate_lowtag_p().

12 years agoClean up all use of the *-space-free-pointers.
Alastair Bridgewater [Wed, 23 Dec 2009 13:35:11 +0000 (08:35 -0500)]
Clean up all use of the *-space-free-pointers.

  * These are symbols whose value slots contain unboxed word-aligned
byte pointers.  Thus, they appear to lisp as fixnums.  They are not,
however, guaranteed to be word pointers.

  * Shift by n-fixnum-tag-bits instead of shifting by word-shift or
scaling by n-word-bytes in order to obtain byte pointers.

12 years agoRedefine symbol TLS slot indices.
Alastair Bridgewater [Mon, 28 Dec 2009 21:31:02 +0000 (16:31 -0500)]
Redefine symbol TLS slot indices.

  * Instead of having symbol TLS slots be fixnum indices treat them as
byte offsets from the base of the thread structure.

  * This has no effect on the compiler or backends.

  * TLS slot allocation must now be done in terms of words, not fixnums.

  * In %{set-,}symbol-value-in-thread, use get-lisp-obj-address instead
of scaling the TLS index.

  * Use explicit WORD_SHIFT instead of make_fixnum() / fixnum_value() in
the runtime.

12 years agoImproved GC lossage
Alastair Bridgewater [Sat, 20 Feb 2010 23:40:50 +0000 (18:40 -0500)]
Improved GC lossage

  * Change size_lose() and scav_lose() to indicate the widetag of the
header of the losing object rather than of the pointer to the losing
object.

  * Patch from Paul Khuong.

12 years ago(format t "a~0&b") shouldn't print any newlines.
Stas Boukarev [Tue, 11 Oct 2011 20:20:31 +0000 (00:20 +0400)]
(format t "a~0&b") shouldn't print any newlines.

Fixes lp#867684.

12 years ago1.0.52: will be tagged as "sbcl-1.0.52"
Juho Snellman [Sun, 9 Oct 2011 02:21:04 +0000 (04:21 +0200)]
1.0.52: will be tagged as "sbcl-1.0.52"

12 years agoSleep is apparently still consing on 32-bit platforms, mark test as failing
Juho Snellman [Sun, 9 Oct 2011 01:17:31 +0000 (03:17 +0200)]
Sleep is apparently still consing on 32-bit platforms, mark test as failing

12 years agoRemove the invalid :sleep-many-interrupts test
Juho Snellman [Sun, 9 Oct 2011 01:12:46 +0000 (03:12 +0200)]
Remove the invalid :sleep-many-interrupts test

12 years agoreally fix float rounding on 32-bit platforms
Christophe Rhodes [Fri, 7 Oct 2011 11:39:33 +0000 (12:39 +0100)]
really fix float rounding on 32-bit platforms

Now, as well as not giving completely the wrong answer for most
larger-than-fixnum double floats, we additionally don't try to perform
arithmetic on NIL for larger-than-fixnum single-floats.

12 years agofix run-program misaligned access
Anton Kovalenko [Fri, 30 Sep 2011 10:06:04 +0000 (14:06 +0400)]
fix run-program misaligned access

Thanks to Antoni Grzymala for the report.

12 years agoFix the build on Windows
David Lichteblau [Fri, 30 Sep 2011 08:09:08 +0000 (10:09 +0200)]
Fix the build on Windows

12 years agoIgnore a known failure in script.test.sh on Darwin
David Lichteblau [Thu, 29 Sep 2011 22:40:02 +0000 (00:40 +0200)]
Ignore a known failure in script.test.sh on Darwin

script.test.sh includes a test case that fails on Darwin because of
a bug in SBCL.  However, this is the first release to run this test at
all.  Lacking a proper mechanism to mark the test case as a known
failure on Darwin, skip it entirely on that platform for now.

Thanks to Fare for testing.

12 years agoProbably fix compile on win32 (no sys/mman.h).
Juho Snellman [Thu, 29 Sep 2011 09:06:48 +0000 (11:06 +0200)]
Probably fix compile on win32 (no sys/mman.h).

12 years agoSilence a warning about assignment in conditional
Juho Snellman [Thu, 29 Sep 2011 09:05:06 +0000 (11:05 +0200)]
Silence a warning about assignment in conditional

12 years agoOne missed contrib subdir.
Jim Wise [Fri, 23 Sep 2011 17:54:53 +0000 (13:54 -0400)]
One missed contrib subdir.

12 years agohandle non-standard slot allocations when updating classes
Nikodemus Siivola [Tue, 20 Sep 2011 12:39:18 +0000 (15:39 +0300)]
handle non-standard slot allocations when updating classes

 * Refactor layout comparison to work on the effective slot definition list(s)
   directly -- easier to understand.

 * When new slots with custom allocation are added, add their names to the
   "added" list for UPDATE-INSTANCE-FOR-REDEFINED-CLASS. This is not specified
   by ANSI, but unless we do this those slots don't get initialized.

   Removing custom slots is hairier, as is changing a custom slot into
   a normal slot. Add some tests that poke in this area as well...

 * Replace wrapper-instance-slot-layout and wrapper-class-slots with the
   CLASS-SLOTS lists -- saves space and makes things easier to understand.

   Has a small performance cost for updating instances and SLOT-MISSING. Will
   refactor again if this is critical in the real world.

12 years agocleanup DESCRIBE of symbols naming type specifiers a bit
Christophe Rhodes [Thu, 8 Sep 2011 16:22:53 +0000 (17:22 +0100)]
cleanup DESCRIBE of symbols naming type specifiers a bit

Firstly, don't indent the "... names a type specifier".  But then
wander around in confusion for a while trying to debug where the extra
indentation comes from, before working out that the pprint-newline at
the end of describe-class introduces indentation as well as a newline,
causing the subsequent logical block to be opened at an unexpected
horizontal position.  Fix fix fix.

12 years agoFix (run-program) to cleanup fd handlers
Max Mikhanosha [Sat, 3 Sep 2011 18:38:26 +0000 (14:38 -0400)]
Fix (run-program) to cleanup fd handlers

Signed-off-by: Christophe Rhodes <csr21@cantab.net>

12 years agonews item for float rounding
Christophe Rhodes [Mon, 5 Sep 2011 11:04:50 +0000 (12:04 +0100)]
news item for float rounding

12 years agofix rounding of floats big enough to be bignums
Christophe Rhodes [Sun, 4 Sep 2011 19:27:17 +0000 (20:27 +0100)]
fix rounding of floats big enough to be bignums

Wow, so broken: the attempt to confuse while pretending to do
round-to-even goes back decades to original CMUCL sources.  Rewrite
the bignum branch with a more careful and clear version that is obviously
correct.

Optimizers might want to elide some of the computation on appropriate
platforms: on 32-bit platforms, all single floats outside the fixnum
range are integral, while on 64-bit platforms all single and double floats
outside the fixnum range are integral.  (This could be implemented by
comparing most-fooative-fixnum with fooble-float-significand-byte)

12 years agoremove myself as a provider of official support
Christophe Rhodes [Sun, 4 Sep 2011 18:50:26 +0000 (19:50 +0100)]
remove myself as a provider of official support

12 years agoFix I/O redirection of script.test.sh
David Lichteblau [Fri, 2 Sep 2011 19:30:25 +0000 (21:30 +0200)]
Fix I/O redirection of script.test.sh

With this fix, "run-tests.sh | tee" passes again on Linux.
Thanks to Fare Rideau for the report.

12 years agoBring OPTIMIZATIONS up to date
Paul Khuong [Wed, 31 Aug 2011 13:05:16 +0000 (09:05 -0400)]
Bring OPTIMIZATIONS up to date

 Some of these things were implemented months or a few years ago.

 Also, fix the header for NEWS.

12 years agoMicrooptimization for code size in floating point comparisons on x86-64
Lutz Euler [Tue, 30 Aug 2011 22:41:38 +0000 (18:41 -0400)]
Microoptimization for code size in floating point comparisons on x86-64

This affects EQL on real and complex floats and "=" on floats when at
least one of the two arguments is complex.

Use a 32-bit register as the destination of the MOVMSKP[SD] and the
source of the integer comparison instead of a 64-bit one. This doesn't
change the semantics but makes both instruction's encodings shorter.
If the register is EAX do the comparison on AL as this additionally
shortens the encoding.

Before:

  660F76C1         PCMPEQD XMM0, XMM1
  480F50C0         MOVMSKPS RAX, XMM0
  4883F80F         CMP RAX, 15

After:

  660F76C1         PCMPEQD XMM0, XMM1
  0F50C0           MOVMSKPS EAX, XMM0
  3C0F             CMP AL, 15

12 years agoSmall cleanup to DEFINE-BYTE-BASHERS
Lutz Euler [Tue, 30 Aug 2011 22:40:10 +0000 (18:40 -0400)]
Small cleanup to DEFINE-BYTE-BASHERS

Remove an unneeded SETF of the result of an INCF in a copy loop.
At least on x86[-64] this shortens the generated code in the byte
basher functions by removing a redundant move instruction.

12 years agoMore complete disassembly for XADD and CMPXCHG on x86-64
Paul Khuong [Mon, 29 Aug 2011 05:12:55 +0000 (01:12 -0400)]
More complete disassembly for XADD and CMPXCHG on x86-64

 The new patterns correctly handle REX bytes and operand size override
 bytes (#x66).

12 years agoClean up some SSE instruction format definitions on x86-64
Lutz Euler [Mon, 15 Aug 2011 19:28:03 +0000 (21:28 +0200)]
Clean up some SSE instruction format definitions on x86-64

Remove the instruction formats for some SSE instructions with 8 bit
immediate data, instead make some other formats optionally have an
immediate field.

This makes it necessary to move the default printer definition for
these formats into the SSE shuffle instructions. They were the only
users of these formats that didn't have a printer defined anyway.

12 years agoMore readable disassembler output for SSE shuffle instructions on x86-64
Lutz Euler [Mon, 15 Aug 2011 19:23:28 +0000 (21:23 +0200)]
More readable disassembler output for SSE shuffle instructions on x86-64

Output the immediate byte that contains the shuffle pattern in binary
or quaternary as appropriate with a suitable number of leading zeros.

For the shuffle instructions that use only part of the immediate byte
the assembler asserts that the rest is zero to help catch potential
wrong uses of these instructions.

12 years agoCleanup SSE instruction printers on x86-64
Lutz Euler [Mon, 15 Aug 2011 19:06:46 +0000 (21:06 +0200)]
Cleanup SSE instruction printers on x86-64

Use SSE-INST-PRINTER-LIST in all SSE instruction definitions to reduce
copy and paste programming. Reformat some overly long lines.

12 years agoUpdate the library list on x86/darwin as well when zlib is enabled
Paul Khuong [Sun, 28 Aug 2011 06:56:40 +0000 (02:56 -0400)]
Update the library list on x86/darwin as well when zlib is enabled

12 years agoFix the build on some XCode/OS X version combo by forcing CC=gcc
Paul Khuong [Sun, 28 Aug 2011 03:55:00 +0000 (23:55 -0400)]
Fix the build on some XCode/OS X version combo by forcing CC=gcc

 It was already the case for x86-darwin.

12 years agoOptionally mark pages from cores as de-duplicatable
Paul Khuong [Sun, 28 Aug 2011 03:24:14 +0000 (23:24 -0400)]
Optionally mark pages from cores as de-duplicatable

 Linux supports optimistic virtual-memory-level de-duplication for
 identical pages.  By default, only enable this for compressed cores.
 Runtime options --[no-]merge-core-pages can be used to override the
 default.

 Very much experimental and a hack, but compressed cores would sometimes
 be gratuitously inefficient otherwise.  If/when support is generalized
 to more OSes, figure out how to do this right.

 Thanks to David Lichteblau for the idea.

12 years agoOptional support for zlib-based in-memory deflate/inflate for core files
Paul Khuong [Sun, 28 Aug 2011 03:23:03 +0000 (23:23 -0400)]
Optional support for zlib-based in-memory deflate/inflate for core files

 * As this is based on zlib, only add the dependency when
   :SB-CORE-COMPRESSION is enabled as a build-time feature.  On x86-64,
   compressed cores take about 1/4 the space, but start up in a few
   tenths of a second.

   Unlike gzexe'd executables, compressed images work without writing
   to /tmp.

   If :SB-CORE-COMPRESSION is enabled, trigger compression with the
   :COMPRESSION argument to SAVE-LISP-AND-DIE.

 * Also add a NEWS entry for the literal complex-single-float bugfix

12 years agoAllow use of the --core option with embedded core files
David Lichteblau [Thu, 25 Aug 2011 18:35:34 +0000 (20:35 +0200)]
Allow use of the --core option with embedded core files

Thanks to Anton Kovalenko for implementation suggestions.

12 years agotest for multiply-interrupted sleeps
Nikodemus Siivola [Wed, 24 Aug 2011 12:35:36 +0000 (15:35 +0300)]
test for multiply-interrupted sleeps

  Make sure the time take by the interrupt is tallied
  correctly.

12 years agobe more careful about ,@<constant-atom> and ,.<constant-atom>
Nikodemus Siivola [Wed, 24 Aug 2011 11:52:38 +0000 (14:52 +0300)]
be more careful about ,@<constant-atom> and ,.<constant-atom>

  Specifically, signal a read-time error for those things which COMMA
  special-cases when constructing a splice.

  Fixes lp#770184.

12 years agobetter errors for `(foo ,)
Nikodemus Siivola [Wed, 24 Aug 2011 11:49:09 +0000 (14:49 +0300)]
better errors for `(foo ,)

  Report the trailing comma instead of an unmatched parenthesis.

12 years agoprettier reporting for SIMPLE-READER-ERRORs
Nikodemus Siivola [Wed, 24 Aug 2011 11:33:19 +0000 (14:33 +0300)]
prettier reporting for SIMPLE-READER-ERRORs

  Make the actual error message more prominent,
  and the location information easier to read.

  Also fixes an off-by-one in the location.

12 years agoCreate a dummy test-status.lisp-expr when running shell tests.
Joshua Elsasser [Wed, 24 Aug 2011 04:31:07 +0000 (21:31 -0700)]
Create a dummy test-status.lisp-expr when running shell tests.

The test-status.lisp-expr file isn't used for shell tests, but the
impure runner doesn't know that and tries to read it
anyway. Initialize the file before running shell tests to avoid
reporting failures from the last test run, or failing entirely if it
doesn't exist.

12 years agoEnsure correct alignment for complex single-float literals
Paul Khuong [Tue, 23 Aug 2011 18:57:06 +0000 (14:57 -0400)]
Ensure correct alignment for complex single-float literals

 Only an issue on x86-64: literal complex single-float values used
 directly as operands to SIMD instructions were not correctly aligned
 and extended.  Completion typo fixed.

 Test added.

 Remove misleading comments in negate/conjugate/abs float VOPs while
 we're at it.

 Reported by Eric Marsden on sbcl-devel.

 Fixes lp#832005.

12 years agoFix a typo in NANOSLEEP
Paul Khuong [Tue, 23 Aug 2011 18:49:32 +0000 (14:49 -0400)]
Fix a typo in NANOSLEEP

 Missing pluralization in the #!+darwin code path.

12 years agodisable unsychronized-hash-table test for now
Nikodemus Siivola [Tue, 23 Aug 2011 17:16:50 +0000 (20:16 +0300)]
disable unsychronized-hash-table test for now

  Intermittently causing my laptop to swap instead of terminating with
  an error.

12 years agooptimize pretty-printing strings and bit-vectors
Nikodemus Siivola [Tue, 23 Aug 2011 17:01:37 +0000 (20:01 +0300)]
optimize pretty-printing strings and bit-vectors

  Since strings and bit-vectors use the ugly output in any case,
  exlude them from using PPRINT-ARRAY -- so we don't need to cons up a
  pretty stream when printing strings while *PRINT-PRETTY* is true.

12 years agooops, fix recent NANOSLEEP change
Nikodemus Siivola [Mon, 22 Aug 2011 14:46:20 +0000 (17:46 +0300)]
oops, fix recent NANOSLEEP change

  If the sleep gets interrupted multiple times on Darwin:
  update SECS and NSECS each round.

12 years agoNEWS for 5 last commits
Nikodemus Siivola [Mon, 22 Aug 2011 11:08:30 +0000 (14:08 +0300)]
NEWS for 5 last commits

12 years agoupdate to ASDF 2.017
Nikodemus Siivola [Mon, 22 Aug 2011 10:30:17 +0000 (13:30 +0300)]
update to ASDF 2.017

12 years agoignore non-function FTYPEs
Nikodemus Siivola [Wed, 17 Aug 2011 09:28:29 +0000 (12:28 +0300)]
ignore non-function FTYPEs

  Fixes lp#738464.

  Give a style-warning and ignore the bad type.

12 years agonon-consing NANOSLEEP
Nikodemus Siivola [Tue, 16 Aug 2011 17:58:41 +0000 (20:58 +0300)]
non-consing NANOSLEEP

  ...and hence SLEEP as well.

12 years agoextend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types
Nikodemus Siivola [Tue, 16 Aug 2011 11:26:28 +0000 (14:26 +0300)]
extend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types

 Fixes lp#826971.

12 years agouse WEAKEN-INTEGER-TYPE in ARRAY-IN-BOUNDS-P
Nikodemus Siivola [Mon, 15 Aug 2011 21:21:54 +0000 (00:21 +0300)]
use WEAKEN-INTEGER-TYPE in ARRAY-IN-BOUNDS-P

  The type of the bound might be a union-type. WEAKEN-INTEGER-TYPE
  gives us the ends of a range.

  lp#826970

12 years ago1.0.51: will be tagged as "sbcl-1.0.51"
Juho Snellman [Sat, 20 Aug 2011 23:15:10 +0000 (01:15 +0200)]
1.0.51: will be tagged as "sbcl-1.0.51"

12 years agofix bogus deadlocks from interrupts and GCs
Nikodemus Siivola [Mon, 15 Aug 2011 11:33:49 +0000 (14:33 +0300)]
fix bogus deadlocks from interrupts and GCs

 lp#807475

 Going in despite the freeze since this is a regression that can
 semi-randomly break correct code. *ouch*

 Thanks to Bart Bortta and #sbcl for the analysis.

 Problem 1:

   T1 holds L1

   T2 is waiting for L1

   T2 is interrupted, interrupt handler grabs L2

   T1 starts waiting on L2

   Prior to this patch, when GET-MUTEX in T2's interrupt handler grabbed
   L2 is marked T2 as still waiting for L1 -- which is not true until
   the interrupt handler returns.

 Problem 2:

   T1 holds L1

   T2 is waiting for L1

   GC is triggered in T2 inside GET-MUTEX

   T2 grabs *ALREADY-IN-GC* lock

   GC is triggered in T1, T1 tries to get *ALREADY-IN-GC* lock.

   Prior to this patch, when T1 detects a bogus deadlock as T2 has
   been marked as waiting for L1 -- which is not true until the GC is
   finished and normal execution resumes.

 Problem 3:

   T1 holds L1

   T2 is waiting for L1

   GC is triggered in T2 inside GET-MUTEX

   T2 grabs lock L2 due to a finalizer or an after-gc-hook

   GC is triggered in T1

   T1 tries to grab L2 due to a finalizer, etc.

   Same as problem 2, but with a user-lock and POST-GC instead of
   *ALREADY-IN-GC* and SUB-GC.

 This patch fixes the issue by saving, clearing, and restoring
 the waiting-for mark in

  1) interrupt handlers

  2) SUB-GC

  3) POST-GC

12 years agoFix automatic &rest to &more conversion in unsafe code
Paul Khuong [Sun, 14 Aug 2011 23:27:42 +0000 (19:27 -0400)]
Fix automatic &rest to &more conversion in unsafe code

 Applying &rest lists to known/typed functions can lead to a
 :fixed values call to %more-arg-values.  In that case, unroll
 it into several %more-arg of constant indices.

 Reported, with test case, by Lutz Euler (lp#826459).

12 years agoNew function: SB-EXT:SPIN-LOOP-HINT
Paul Khuong [Sun, 14 Aug 2011 22:31:52 +0000 (18:31 -0400)]
New function: SB-EXT:SPIN-LOOP-HINT

 Some architectures have developed ways to help the processor execute
 spin loops efficiently; expose them, where applicable, via
 SB-EXT:SPIN-LOOP-HINT.

 Assembles to PAUSE on x86oids, and to nothing on other platforms.

12 years agoMissing NEWS entry for 4e431db
Paul Khuong [Sun, 14 Aug 2011 21:32:27 +0000 (17:32 -0400)]
Missing NEWS entry for 4e431db

 Also, missing credit for Lutz Euler's bug report on a7b24b5.

12 years agoHandle SIMPLE-TYPE-ERROR when propagating bounds
Paul Khuong [Sun, 14 Aug 2011 21:28:22 +0000 (17:28 -0400)]
Handle SIMPLE-TYPE-ERROR when propagating bounds

 Type conversions (e.g. bignum to float) may signal a
 SIMPLE-TYPE-ERROR rather than returning an infinity.
 Treat that case like an unknown value.

 Add two tests.

 Fixes lp#819269.

12 years agoNew function: SB!KERNEL:%MULTIPLY-HIGH
Paul Khuong [Sun, 14 Aug 2011 20:49:27 +0000 (16:49 -0400)]
New function: SB!KERNEL:%MULTIPLY-HIGH

 * Does the same thing as only returning the first value of %MULTIPLY,
   only better on some platforms.

 * Implemented vas VOPs on x86, x86-64 and PPC.  The PPC code sequence
   is fully untested, and merely looks correct.

 * VOPs for fixnum first argument are included, but will only be used
   when the result is forcibly marked as fixnum, e.g., with TRULY-THE.
   Questionnable, but I'd rather err on the side of straightforwardness
   rather than put even more pressure on representation selection.

 * Use it in the division-by-multiplication transform for unsigned
   TRUNCATE by constant.

12 years agoMore efficient integer division by multiplication
Paul Khuong [Sun, 14 Aug 2011 20:46:01 +0000 (16:46 -0400)]
More efficient integer division by multiplication

 * Exploit restricted range for inputs (e.g. fixnums).

 * When the divisor is even, simplify with a mask instead of a shift.

 * Clean up the code a bit: we don't want modular arithmetic, it's
   actually all guaranteed not to wrap around.

 * Change the test so that larger divisors are a bit more likely to
   get tested too.

 * Lots more things can be done, including generalizing the transform
   to pretty much arbitrary rational divisor, or avoiding the costly
   general code sequence in nearly all cases.  Unfortunately, it's a
   lot of (somewhat original, at that) code, and can be fairly slow;
   if it matters to someone, I can try and find a compromise (contrib?).

12 years agoVarious (mostly) SSE x86-64 instruction definition fixes and additions
Paul Khuong [Sun, 14 Aug 2011 17:34:13 +0000 (13:34 -0400)]
Various (mostly) SSE x86-64 instruction definition fixes and additions

 * Fix typos in mnemonics and non-temporal store definitions;
 * Add some instructions;
 * CLFLUSH was totally broken.

Taken from Alexander Gavrilov's SSE intrinsics branch.

12 years agofix DESCRIBE on compiled closures from EVAL
Nikodemus Siivola [Sat, 13 Aug 2011 11:31:17 +0000 (14:31 +0300)]
fix DESCRIBE on compiled closures from EVAL

 lp#824974

12 years agoallow user-defined STRING synonyms in MAKE-SEQUENCE
Christophe Rhodes [Fri, 12 Aug 2011 12:57:51 +0000 (13:57 +0100)]
allow user-defined STRING synonyms in MAKE-SEQUENCE

...and MAP, MERGE, COERCE and CONCATENATE too.  This also meant
working a bit on TYPEXPAND, to make (STRING <N>) be unexpanded in the
same way as STRING, and consequently on VALUES-SPECIFIER-TYPE to
ensure that the system would still recognize those types.

Include test cases for the sequence functions but not for TYPEXPAND.

12 years agoDeclaim sb-di::valid-lisp-pointer-p inline.
Stas Boukarev [Thu, 11 Aug 2011 23:21:23 +0000 (03:21 +0400)]
Declaim sb-di::valid-lisp-pointer-p inline.

Making it inline prevents from creating a SAP, and thus reduces
consing and improves performance. It's called a lot by
map-allocated-objects when GCing is disabled, so consing less is a
desirable property.

Reported by `lisper' on #lisp

12 years agoFix QUERY-FILE-SYSTEM for Windows UNC and device file names
David Lichteblau [Thu, 11 Aug 2011 19:08:09 +0000 (21:08 +0200)]
Fix QUERY-FILE-SYSTEM for Windows UNC and device file names

Thanks to Anton Kovalenko.

12 years agosb-bsd-sockets: Fix error code handling on Windows
Anton Kovalenko [Wed, 18 Aug 2010 21:40:26 +0000 (01:40 +0400)]
sb-bsd-sockets: Fix error code handling on Windows

  Factored out into a new function for the win32-specific
  WSAGetLastError call.

  Run-time results now match the existing constant definitions.

Thanks to Anton Kovalenko.

12 years agosb-simple-streams: In test lp491087, merge the pathname
David Lichteblau [Wed, 10 Aug 2011 18:05:06 +0000 (20:05 +0200)]
sb-simple-streams: In test lp491087, merge the pathname

  Needed for Windows.

Thanks to Anton Kovalenko.

12 years agosb-simple-streams: Close files before deleting them on revert
David Lichteblau [Wed, 10 Aug 2011 14:50:29 +0000 (16:50 +0200)]
sb-simple-streams: Close files before deleting them on revert

Thanks to Anton Kovalenko.

12 years agosb-simple-streams: use the Windows file mapping API for memory-mapped files
Anton Kovalenko [Tue, 29 Mar 2011 11:55:42 +0000 (15:55 +0400)]
sb-simple-streams: use the Windows file mapping API for memory-mapped files

Thanks to Anton Kovalenko.

12 years agosb-posix: in win32 tests, avoid certain hardcoded file names
David Lichteblau [Wed, 10 Aug 2011 12:58:21 +0000 (14:58 +0200)]
sb-posix: in win32 tests, avoid certain hardcoded file names

  stat.5: Create a fresh file instead of hardcoding c:\pagefile.sys
  (was c:\config.sys until recently; was /bin/sh originally).

  rmdir.error.3: Use %windir% instead of c:\.

  Tests now pass with Wine on my system without local workarounds.

12 years agosb-posix: redefined test rmdir.error.3 to accept ENOTEMPTY for win32
Anton Kovalenko [Tue, 8 Mar 2011 23:36:35 +0000 (02:36 +0300)]
sb-posix: redefined test rmdir.error.3 to accept ENOTEMPTY for win32

Thanks to Anton Kovalenko.

12 years agosb-win32: offer low-level bindings for file mapping functions
Anton Kovalenko [Thu, 7 Oct 2010 00:37:07 +0000 (04:37 +0400)]
sb-win32: offer low-level bindings for file mapping functions

  Includes functions offered by Windows that are similar in
  spirit to mmap.

  Currently these are low-level FFI versions only, and no attempt
  is made to export them from sb-posix under the name mmap.  In
  sb-posix, only a wrapper for msync and definitions of several
  constants is offered, as needed for sb-simple-streams.

Thanks to Anton Kovalenko.

Also take this opportunity to sort the sb-win32 package
definition as a flat list.

12 years agoAvoid some exceptions in WAIT-UNTIL-FD-USABLE on Windows
Anton Kovalenko [Wed, 13 Oct 2010 23:18:06 +0000 (03:18 +0400)]
Avoid some exceptions in WAIT-UNTIL-FD-USABLE on Windows

  Always report the :output direction as usable on win32.
  Fixes this function as needed for sb-simple-streams.

Thanks to Anton Kovalenko.

12 years agoTweak os_validate to support running SBCL on recent versions of Wine
David Lichteblau [Tue, 9 Aug 2011 18:51:06 +0000 (20:51 +0200)]
Tweak os_validate to support running SBCL on recent versions of Wine

  SBCL now builds and runs on Wine reliably.

  Credits: Fix developed by Anton Kovalenko.

12 years agogenerate-version.sh fixes
Nikodemus Siivola [Wed, 10 Aug 2011 10:36:36 +0000 (13:36 +0300)]
generate-version.sh fixes

 Make it work with detached heads and historical builds.

 Previously a detached head broke the build, and trying to
 do

   git checkout master; git reset --hard sbcl-1.0.50; sh make.sh

 got the version number wrong.

12 years agofix initial FILE-POSITION for OPEN :IF-EXISTS :APPEND
William Halliburton [Sun, 13 Feb 2011 19:01:17 +0000 (12:01 -0700)]
fix initial FILE-POSITION for OPEN :IF-EXISTS :APPEND

  For O_APPEND opened files, lseek returns 0 until first write.
  So we jump ahead initially.

  lp#561642

12 years agoNew toplevel options --quit and --non-interactive
David Lichteblau [Tue, 9 Aug 2011 14:45:13 +0000 (16:45 +0200)]
New toplevel options --quit and --non-interactive

Implements lp#822712.

12 years agoMake test toplevel.sh usable
David Lichteblau [Tue, 9 Aug 2011 14:45:10 +0000 (16:45 +0200)]
Make test toplevel.sh usable

  Move toplevel.sh to toplevel.test.sh (where run-tests.sh expects it).

  Move one of the tests to script.test.sh (where needed helper files
  are set up).

12 years agoDocument further common toplevel options
David Lichteblau [Tue, 9 Aug 2011 14:45:05 +0000 (16:45 +0200)]
Document further common toplevel options

  --sysinit and --userinit had already been documented.
  Now also document the remaining toplevel options for consistency.

  Note that --help shows short one-line comments, hence no attempt is
  made to sync them with the manpage fully.

12 years agosb-bsd-sockets: less SERVE-EVENT
Nikodemus Siivola [Tue, 9 Aug 2011 10:37:14 +0000 (13:37 +0300)]
sb-bsd-sockets: less SERVE-EVENT

  Socket streams no longer participate in SERVE-EVENT by default.

  Adjust MAKE-SOCKET-STREAM docstring for clarity.

12 years agoLOAD-TIME-VALUE improvements
Nikodemus Siivola [Tue, 9 Aug 2011 07:57:41 +0000 (10:57 +0300)]
LOAD-TIME-VALUE improvements

 * Derive the type of :TOPLEVEL lambdas properly. Without this we were
   never able to utilize the type from COMPILE-LOAD-TIME-STUFF.

 * Use the source-type whenever it is more accurate than the type from
   COMPILE-LOAD-TIME-STUFF -- eg. when using a value cell.

 * Add ALIAS argument to IR1-CONVERT, allowing saving alternate forms
   into *CURRENT-PATH*: this allows

     (defparameter *var* 10)

     (compile nil '(lambda () (the list (load-time-value *var*))))

    to give the warning

      ;   Derived type of *VAR* is
      ;     (VALUES (INTEGER 10 10) &OPTIONAL),
      ;   conflicting with its asserted type
      ;     LIST.

    instead of the much less useful

      ;   Constant 10 conflicts with its asserted type LIST.

  * Use THE-IN-POLICY directly in LOAD-TIME-VALUE, allowing the file-
    compiler to report the LOAD-TIME-VALUE form for type-conflicts
    instead of (TRULY-THE <type> (%LOAD-TIME-VALUE ...))

12 years agobetter type propagation for MULTIPLE-VALUE-BIND
Nikodemus Siivola [Mon, 8 Aug 2011 10:48:24 +0000 (13:48 +0300)]
better type propagation for MULTIPLE-VALUE-BIND

  Previously code such as

   (multiple-value-bind (x y) (known-call ...)
      ...)

  could lose the derived type for KNOWN-CALL when it was converted to
  an inline lambda: the derived type correctly ended up associated
  with the final VALUES call in the inlined code, but
  CONVERT-MV-BIND-TO-LET lost that.

  Address this by propagating the derived type of VALUES to the
  VALUES arguments.

  Allows removing the TRULY-THE kludge from the new TRUNCATE
  transform.

12 years agoRemove non-ASCII characters in comments
Paul Khuong [Sat, 6 Aug 2011 21:34:27 +0000 (17:34 -0400)]
Remove non-ASCII characters in comments

 It breaks some people's builds (especially on !SBCL).

12 years agoimplement CEILING and FLOOR in terms of %CEILING and %FLOOR
Nikodemus Siivola [Fri, 5 Aug 2011 09:58:38 +0000 (12:58 +0300)]
implement CEILING and FLOOR in terms of %CEILING and %FLOOR

  This allows transforms specific to CEILING and FLOOR fire first.

  If they fail, the fallback transforms to %CEILING or %FLOOR,
  respectively.

  They in turn are inlined, allowing the transforms for TRUNCATE
  to pick up the slack.

  This allows the new division -> multiplication transforms to fire
  for CEILING and FLOOR when SPACE > 1.

12 years agorename %FLOOR to %BIGFLOOR
Nikodemus Siivola [Fri, 5 Aug 2011 11:56:00 +0000 (14:56 +0300)]
rename %FLOOR to %BIGFLOOR

12 years agoOptimize integer division by a constant in several cases.
Lutz Euler [Mon, 25 Jul 2011 00:47:43 +0000 (02:47 +0200)]
Optimize integer division by a constant in several cases.

Convert integer division by a constant into multiplication to gain
a large speedup as the machine instructions for multiplication are
typically executed much faster than those for division.

This is implemented using a deftransform on TRUNCATE that triggers
if the dividend is known to fit in an unsigned machine word and if
the divisor is a constant, also fitting in an unsigned machine word.
(The cases that are optimized by other existing transforms, for example
if the divisor is a power of two, are left to these transforms.)

The replacement code is based on a widening multiply (that is already
available as bignum calculations need it) and possibly some shifts and
an addition to calculate the quotient. If the remainder is needed,
additionally a (normal) multiplication and a subtraction are generated.

As several other integer division operations are implemented using
TRUNCATE, this also affects CEILING, FLOOR, MOD and REM with the same
argument types. CEILING and FLOOR, however, are optimized only when
SAFETY=0 since they are declared MAYBE-INLINE.

12 years agoexport MOST-POSITIVE-WORD from SB-EXT
Nikodemus Siivola [Fri, 5 Aug 2011 09:05:24 +0000 (12:05 +0300)]
export MOST-POSITIVE-WORD from SB-EXT

  We need it internally anyways, and since we export the WORD type, we
  might just as well export the constant too.

12 years agoskip interrupted-syscall test on unthreaded builds
Nikodemus Siivola [Fri, 5 Aug 2011 08:44:33 +0000 (11:44 +0300)]
skip interrupted-syscall test on unthreaded builds

  ...and rename it backtrace-interrupted-condition-wait.

  Duh.

12 years agosb-bsd-sockets: add support for Linux TCP keep alive options
Robert Brown [Fri, 8 Jul 2011 18:40:31 +0000 (14:40 -0400)]
sb-bsd-sockets: add support for Linux TCP keep alive options

12 years agoCorrect function argument name generation in DEF-MATH-RTN
Lutz Euler [Wed, 29 Jun 2011 16:32:46 +0000 (18:32 +0200)]
Correct function argument name generation in DEF-MATH-RTN

Argument names of math functions defined using DEF-MATH-RTN now really
start with "ARG0". Kills a style warning during build and slightly
reduces the number of symbols in the SB-KERNEL package.

12 years agoRemove the redundant bootstrap hack from %COMPILER-DEFTYPE
Roman Marynchak [Thu, 26 May 2011 16:38:34 +0000 (19:38 +0300)]
Remove the redundant bootstrap hack from %COMPILER-DEFTYPE

12 years agomove checking for constant ALIEN-INFO into a separate function
Roman Marynchak [Sun, 8 May 2011 10:41:13 +0000 (13:41 +0300)]
move checking for constant ALIEN-INFO into a separate function

  Introducing CONSTANT-ALIEN-INFO-OR-ABORT.

12 years agofix short writes when not using SERVE-EVENT
Nikodemus Siivola [Thu, 4 Aug 2011 10:31:06 +0000 (13:31 +0300)]
fix short writes when not using SERVE-EVENT

  Regression since 1.0.42.43, lp#820599.

  Thanks to Robert Brown.

  If we remain in the loop, we need to update the local HEAD
  variable in the event of a short write.

  NOTE: No test case yet, as this is dependant on the size of kernel
  buffers, and trying to catch the short-write -case is tricky.

12 years agoFix version string parsing for Linux 3.0
Paul Khuong [Wed, 3 Aug 2011 14:20:41 +0000 (10:20 -0400)]
Fix version string parsing for Linux 3.0

 Stop assuming the presence of minor and patch version numbers; missing
 values are defaulted to 0 (e.g. 3.0.0).

 Reported by a few people on IRC.

12 years agoFix disassembly of CMP[PS][SD] instructions on x86-64
Paul Khuong [Mon, 1 Aug 2011 18:06:28 +0000 (14:06 -0400)]
Fix disassembly of CMP[PS][SD] instructions on x86-64

The relevant instruction formats wrongly defined a fixed position for
the immediate byte which broke disassembly when a memory argument was
used.

Fix this by using a prefilter to read the immediate like most other
instructions do.

Refactor for more OAOO-ness: Drop the instruction formats that were
used only for these comparison instructions; instead use others that
are nearly identical. This forces more copy-and-paste in the printer
definitions, so instead abstract the generation of printer lists for
SSE instructions into a separate function and use that here.

Add tests.

Fixes lp#814702.

Patch by Lutz Euler.

12 years agomore robust backtraces for syscalls on x86
Nikodemus Siivola [Mon, 1 Aug 2011 13:46:26 +0000 (16:46 +0300)]
more robust backtraces for syscalls on x86

 * new optimization policy: ALIEN-FUNCALL-SAVES-FP-AND-PC Set to 3 for
   self-build on x86 to get reliable more backtraces there, and 0 for
   other platforms. (1 matches the old SPEED <= DEBUG behaviour.)

 * When using a saved FP, and an interrupt context has a bogus
   FP, assume it is an interrupted syscall frame.

12 years agoadd -fno-omit-frame-pointer to x86 builds
Nikodemus Siivola [Mon, 1 Aug 2011 12:05:54 +0000 (15:05 +0300)]
add -fno-omit-frame-pointer to x86 builds

  GCC >= 4.6 omits it by default, leading to broken backtraces.

12 years agomake SBCL_ARCH=x86 build work on 64-bit linux without chroot
Nikodemus Siivola [Mon, 1 Aug 2011 12:02:54 +0000 (15:02 +0300)]
make SBCL_ARCH=x86 build work on 64-bit linux without chroot

 (Assuming all the compatibility libs, etc, have been installed.)

12 years agofixed-format floating point printing: zero and scaling factors
Nikodemus Siivola [Fri, 29 Jul 2011 11:41:00 +0000 (14:41 +0300)]
fixed-format floating point printing: zero and scaling factors

  Now that FLONUM-TO-DIGITS handles zero, we need to check against
  zero before adding in the scaling factor.

  Also make sure not to print extra digits when E is negative.

  Adjust FORMAT-AUX-EXP to not print the extra-zero: FLONUM-TO-STRING
  provides it now.

  Fixes lp#811386.