sbcl.git
11 years agoMiscellaneous cleanups for threaded darwin platforms
Cyrus Harmon [Sun, 29 Jul 2012 13:33:45 +0000 (06:33 -0700)]
Miscellaneous cleanups for threaded darwin platforms

 * Gather some related declarations in fewer (conditionalised) places

 * Lay down some infrastructure for mach port different from threads'
   addresses

 * Slightly modified by Paul Khuong

11 years agoFix build of contribs on Windows.
Stas Boukarev [Sat, 28 Jul 2012 15:15:57 +0000 (15:15 +0000)]
Fix build of contribs on Windows.

Set CC variable in make-target-contrib.sh, not in asdf-module.mk, Make
defaults CC to "cc" making it impossible to conditionally set CC to gcc
if it's unset.

11 years agoUpdate to asdf 2.23
Juho Snellman [Fri, 27 Jul 2012 10:31:26 +0000 (12:31 +0200)]
Update to asdf 2.23

11 years agorun-program: Don't make pty the process's controlling terminal.
Stas Boukarev [Thu, 26 Jul 2012 23:09:56 +0000 (03:09 +0400)]
run-program: Don't make pty the process's controlling terminal.

When called without an existing pty, for example in Slime, run-program
will make the created pty as the process's controlling.

(process-close (run-program "cat" () :pty t :search t :wait nil))
was terminated with SIGHUP when called under Slime.

11 years agoRestore buildability of run-program.impure on win32
David Lichteblau [Thu, 19 Jul 2012 18:45:33 +0000 (20:45 +0200)]
Restore buildability of run-program.impure on win32

... which had, unfortunately, been affected negatively by the previous
commit.

11 years agowin32: Mark all currently failing tests as such
David Lichteblau [Thu, 19 Jul 2012 12:42:03 +0000 (14:42 +0200)]
win32: Mark all currently failing tests as such

This change is not to be taken as an indication that these tests are not
going to be fixed.  Instead, it establishes a baseline against which to
measure future improvements, and it guards against further regression.

Please let's mark any newly added, problematic tests in the same fashion.

11 years agoTemporarily disable problematic exhaust tests on Windows
David Lichteblau [Wed, 18 Jul 2012 17:42:13 +0000 (19:42 +0200)]
Temporarily disable problematic exhaust tests on Windows

11 years agoUse preprocessor includes for link_or_copy on Windows
David Lichteblau [Thu, 7 Jul 2011 15:01:11 +0000 (17:01 +0200)]
Use preprocessor includes for link_or_copy on Windows

11 years agoDeclare types for sb-kernel:coerce-to-condition.
Stas Boukarev [Mon, 16 Jul 2012 20:34:43 +0000 (00:34 +0400)]
Declare types for sb-kernel:coerce-to-condition.

Add
(defknown coerce-to-condition ((or condition symbol string function)
                               list type-specifier symbol)
    condition
    (explicit-check))
Which helps to remove optimization notes in some cases with
restart-case.

Fixes lp#1025416.

11 years agoCorrect the info directory entry in sbcl-internals.texinfo.
Lutz Euler [Wed, 11 Jul 2012 19:52:36 +0000 (21:52 +0200)]
Correct the info directory entry in sbcl-internals.texinfo.

The file name was wrong so that the info directory link wasn't working.
LP #1023175, thanks to Orivej Desh for the report and the fix.

11 years agoImprove docstrings of MAKE-RANDOM-STATE and SEED-RANDOM-STATE.
Lutz Euler [Fri, 29 Jun 2012 22:08:34 +0000 (00:08 +0200)]
Improve docstrings of MAKE-RANDOM-STATE and SEED-RANDOM-STATE.

The formatting of some item lists in the docstring of SEED-RANDOM-STATE
was broken in the manual. Fix the indentation of the docstring so that
the conversion to texinfo can correctly collect multiple lines belonging
to the same bullet points, and drop a "- " intended to indicate a
single-item list as that doesn't work (according to comments in
docstrings.lisp item lists must consist of at least two items).

Fix some small grammatical errors.

While MAKE-RANDOM-STATE's docstring is not in the manual, it consists
mostly of a part of SEED-RANDOM-STATE's docstring, so apply the fixes
there, too.

11 years agoSimplify %symbol-value-in-thread further
David Lichteblau [Mon, 18 Jun 2012 13:40:49 +0000 (15:40 +0200)]
Simplify %symbol-value-in-thread further

Since Alastair Bridgewater fixed the race conditions in this function,
there is no need to loop anymore.

11 years agoUse %p for pthread pointers in debugging output
David Lichteblau [Fri, 17 Jun 2011 11:30:14 +0000 (13:30 +0200)]
Use %p for pthread pointers in debugging output

11 years agobrief_print: reset cur_lines
David Lichteblau [Wed, 18 May 2011 19:45:56 +0000 (21:45 +0200)]
brief_print: reset cur_lines

Otherwise, when running with QSHOW, the runtime stops printing
after 5000 objects (for example for traps).

11 years agoMake run-sbcl.sh executable
David Lichteblau [Mon, 18 Jun 2012 13:22:35 +0000 (15:22 +0200)]
Make run-sbcl.sh executable

11 years agoImproved merge-sort implementation for lists
Paul Khuong [Sun, 17 Jun 2012 08:53:47 +0000 (10:53 +0200)]
Improved merge-sort implementation for lists

 The new implementation is simpler and more efficient than the previous
 bottom-up sort.  It only differs from the original patch aesthetically.

 STABLE-SORT-LIST is also now MAYBE-INLINE, to enable selective inlining.

 Thanks to Takeru Ohta for the code and for his patience.

11 years agofix long-standing debug-name confusion
Nikodemus Siivola [Tue, 12 Jun 2012 05:36:58 +0000 (08:36 +0300)]
fix long-standing debug-name confusion

  The calls to IR1-CONVERT-LAMBDA-BODY with the a VARARGS-ENTRY and
  HAIRY-ARG-PROCESSOR debug-names were no such things.

  These calls produces the actual lambda for the main body of the function,
  and as such should have the original source-name and debug-name.

  As proof of the pudding, we previously failed to detect several known
  function that are recursive but aren't marked as such in the DEFKNOWNs. With
  this that changes, so fix the DEFKNOWNs.

