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.
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.
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.
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.
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.
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.
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.
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.
Juho Snellman [Sun, 20 May 2012 18:55:37 +0000 (20:55 +0200)]
1.0.57: will be tagged as "sbcl-1.0.57"
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.
Stas Boukarev [Wed, 16 May 2012 22:51:51 +0000 (02:51 +0400)]
define-condition: return the name of the defined condition.
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)).
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.
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.
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)
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.
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).
Stas Boukarev [Sat, 5 May 2012 09:38:21 +0000 (13:38 +0400)]
Update ASDF to 2.21.
Fixes lp#982286.
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.
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
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.)
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.
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
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.
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.
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.
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.
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.
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.
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.
Stas Boukarev [Fri, 27 Apr 2012 23:54:47 +0000 (03:54 +0400)]
Better error messages to condition signalling functions.
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.
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.
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.
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
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.
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.
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.
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.
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
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.
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.
Lutz Euler [Fri, 20 Apr 2012 17:48:51 +0000 (19:48 +0200)]
Typo fixes in comments
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.
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.)
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.
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.
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 ...>"
Nikodemus Siivola [Thu, 19 Apr 2012 10:44:13 +0000 (13:44 +0300)]
wrap a couple of long lines
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.
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
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.
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.
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.
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.
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.
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
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.
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)
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.
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
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.
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.
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.
Christophe Rhodes [Fri, 13 Apr 2012 15:16:37 +0000 (16:16 +0100)]
support funcallable-instances in ROOM/map-allocated-objects
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...
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
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
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).
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".
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.
Nikodemus Siivola [Wed, 28 Mar 2012 11:16:54 +0000 (14:16 +0300)]
cleanup: remove cast to (unsigned long) from print_ptr()
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...
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.
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.
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.
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.
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
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
Nikodemus Siivola [Tue, 27 Mar 2012 07:53:19 +0000 (10:53 +0300)]
don't refer to unix namestrings on windows
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
Nikodemus Siivola [Wed, 28 Mar 2012 07:00:00 +0000 (10:00 +0300)]
better REPLACE docstring
lp#965592
Juho Snellman [Thu, 12 Apr 2012 21:07:37 +0000 (21:07 +0000)]
1.0.56: will be tagged as "sbcl-1.0.56"
Juho Snellman [Thu, 12 Apr 2012 15:10:25 +0000 (17:10 +0200)]
Add workaround to a flaky semaphore timeout test.
Juho Snellman [Mon, 2 Apr 2012 03:50:46 +0000 (05:50 +0200)]
Add an entry for ASDF upgrade to NEWS
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.
Juho Snellman [Sun, 25 Mar 2012 21:16:49 +0000 (23:16 +0200)]
contrib/asdf: Import asdf 2.20 from upstream.
* lp#933112
Christophe Rhodes [Sun, 25 Mar 2012 06:41:21 +0000 (07:41 +0100)]
Fix build on PPC/Darwin
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.
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.
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.
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.
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.
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.
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.
Stas Boukarev [Sun, 19 Feb 2012 04:00:08 +0000 (08:00 +0400)]
coreparse.c: Fix a typo WORD_FTMX -> WORD_FMTX.
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
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)))
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.
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 /".