11 years agoFix typo in whitespacely-canonical-filenames
David Lichteblau [Sat, 9 Jun 2012 22:12:21 +0000 (00:12 +0200)]
Fix typo in whitespacely-canonical-filenames

Thanks to Lutz Euler.

11 years agoa few more .mailmap entries
Nikodemus Siivola [Sat, 9 Jun 2012 20:48:37 +0000 (23:48 +0300)]
a few more .mailmap entries

  Trying to pick a canonical email for each, so that

    git shortlog -se

  shows only one line per person.

11 years agoadd .mailmap so "git shortlog -ns" counts properly
Nikodemus Siivola [Sat, 9 Jun 2012 20:35:01 +0000 (23:35 +0300)]
add .mailmap so "git shortlog -ns" counts properly

11 years agoAdd tests for two bugs that were incidentally fixed some time ago.
Lutz Euler [Sat, 9 Jun 2012 19:24:21 +0000 (21:24 +0200)]
Add tests for two bugs that were incidentally fixed some time ago.

Commit b894cb41d869bda6ba0c54a491becc7bb58375c1 (make FORMAT signal
errors with illegal COLINC etc. parameters) happened to fix bug 905817
(endless loop in FORMAT with zero COLINC), then unnoticed, so add a
regression test and NEWS now.

Commit 96c62c30ec9164419c790b2fbea953da2193620f (ensure that GCD returns
positive values) besides the one intended also fixed bug 516750 (type
error when trying to convert a sum of rationals to a float). Add the
failing expression from that bug to the existing test.

11 years agotest backtrace-interrupted-condition-wait works on Darwin/x86 as well
Nikodemus Siivola [Sat, 9 Jun 2012 17:39:47 +0000 (20:39 +0300)]
test backtrace-interrupted-condition-wait works on Darwin/x86 as well

11 years agoa few more tests to skip on unithreaded builds
Nikodemus Siivola [Sat, 9 Jun 2012 17:31:27 +0000 (20:31 +0300)]
a few more tests to skip on unithreaded builds

11 years agofix :DEBUGGER :SOURCE 2 test on unithreaded builds
Nikodemus Siivola [Sat, 9 Jun 2012 17:21:17 +0000 (20:21 +0300)]
fix :DEBUGGER :SOURCE 2 test on unithreaded builds

  Trivial layout different on debugger entry cause it to break.

11 years agotest backtrace-interrupted-condition-wait works on Darwin/x86-64
Nikodemus Siivola [Sat, 9 Jun 2012 12:25:01 +0000 (15:25 +0300)]
test backtrace-interrupted-condition-wait works on Darwin/x86-64

11 years agoadjust compiler-macro expansion and lambda-list parsing
Nikodemus Siivola [Sat, 3 Dec 2011 09:37:24 +0000 (11:37 +0200)]
adjust compiler-macro expansion and lambda-list parsing

 * Don't convert errors during compiler-macro expansion into runtime
   PROGRAM-ERRORs: signal a compile-time warning, and simply decline to expand
   the compiler-macro.

   This lives in CAREFUL-EXPAND-MACRO.

 * Make compiler not expand compiler-macros if there are arguments in keyword
   positions that are not self-evaluating constant symbols.

   This lives in two places:

    (1) VERIFY-KEYWORDS signals a COMPILER-MACRO-KEYWORD-PROBLEM when it
        encounters either an unknown keyword or anything except a
        self-evaluating symbol in a keyword position when parsing
        compiler-macro keywords.

    (2) IR1-CONVERT-FUNCTOID handles this condition by unwinding from the
        compiler-macro expansion, printing a note about the problem, and
        returning the original form.

    Calling COMPILER-MACRO-FUNCTION directly behaves exactly as before, for
    both good and ill: good in the sense that it is compliant, ill in the
    sense that doing things that way may expand things the compiler would
    decline to expand:

      (define-compiler-macro foo (&key ((a ax) t)) (format nil "a=~S" ax))

    The compiler would refuse to expand (foo a 42) unless

      (defconstant a 'a)

    had been done beforehand, but calling the COMPILER-MACRO-FUNCTION directly
    would expand it even without that -- as the spec unfortuntely requires.

11 years agosb-alien: some alien refactoring
Nikodemus Siivola [Sat, 31 Mar 2012 09:28:06 +0000 (12:28 +0300)]
sb-alien: some alien refactoring

  * Rename EXTRACT-ALIEN-VALUE & DEPOSIT-ALIEN-VALUE to %ALIEN-VALUE and
    (SETF %ALIEN-VALUE).

  * Split HEAP-ALIEN-INFO-SAP-FORM field into HEAP-ALIEN-INFO-ALIEN-NAME and
    -DATAP. HEAP-ALIEN-INFO-SAP-FORM becomes a function that conses up the form
    for the compiler, and HEAP-ALIEN-INFO-SAP replaces EVAL of the form.

  * Better error checking in PICK-LISP-AND-ALIEN-NAMES, and an error message
    that explains the correct form.

11 years agosb-alien-internals: ALIEN-VALUE to extract value of a symbol bound to an alien
Nikodemus Siivola [Sat, 31 Mar 2012 08:48:13 +0000 (11:48 +0300)]
sb-alien-internals: ALIEN-VALUE to extract value of a symbol bound to an alien

  Used in the evaluators. Also allows the simple evaluator to process alien
  variables without invoking the compiler.

11 years agoMicro-optimization: Avoid byte register writes on x86-64 in LOAD-TYPE.
Lutz Euler [Fri, 8 Jun 2012 15:30:15 +0000 (17:30 +0200)]
Micro-optimization: Avoid byte register writes on x86-64 in LOAD-TYPE.

The optimization guide for AMD's x86-64 processors recommends not
to write a partial register but instead to use MOVZX to write the
corresponding 32/64-bit register. Otherwise the instruction would have
an unnecessary dependency on the most recent write to the register,
reducing the available instruction level parallelism. On Intel's
processors this is not necessary but doesn't hurt.

To follow this recommendation, modify LOAD-TYPE to use MOVZX instead of
a byte MOV and adapt the VOPs that call it: FUN-SUBTYPE, SET-FDEFN-FUN,
and WIDETAG-OF. This additionally spares a temporary register in
FUN-SUBTYPE and allows to shorten all paths through WIDETAG-OF by one
instruction.

The effect on code size is small and mixed.

11 years agoUpdate NEWS
David Lichteblau [Fri, 8 Jun 2012 14:19:01 +0000 (16:19 +0200)]
Update NEWS

Minor SPARC and PPC fixes.

11 years agoturn off *PRINT-PRETTY* when reporting test results, want line per result
Tomas Hlavaty [Wed, 6 Jun 2012 14:31:14 +0000 (16:31 +0200)]
turn off *PRINT-PRETTY* when reporting test results, want line per result

This new format is easier to parse than the old line-wrapped output.

11 years agoRelax an implicit restriction on the number of code constants on SPARC
David Lichteblau [Wed, 6 Jun 2012 14:24:00 +0000 (16:24 +0200)]
Relax an implicit restriction on the number of code constants on SPARC

Previously, LOAD-CONSTANT was restricted by SPARC's particularly small
13 bit immediate field, allowing fewer constants than on other platforms.

Fixes lp#1008996.

11 years agoIn whitespace canonicalization, find a suitable make automatically
David Lichteblau [Wed, 6 Jun 2012 14:23:26 +0000 (16:23 +0200)]
In whitespace canonicalization, find a suitable make automatically

11 years agoSimplify ppc's MOVE-TO-WORD/INTEGER
David Lichteblau [Thu, 7 Jun 2012 21:49:34 +0000 (23:49 +0200)]
Simplify ppc's MOVE-TO-WORD/INTEGER

11 years agoFix inline fixnum LDB on PowerPC for certain bytespecs
David Lichteblau [Thu, 7 Jun 2012 18:08:34 +0000 (20:08 +0200)]
Fix inline fixnum LDB on PowerPC for certain bytespecs

Previously, the inline fixnum version of (ldb (byte 8 24) -1) would
return #x3f instead of #ff.

11 years agoFix test character.pure.lisp / BUG-994487 on non-unicode.
Lutz Euler [Thu, 7 Jun 2012 21:21:47 +0000 (23:21 +0200)]
Fix test character.pure.lisp / BUG-994487 on non-unicode.

Replace a literal 1114111 with (1- CHAR-CODE-LIMIT) so that the test
works on #-sb-unicode, too.

11 years agoAdd a test for range reduction of trigonometric functions on non-x86.
Lutz Euler [Thu, 7 Jun 2012 12:23:11 +0000 (14:23 +0200)]
Add a test for range reduction of trigonometric functions on non-x86.

Trigonometric functions of large float arguments yield differing results
depending on how range reduction is done. There is already a test for
the results expected on x86, float.pure.lisp/(:range-reduction :x87).

Add a test for the results expected from GNU libm and enable it for
all platforms except x86. The new test is impure and therefore added
to "float.impure.lisp". Move the x86 test there, too, to reduce the
potential for future confusion.

11 years agoSkip the float.pure.lisp/RANGE-REDUCTION test outside x86.
Lutz Euler [Thu, 7 Jun 2012 12:23:11 +0000 (14:23 +0200)]
Skip the float.pure.lisp/RANGE-REDUCTION test outside x86.

The test was and is meant only to be used on x86 as it tests for results
the x87 FPU computes, which can differ from those on other platforms.
It was accidentally enabled for all platforms with commit
4c81c652cdc32faefee1bccb84c3c9a7854e3edd.

Revert this by skipping the test on everything except x86. Augment
the test's name and improve its comment so that it hopefully won't be
enabled again everywhere so easily.

11 years agoSmall enhancements to ISQRT
Lutz Euler [Wed, 6 Jun 2012 14:30:51 +0000 (16:30 +0200)]
Small enhancements to ISQRT

Replace MULTIPLE-VALUE-LIST with MULTIPLE-VALUE-BIND which conses less
and is slightly faster.

Correct the docstring.

Add a test for correctness.

11 years agoRestore build on sparc/solaris.
Stas Boukarev [Mon, 4 Jun 2012 17:24:46 +0000 (21:24 +0400)]
Restore build on sparc/solaris.

gc-internal.h: include interr.h before `lose' is used.

Fixes lp#1008506.

11 years agoemit compiler notes of NLX value-cells when (> SPEED SAFETY)
Nikodemus Siivola [Wed, 23 May 2012 05:47:54 +0000 (08:47 +0300)]
emit compiler notes of NLX value-cells when (> SPEED SAFETY)

  People have a right to know: it's NEWS.

11 years agoelide value cells for NLXs when it seems like the right thing
Nikodemus Siivola [Mon, 21 May 2012 20:30:54 +0000 (23:30 +0300)]
elide value cells for NLXs when it seems like the right thing

  Previously we only did this for unsafe code.

  Now we also elide them for

   (1) exits from DX functions: if a DX function escapes its proper context,
       trying to perform NLX to a stale tag is the least of our worries.

   (2) functions that cannot escape. Since the escape analysis isn't yet very
       tested, disable it for safe code, though. If this raises hairs on your
       neck, consider this: even if our analysis is wrong, and a function we
       didn't think could escape does, we're in the land of "undefined
       consequences" anyways.

       If you're wondering if this is worth it, compare

         (defun feh (x)
           (flet ((meh () (return-from feh 'meh)))
             (typecase x
              (cons (or (car x) (meh)))
              (t (meh)))))

         (time (loop repeat 10000 do (feh t)))

       with and without the escape analysis.

11 years agoupdate NEWS
Nikodemus Siivola [Sun, 27 May 2012 12:38:45 +0000 (15:38 +0300)]
update NEWS

  MAP-INTO improvements.

  DOSEQUENCE improvement.

  Move optimizations above bugs.

11 years agoadd DO-VECTOR-DATA, remove special case from VECTOR-MAP-INTO
Nikodemus Siivola [Sun, 27 May 2012 10:44:12 +0000 (13:44 +0300)]
add DO-VECTOR-DATA, remove special case from VECTOR-MAP-INTO

  DO-VECTOR-DATA is like DOVECTOR, but uses WITH-ARRAY-DATA and grabs the
  right reffer function so there's no per-element dispatch.

  Since MAP used DOSEQUENCE for for-effect/arity-1 case, and DOSEQEUNCE in
  turn uses DOVECTOR, replacing DOVECTOR there with DO-VECTOR-DATA we get the
  a performance boost while being able to drop the special case in
  VECTOR-MAP-INTO.

  Add a test for which the special case was broken: mapping a list into a
  vector.

11 years agomove vm-array.lisp earlier in the build, remove %%SAETP-INFO%%
Nikodemus Siivola [Sun, 27 May 2012 09:48:43 +0000 (12:48 +0300)]
move vm-array.lisp earlier in the build, remove %%SAETP-INFO%%

  This way DEFINE-ARRAY-DISPATCH can use *S-A-E-T-P* directly.

11 years agowidetag dispatch for MAP-INTO
James M. Lawrence [Thu, 24 May 2012 01:33:07 +0000 (21:33 -0400)]
widetag dispatch for MAP-INTO

11 years agoautomate widetag dispatching
James M. Lawrence [Thu, 24 May 2012 01:33:07 +0000 (21:33 -0400)]
automate widetag dispatching

* add DEFINE-ARRAY-DISPATCH

* replace the VECTOR-SUBSEQ* dispatch scaffolding
  with a DEFINE-ARRAY-DISPATCH call

11 years agofix MAP-INTO performance
James M. Lawrence [Thu, 17 May 2012 23:16:54 +0000 (19:16 -0400)]
fix MAP-INTO performance

* remove the O(n^2) algorithm for lists

* use (MAP NIL ...) for all sequence types

* avoid unnecessary LENGTH calls

* update fill pointer after mapping succeeds, not before

* add tests for MAP-INTO (there were none!)

* add some WITH-TESTs to tests/map-tests.impure.lisp

12 years agoAdd a missing launchpad reference to NEWS.
Lutz Euler [Fri, 25 May 2012 15:09:50 +0000 (17:09 +0200)]
Add a missing launchpad reference to NEWS.

12 years agoUse multi-byte NOPs for code alignment on x86-64.
Lutz Euler [Fri, 25 May 2012 14:56:49 +0000 (16:56 +0200)]
Use multi-byte NOPs for code alignment on x86-64.

This is intended to speed up execution of such code sequences. It makes
the disassembly output somewhat more readable, too. The multi-byte NOP
instructions are chosen according to the recommendations of both AMD and
Intel. All existing x86-64 processors should support the "0f 1f" opcode
used.

This adds the needed infrastructure to the backend-independent compiler
parts and uses it from x86-64. Backends not using this functionality are
left unchanged.

Extend EMIT-ALIGNMENT to allow to specify multi-byte NOPs to be used
instead of repetitions of the single-byte NOP and change the call in
EMIT-BLOCK-HEADER on x86-64 to trigger this. Extend EMIT-SKIP to call
EMIT-LONG-NOP in this case.

On x86-64, add EMIT-LONG-NOP as the instruction emitter and extend the
disassembler entry for NOP to understand the multi-byte forms, too.

Make EMIT-FILLER decide more carefully whether to join fillers that are
adjacent in the list of segment annotations: Only join them if they are
immediately adjacent in the segment, too. (Otherwise the joined filler
would cover the wrong parts of a shortened alignment sequence.)

In certain circumstances %EMIT-ALIGNMENT splits an alignment into two
parts. This may not be necessary but has not yet been changed, so
sometimes one more long NOP than needed is assembled.

12 years agogensym: Don't restrict numerical argument to fixnum.
Stas Boukarev [Wed, 23 May 2012 06:01:03 +0000 (10:01 +0400)]
gensym: Don't restrict numerical argument to fixnum.

(gensym number) was restricted to fixnums, restrict it to
unsigned-byte, as per the standard.

12 years agobetter SIGNAL
Nikodemus Siivola [Mon, 21 May 2012 20:27:53 +0000 (23:27 +0300)]
better SIGNAL

  Add *STACK-TOP-HINT*.

  Move out the *BREAK-ON-SIGNALS* stuff to a separate function for
  clarity. Conditionalize the call there, meaning those restarts don't need to
  be allocated unless we actually need them -- making SIGNAL faster and a lot
  less consy. (TYPEP calls still cons, though. Can't have everything...)

12 years agorun-program: Don't use /tmp unconditionally.
Stas Boukarev [Tue, 22 May 2012 18:39:07 +0000 (22:39 +0400)]
run-program: Don't use /tmp unconditionally.

* Use TEMP on win32 and TMPDIR on non-win32.
* Don't delete just opened temporary files on windows, because opened
  files cannot be unlinked on windows.

Fixes lp#968837.

12 years agorun-program: Don't decode and re-encode environ.
Stas Boukarev [Tue, 22 May 2012 18:06:06 +0000 (22:06 +0400)]
run-program: Don't decode and re-encode environ.

Leave environ unchanged when no :environment argument is provided.
Closes lp#985904.

12 years agoimplicit generic function warning improvement
Cyrus Harmon [Mon, 21 May 2012 06:22:24 +0000 (23:22 -0700)]
implicit generic function warning improvement

 the warning now prints out the package of the symbol that corresponds
 to the newly created generic function.

12 years agosome nincompoop broke the build
Nikodemus Siivola [Mon, 21 May 2012 18:39:02 +0000 (21:39 +0300)]
some nincompoop broke the build

  *blush*

12 years agomake ENSURE-GENERIC-FUNCTION accept method combination arguments
Nikodemus Siivola [Sun, 20 May 2012 17:11:29 +0000 (20:11 +0300)]
make ENSURE-GENERIC-FUNCTION accept method combination arguments

  Previously we only accepted a list designating the method combination, but
  since MOP also specifies a way to grab the actual method combination, we
  should really accept that as well.

  Fixes bug 936513.

12 years agofix source information for functions from EVAL
Nikodemus Siivola [Thu, 17 May 2012 12:22:22 +0000 (15:22 +0300)]
fix source information for functions from EVAL

 * Removed the breathtaking (NAMED-LAMBDA (EVAL (DEFUN FOO)) ...) hack, which
   caused inconsistent source locations, and broke the built-in debugger
   source command for evaluated functions.

   Replace it with *SOURCE-FORM-CONTEXT-ALIST*, which allows the simple
   evaluator to communicate the original context to the compiler without
   messing with the function source.

   This also means we no longer have to wrap named-lambdas and lambdas in
   another lambda, but can instead compile them directly -- which in turn
   allows FUNCTION-LAMBDA-EXPRESSION to work correctly for definitions from
   EVAL and LOAD.

 * Additionally, use a handler to muffle any compiler notes from EVAL instead
   of using a declaration: those can leak to the user via F-L-E.

 * Change ACTUALLY-COMPILE to return a function signaling an error instead of
   returning NIL when compilation fails fatally. Doing this in
   ACTUALLY-COMPILE allows us to rely on COMPILE-IN-LEXENV always returning a
   function, and gives easy access to a better error message.

 * Properly associate COMPILER-ERRORS with their SIGNAL-ERROR restart.

 * Adjust debug.impure.lisp to be less dependent on the details of
   %SIMPLE-EVAL.

 * Test cases. Pay special attention to TEST-DEBUGGER in debug.impure.lisp.

 * New docstring for COMPILE. Added a sneaky teaser about COMPILE being able
   to recompile things, which is new starting to look feasible.

12 years agorefactor GET-TOPLEVEL-FORM &co between debugger and disassembler
Nikodemus Siivola [Sat, 19 May 2012 11:57:06 +0000 (14:57 +0300)]
refactor GET-TOPLEVEL-FORM &co between debugger and disassembler

  * Merge the implementations in debug.lisp and target-disassembler.lisp.

  * Get rid of most of the cacheing.

  * Prefer the DEBUG-SOURCE-FORM if it exists: thanks to *SOURCE-NAMESTRING*
    we can have misleading namestrings for functions generated by calls to
    EVAL during LOAD, etc.

12 years agorobustify COUNT-FULL-CALLS in the test suite
Nikodemus Siivola [Sat, 19 May 2012 14:09:12 +0000 (17:09 +0300)]
robustify COUNT-FULL-CALLS in the test suite

 Move it to compiler-test-utils.lisp, while at it.

12 years agolazy *STACK-TOP-HINT*s
Nikodemus Siivola [Sat, 19 May 2012 08:44:03 +0000 (11:44 +0300)]
lazy *STACK-TOP-HINT*s

  Allow binding it to a symbol, which is resolved when entering the debugger:
  it denotes the name of the first uninteresting frame.

  This simplifies ERROR, CERROR, BREAK, %BREAK, and makes interrupts more
  efficient as we no longer need to find the interrupted frame when entering
  an interupt handler.

  It also makes (handler-bind ((error #'invoke-debugger)) ...) once again gain
  the benefits of the stack top hint, which we lost when we ceased the provide
  the hint around the call to SIGNAL for efficiency reasons. Best of both
  worlds, one hopes.

12 years agofactor debug-name cleaning into a separate function
Nikodemus Siivola [Sat, 19 May 2012 12:28:41 +0000 (15:28 +0300)]
factor debug-name cleaning into a separate function

  We will need it elsewhere too.

12 years agoCOMPILED-PROGRAM-ERROR source form needs *PRINT-ESCAPE*
Nikodemus Siivola [Fri, 18 May 2012 19:42:17 +0000 (22:42 +0300)]
COMPILED-PROGRAM-ERROR source form needs *PRINT-ESCAPE*

  PRINC-TO-STRING is not what we want here.

12 years agoimplement ATOMIC-UPDATE
Nikodemus Siivola [Tue, 15 May 2012 21:53:51 +0000 (00:53 +0300)]
implement ATOMIC-UPDATE

  Nicer than having to write explicit CAS loops.

  Also improve COMPARE-AND-SWAP docstring, and remove the EXPERIMENTAL label
  from it.

12 years agobreak infinite recursion in GENERATE-SLOTD-TYPECHECK
Nikodemus Siivola [Sun, 20 May 2012 09:25:25 +0000 (12:25 +0300)]
break infinite recursion in GENERATE-SLOTD-TYPECHECK

  Compilation of a typecheck can cause class finalization, which in turn can
  cause calls to GENERATE-SLOTD-TYPECHECK.

  Given the right sort of dependency graph, this can cause a cycle which needs
  to be broken.

  Regression from 1.0.46.11, fixed bug 1001799.

12 years ago1.0.57: will be tagged as "sbcl-1.0.57"
Juho Snellman [Sun, 20 May 2012 18:55:37 +0000 (20:55 +0200)]
1.0.57: will be tagged as "sbcl-1.0.57"

12 years agoFix build on windows.
Stas Boukarev [Thu, 17 May 2012 21:10:13 +0000 (01:10 +0400)]
Fix build on windows.

* Include sbcl.h before LISP_FEATURE_WIN32 is used in coreparse.c
* Include stub for _exit.

12 years agodefine-condition: return the name of the defined condition.
Stas Boukarev [Wed, 16 May 2012 22:51:51 +0000 (02:51 +0400)]
define-condition: return the name of the defined condition.

12 years agoBetter error for malformed type declarations.
Stas Boukarev [Wed, 16 May 2012 16:30:04 +0000 (20:30 +0400)]
Better error for malformed type declarations.

Give proper error messages for things like
(declare (type (integer 1 . 2) a)).

12 years agoBetter error message for malformed IGNORE declarations.
Stas Boukarev [Wed, 16 May 2012 15:04:21 +0000 (19:04 +0400)]
Better error message for malformed IGNORE declarations.

Give better errors for things like (ignore (a)) and
(ignore (function . b)).

Fixes lp#1000239.

12 years agoOptimize copy-tree.
Stas Boukarev [Mon, 14 May 2012 01:12:45 +0000 (05:12 +0400)]
Optimize copy-tree.

copy-tree used to always call itself, even on linear lists, which
caused stack exhaustion on long lists. Make it copy linear lists
linearly, and recur only when necessary. This also makes it somewhat
faster.
Fixes lp#98926.

12 years agoopen intervals and type derivation
Christophe Rhodes [Sat, 12 May 2012 12:40:24 +0000 (13:40 +0100)]
open intervals and type derivation

When dealing with open intervals, preserving the openness of a bound in
a result depends on the operation being strictly monotonic, rather than
merely monotonic.  However, many operations which at first sight seem
strictly monotonic are in fact not, including:
- squaring (expt least-positive-double-float 2) = (expt 0d0 2)
- coercion (coerce (1+ double-float-epsilon) 'single-float)
  = (coerce 1d0 'single-float)

Modify various coercion and interval functions to include conservatism
in these situations.  (Fixes lp#997528)

12 years agoFix --dynamic-space-size 1GB on x86.
Stas Boukarev [Wed, 9 May 2012 22:47:03 +0000 (02:47 +0400)]
Fix --dynamic-space-size 1GB on x86.

Use unsigned longs instead of signed longs for handling
--dynamic-space-size, on x86 it can easily be exhausted.

12 years agoOptimize truncate, ceiling and friends when divisor is 1 or -1.
Stas Boukarev [Mon, 7 May 2012 12:18:33 +0000 (16:18 +0400)]
Optimize truncate, ceiling and friends when divisor is 1 or -1.

If divisor is 1, return (values x 0), if it's -1 (values (- x) 0). If
it's a floating point truncation, like ftruncate or fceiling,
(values (- (float x)) 0).

12 years agoUpdate ASDF to 2.21.
Stas Boukarev [Sat, 5 May 2012 09:38:21 +0000 (13:38 +0400)]
Update ASDF to 2.21.

Fixes lp#982286.

12 years agodon't unconditionally unparse CHARACTER-SET types into MEMBER types
Nikodemus Siivola [Fri, 4 May 2012 09:43:40 +0000 (12:43 +0300)]
don't unconditionally unparse CHARACTER-SET types into MEMBER types

  Doing so means dumping a list containing most of unicode for each
  function that return something like

    (code-char (+ <const> <(integer 0)>))

  which has a derived type (CHARACTER-SET ((<const> . 1114111))).

  Instead, pick whichever is more compact, using number of characters
  vs number of character code ranges as the deciding factor.

  This means that users can see SB-KERNEL:CHARACTER-SET types in
  eg. output from DESCRIBE or as return values from
  SB-INTROSPECT:FUNCTION-TYPE -- which is suboptimal, but less bad
  than such types slowing us down as horribly as they do prior to this
  change.

  At some point, however, we should document and export SB-EXT:CHARSET
  or something -- but I don't want to think of the issues associated
  with a public interface right now.

12 years agobetter timeout handling in EXIT and %EXIT-OTHER-THREADS
Nikodemus Siivola [Thu, 3 May 2012 10:25:09 +0000 (13:25 +0300)]
better timeout handling in EXIT and %EXIT-OTHER-THREADS

  Account the timeout against all the threads being joined, not each
  separately.

  Also move handling of "main thread exiting even though another
  thread got the call" handling to %EXIT.

  ...and one missing #!+sb-doc

12 years agomore deprecation
Nikodemus Siivola [Wed, 2 May 2012 11:48:35 +0000 (14:48 +0300)]
more deprecation

 * Add "Deprecated Interfaces" chapter to the manual.

 * Add list of deprecated interfaces along with a policy note to a
   comment near DEFINE-DEPRECATED-FUNCTION.

 * Add a proper deprecation warning for SB-C::MERGE-TAIL-CALLS.

 * Fix the deprecation warning for WITH-SPINLOCK. (Accidentally
   referred to WITH-RECURSIVE-SPINLOCK before.)

12 years agosb-posix: abort(3), exit(3), and _exit(2)
Nikodemus Siivola [Wed, 2 May 2012 13:46:13 +0000 (16:46 +0300)]
sb-posix: abort(3), exit(3), and _exit(2)

  Also fix docstring of SB-EXT:EXIT, which referred to exit as being section 2.

12 years agoruntime clean up.
Stas Boukarev [Tue, 1 May 2012 16:42:34 +0000 (20:42 +0400)]
runtime clean up.

coreparse.c: Move #define _BSD_SOURCE up, so that it won't conflict
with subsequent files, and #undef it after it's used to
include sys/mman.h

search.c(search_for_type): Remove unused variable addr.

interrupt.c: Remove double parentheses in if((x==y)).

run-program.c: Include sys/wait.h

12 years agoBetter equidistributed and faster/less consing integer RANDOM.
Lutz Euler [Tue, 1 May 2012 16:59:12 +0000 (18:59 +0200)]
Better equidistributed and faster/less consing integer RANDOM.

Up to now the implementation of RANDOM with an integer argument just
generated a few more random bits than the length of the argument and
took this value MOD the argument. This led to a slightly uneven
distribution of the possible values unless the argument was a power of
two. Moreover, for bignums, the algorithm was quadratic both in time and
space dependent on the number of bits of the argument.

Instead generate random integers using an accept-reject loop and change
the bignum implementation to an algorithm that is linear in time and
space.

I took some inspiration from WHN's attempt at an accept-reject loop
implementation in commit 0a7604d54581d2c846838c26ce6a7993629586fa and
following.

Thanks to Christophe Rhodes for reviewing this patch!

Some details:

The implementation works correctly with both a random chunk size equal
to the word size and equal to half the word size. This is currently
necessary as a 32-bit pseudo random generator is used both under 32 and
under 64 bit word size.

In the generic RANDOM case, fixnum and bignum limits are differentiated:

With a fixnum limit an accept-reject loop on a masked random chunk is
always used. Under 64 bit word size two random chunks are used only if
the limit is so large that one doesn't suffice. This never conses.

With a bignum limit four cases are differentiated to minimize consing.
If just one random chunk is needed to supply a sufficient number of bits
the implementation only conses if the result is indeed a bignum:
* If the limit is a power of two, a chunk is generated and shifted to
  get the correct number of bits.
* If the limit is not a power of two an accept-reject loop with shifting
  is used.
If more than one random chunk is needed, a bignum is always consed even
if it happens to normalize to a fixnum:
* If the limit is a power of two a straightforward algorithm is used to
  fill a newly created bignum with random bits.
* If the limit is not a power of two an accept-reject loop is used that
  detects rejection early by starting from the most significant bits,
  thus generating on the average only one random chunk more than needed
  to fill the result once.
The test for power of two is non-consing, too.

In the case of a compile-time constant integer argument (of at most word
size) a DEFTRANSFORM triggers, that, in the general case, compiles an
accept-reject loop. For values of the limit where this sufficiently
reduces the rejection probability the largest multiple of the limit
fitting in one or two random chunks is used instead inside the loop.
To bring the result in the correct range a division is then necessary
(which the compiler converts into a multiplication). Powers of two are
optimized by leaving out the rejection test. In those cases where a word
has more bits than a random chunk, the generated expression uses two
chunks only if necessary.

12 years agoAdd some tests for basic RANDOM functionality.
Lutz Euler [Tue, 1 May 2012 16:07:14 +0000 (18:07 +0200)]
Add some tests for basic RANDOM functionality.

There are currently few, if any, such tests, so ahead of profound
changes to integer RANDOM add some. They are neither systematic nor
comprehensive but should be better than nothing.

12 years agoFix the DEFTRANSFORM of RANDOM for hairy integer types.
Lutz Euler [Tue, 1 May 2012 13:57:03 +0000 (15:57 +0200)]
Fix the DEFTRANSFORM of RANDOM for hairy integer types.

With integer types that are neither an interval nor a single known value
the DEFTRANSFORM used to generate an expression that had two problems:
First, it yielded very uneven distributions of random values for most
arguments to RANDOM that are not very small. Second, it used a too small
RANDOM-CHUNK under 64 bits word size thus never generating numbers
larger than (1- (EXPT 2 32)) even if RANDOM's argument was larger than
(EXPT 2 32).

Fix this by giving up the transform in these cases.

Add a new file "tests/random.pure.lisp" containing tests for this.

12 years agoadd SB-UNIX:UNIX-EXIT back, use the deprecation framwork for it and SB-EXT:QUIT
Nikodemus Siivola [Tue, 1 May 2012 11:30:55 +0000 (14:30 +0300)]
add SB-UNIX:UNIX-EXIT back, use the deprecation framwork for it and SB-EXT:QUIT

  Also extend the deprecation framwork to support multiple replacements:
  SB-EXT:QUIT should be replaced either by SB-EXT:EXIT or SB-EXT:ABORT-THREAD,
  depending on the way it was being used.

12 years agoredesign exiting SBCL
Nikodemus Siivola [Tue, 6 Dec 2011 11:44:06 +0000 (13:44 +0200)]
redesign exiting SBCL

 Deprecate QUIT. It occupies an uncomfortable niche between processes
 and threads, and doesn't actually do what it says on the tin unless
 you call it from the main thread.

 SIGTERM now uses EXIT, and doesn't depend on sessions.

 WITH-DEADLINE (:SECONDS NIL :OVERRIDE T) can now be used to ignore
 deadlines.

 JOIN-THREAD on the main thread now blocks indefinitely instead of
 claiming the thread did not exit normally.

 New functions:

  * SB-EXT:EXIT. Always exits the process. Takes keywords :CODE,
    :ABORT, and :TIMEOUT. Code is the exit status. Abort controls if
    the exit is clean (unwind, exit-hooks, terminate other threads) or
    dirty. Timeout controls how long to wait for other threads to
    finish.

  * SB-THREAD:RETURN-FROM-THREAD. Normal termination for current
    thread -- equivalent to return from the thread function with the
    specified values. Takes keyword :ALLOW-EXIT, which determines if
    returning from the main thread is an error, or equivalent to
    calling EXIT :CODE 0.

  * SB-THREAD:ABORT-THREAD. Abnormal termination for current thread --
    equivalent to invoking the initial ABORT restart estabilished by
    MAKE-THREAD (previously known as TERMINATE-THREAD, but ANSI
    recommends there to always be an ABORT restart.) Takes keyword
    :ALLOW-EXIT, which determines if aborting the main thread is an
    error, or equivalent to calling EXIT :CODE 1.

  * SB-THREAD:MAIN-THREAD-P. Let's you determine if a given thread is
    the main thread of the process. This is important for some
    functions on some operating systems -- and RETURN-FROM-THREAD and
    ABORT-THREAD also need it.

  * SB-THREAD:MAIN-THREAD. Returns the main thread object. Convenient
    for when you need to eg. load a foreign library in the main
    thread.

12 years agotune bug-981106 test based on the heap size
Nikodemus Siivola [Sun, 29 Apr 2012 17:55:35 +0000 (20:55 +0300)]
tune bug-981106 test based on the heap size

  Fixes lp#983807.

12 years agogencgc: scale generation.bytes_consed_between_gc to number of gens
Nikodemus Siivola [Sun, 29 Apr 2012 17:06:45 +0000 (20:06 +0300)]
gencgc: scale generation.bytes_consed_between_gc to number of gens

  This means we have by default 5% of total heap usable in the nursery
  between GCs, and another 5% of the total heap split between all the
  generations -- and roughly matches the nursery/old generation sizes
  relations from before the dynamic-space-size based scaling.

  Fixes lp#991293, regression since
  6848a92fd4af23d0695eeaaed9efcbdfd9e1d9e5.

12 years agoBetter error messages to condition signalling functions.
Stas Boukarev [Fri, 27 Apr 2012 23:54:47 +0000 (03:54 +0400)]
Better error messages to condition signalling functions.

12 years agogencgc: i in add_new_area needs to be signed
Nikodemus Siivola [Fri, 27 Apr 2012 17:48:00 +0000 (20:48 +0300)]
gencgc: i in add_new_area needs to be signed

  Regression from 7be8d1462a207bda809cd7553c5d76c6ebc4dda2,
  broke finalize.test.sh on x86 builds.

  Fixes lp#989958.

12 years agofix compiler reader error reporting
Nikodemus Siivola [Fri, 27 Apr 2012 13:19:40 +0000 (16:19 +0300)]
fix compiler reader error reporting

  Stream slot was left unbound along one leg, which is bad because
  READER-ERROR is a subtype of STREAM-ERROR.

12 years agoMicro-optimizations in MOVE-IMMEDIATE and MOVE-ARG on x86-64
Lutz Euler [Wed, 25 Apr 2012 22:49:06 +0000 (00:49 +0200)]
Micro-optimizations in MOVE-IMMEDIATE and MOVE-ARG on x86-64

In MOVE-IMMEDIATE, when the target is in memory, avoid using a temporary
register for more values than currently: The MOV instruction can move
immediate values of type (SIGNED-BYTE 32) into 64-bit memory locations,
not only (SIGNED-BYTE 31).

Simplify a TYPE-CASE in MOVE-ARG: merge two clauses that generated
exactly the same MOV instruction; spare a call to MOVE-IMMEDIATE and
get rid of two ugly literal 29s thereby.

Add a test.

12 years agoBetter arglists for some package accessors.
Stas Boukarev [Tue, 24 Apr 2012 23:29:25 +0000 (03:29 +0400)]
Better arglists for some package accessors.

package-nicknames, package-use-list, package-used-by-list,
package-shadowing-symbols now have `package-designator' instead of `x'
in their arlgists.

Closes lp#854314.

Clean up: remove a duplicate definition from tests/compiler-test-util.lisp

12 years agoremove world-lock from around FASL loading
Nikodemus Siivola [Fri, 9 Dec 2011 18:39:57 +0000 (20:39 +0200)]
remove world-lock from around FASL loading

  The fasl loader itself is thread safe these days, but what about the stuff
  we do at load time?

  In principle it /should/ be, so let the shakeout cruise start.

12 years agoglobaldb: remove ENV-LIST arguments from INFO functions
Nikodemus Siivola [Mon, 20 Jun 2011 09:27:32 +0000 (12:27 +0300)]
globaldb: remove ENV-LIST arguments from INFO functions

  Unused except by %DEFKNOWN, which passed in *INFO-ENVIRONMENT* anyways.

12 years agoglobaldb: add source-transforms for INFO functions on host
Nikodemus Siivola [Sun, 19 Jun 2011 21:32:05 +0000 (00:32 +0300)]
globaldb: add source-transforms for INFO functions on host

 Regular compiler macros defined on host do not take effect when XC is
 building the target -- so INFO calls in the build before globaldb got the
 slow path up to now. Using source-transforms we get the fast path for all
 INFO calls on target.

 Speeds up globaldb bound functions like FDEFINITION by 20% or so.

12 years agomove ABOUT-TO-MODIFY-SYMBOL-VALUE to symbol.lisp
Nikodemus Siivola [Sun, 19 Jun 2011 21:09:24 +0000 (00:09 +0300)]
move ABOUT-TO-MODIFY-SYMBOL-VALUE to symbol.lisp

  Doesn't really belong in early-extensions.lisp.

12 years agobetter reader-errors for COMPILE-FILE
Nikodemus Siivola [Tue, 24 Apr 2012 06:16:47 +0000 (09:16 +0300)]
better reader-errors for COMPILE-FILE

 * Make SIMPLE-READER-PACKAGE-ERROR a subclass of PACKAGE-ERROR.

 * Make reader signal a SIMPLE-READER-PACKAGE-ERROR for missing packages,
   instead of a vanilla PACKAGE-ERROR: that way get the position reported as
   well.

 * Factor out line and column reporting logic for reader-errors into a
   separate function, and allow using other than current file position.

 * READ-FOR-COMPILE-FILE needs to use COMPILER-ERROR, and
   INPUT-ERROR-IN-COMPILE-FILE is a subclass of READER-ERROR, not a
   FATAL-COMPILER-CONDITION.

 * *COMPILER-ERROR-BAILOUT* binding in SUB-COMPILE-FILE was missing the
   condition argument from the lambda-list, and should not mumble to
   *STANDARD-OUTPUT*.

 This patch converts all input errors into COMPILE-FILE failures without
 dropping into the debugger. That might be taking things too far, though --
 but the question of "which errors should we let enter the debugger" has no
 obvious answers to me at least. Perhaps *COMPILER-HANDLED-ERRORS* is the way
 to go?

 Fixes lp#493380

12 years agoAllow larger immediate values in fixnum arithmetic on x86-64.
Lutz Euler [Mon, 23 Apr 2012 20:11:05 +0000 (22:11 +0200)]
Allow larger immediate values in fixnum arithmetic on x86-64.

Arithmetic on tagged fixnums currently assembles only constant fixnums
of type (SIGNED-BYTE 29) as immediate arguments to the machine
instructions. When N-FIXNUM-TAG-BITS is less than 3 a larger range of
fixnums could be treated this way. This is desirable as it avoids the
costs of the alternative, namely to put the value into the constant
pool.

So change this type to (SIGNED-BYTE (- 32 N-FIXNUM-TAG-BITS)).

Extend an existing test to cover constants in this range, too.

Many thanks to Paul Khuong for help in finding a name for the type.

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