sbcl.git
10 years agoFix make-array transforms. master
Stas Boukarev [Sun, 5 Jan 2014 09:54:19 +0000 (13:54 +0400)]
Fix make-array transforms.

Don't call UPGRADED-ARRAY-ELEMENT-TYPE on types without checking that
they don't contain unknown types (i.e., intersections or unions
containing unknown-type), since U-A-E-T now signals errors for these.

Reported by Bart Botta.

10 years agobetter encapsulation support in generic functions
Christophe Rhodes [Sat, 4 Jan 2014 19:40:25 +0000 (19:40 +0000)]
better encapsulation support in generic functions

It's not very nice to alter the fdefinition of names which refer to
generic functions: it might not be strictly required by the spec, but
preserving the class of generic functions when encapsulated is more
friendly, so that attempts to trace or profile them doesn't break any
metaobject protocol logic which refers to particular functions by
name.  Fortunately, it's fairly straightforward to
support (un)encapsulation of generic functions through adapting the
discriminating function instead.

10 years agoUPGRADED-ARRAY-ELEMENT-TYPE: more thoroughly signal errors on unknown types.
Stas Boukarev [Fri, 3 Jan 2014 14:03:21 +0000 (18:03 +0400)]
UPGRADED-ARRAY-ELEMENT-TYPE: more thoroughly signal errors on unknown types.

Intersection and union types containing unknown types were handled incorrectly.
(upgraded-array-element-type '(and fixnum unknown)) => was FIXNUM.

10 years agoFix the recent %vector-widetag-and-n-bits change.
Stas Boukarev [Fri, 3 Jan 2014 11:59:55 +0000 (15:59 +0400)]
Fix the recent %vector-widetag-and-n-bits change.

Handle extended-char, interval type designators, and union types.

10 years agoRestore PPC build.
Stas Boukarev [Fri, 3 Jan 2014 08:47:58 +0000 (12:47 +0400)]
Restore PPC build.

Adjust register lifetime in calling VOPs.

Thanks to Alastair Bridgewater.

10 years agoOptimize MAKE-ARRAY on unknown element-type.
Stas Boukarev [Thu, 2 Jan 2014 09:03:52 +0000 (13:03 +0400)]
Optimize MAKE-ARRAY on unknown element-type.

Reimplement %vector-widetag-and-n-bits without using subtypep,
providing an order of magnitude speed up.

Out of line make-array :element-type 'character also caused to cons
twice larger than needed vectors on x86-64.
(Though that wasted space was reclaimed after GC).

Closes lp#1004501.

10 years agogencgc: code_page_p() must die!
Alastair Bridgewater [Tue, 31 Dec 2013 21:34:51 +0000 (16:34 -0500)]
gencgc: code_page_p() must die!

  * The last call site for code_page_p() is now a redundant test
for a specific (non-critical) edge case in the logic for dealing
with conservative roots, so kill it.

  * And now that nothing calls code_page_p(), kill it before it
has a chance to maul any other SBCL hackers.

10 years agogencgc: Pick out shrunk object tails earlier in conservative root logic.
Alastair Bridgewater [Tue, 31 Dec 2013 20:51:21 +0000 (15:51 -0500)]
gencgc: Pick out shrunk object tails earlier in conservative root logic.

  * BIGNUM and VECTOR objects can be allocated overlarge and then
shrunk once the actual required length is known.  This leaves a
"tail" of dead (0 . 0) CONSes.  When this happens in large-object
pages (as opposed to normal pages), we can see that this has
happened and treat any pointer to such objects as not being a
conservative root.

  * Unfortunately, where we currently perform this test we don't
have enough information available to easily say that the reference
is definitely to one of these dead objects, so we use a more
conservative test than strictly required.

  * Add another test for the same situation, but earlier in the
logic, and using a more precise test, so that we can skip a bit of
extra work in such (rare) cases, and so that we can simplify the
overall logic.

10 years agogencgc: More precise conservatism for pointers to boxed pages.
Alastair Bridgewater [Tue, 31 Dec 2013 16:27:18 +0000 (11:27 -0500)]
gencgc: More precise conservatism for pointers to boxed pages.

  * The commentary for possibly_valid_dynamic_space_pointer()
claims that it matches unboxed return addresses (to within code
objects), but this turns out not to be the case.

  * Fix the code to match the comment, at least somewhat, by
checking to see if the object found is a code object and
shortcutting the full validation if it is.

  * And, now that we have a version of p_v_d_s_p() that does the
"right thing", or at least close to it with respect to the only
truly unboxed interior pointers that we should have to deal with,
call it straight up instead of only for unboxed pages when we have
a true pointer type.

  * Overall, this can be expected to be slower than the prior
version, but more precise in terms of rogue integers in the heap
range.  The remaining conservation effects would be due to the
fact that we can't move ANYTHING that's a conservative root and
stale pointers within our active area (truly precise ports are
less affected by this because they can relocate objects pointed to
by stale pointers).

10 years agogencgc: Simpler conservative root validation on non-x86oids.
Alastair Bridgewater [Tue, 31 Dec 2013 14:48:10 +0000 (09:48 -0500)]
gencgc: Simpler conservative root validation on non-x86oids.

  * On "precise" gencgc targets (currently, non-x86oids), we only
ever treat valid object pointers as conservative (pinned) roots,
so most of the validity checking is unnecessary.

  * Add a shortcut path through valid_conservative_root_p() for
this precise case.

10 years agogencgc: Extract go/no-go decision logic from preserve_pointer().
Alastair Bridgewater [Tue, 31 Dec 2013 14:07:32 +0000 (09:07 -0500)]
gencgc: Extract go/no-go decision logic from preserve_pointer().

  * Approximately 1/pi of preserve_pointer() is involved in
verifying that the candidate pointer is valid as a conservative
root.  This is easily extractable logic that acts as a predicate,
so box it up as one, calling it as a guard clause from where it
originally stood.

10 years agoHandle run-program with :directory nil.
Stas Boukarev [Tue, 31 Dec 2013 13:33:53 +0000 (17:33 +0400)]
Handle run-program with :directory nil.

Handle :directory nil as advertised, not changing the current directory.

Fixes lp#1265077.

10 years agogencgc: Reduce conservatism for pointers to unboxed pages.
Alastair Bridgewater [Mon, 30 Dec 2013 22:37:04 +0000 (17:37 -0500)]
gencgc: Reduce conservatism for pointers to unboxed pages.

  * Because return addresses are unmarked, unboxed interior
pointers must be allowed to pin if they point within a code object.
Assuming that code objects are only allocated to CODE_PAGE_FLAG
pages, preserve_pointer() will allow any code_page_p() true page
to be pinned by any pointer to within its body.

  * But code_page_p() was broken, being an alternate version of
page_allocated_p() in implementation, with no warning or comment.
The net effect is extra conservatism: Any pointer to allocated
space will pin whatever page it points to.

  * Code pages aren't always allocated to CODE_PAGE_FLAG pages,
for a couple of reasons.  Until we can maintain such an invariant,
we can only use the weaker version (which DOES hold): code objects
are always allocated to boxed pages (either BOXED_PAGE_FLAG or
CODE_PAGE_FLAG, never FREE_PAGE_FLAG or UNBOXED_PAGE_FLAG).

  * Reduce conservatism in the GC by making code_page_p() delegate
to page_boxed_p(), thus tightening up the test for pinning unboxed
pages.

  * Also leave the "correct" logic for code_page_p() in place but
disabled (and make it actually BE correct), and add a comment
explaining part of what's going on.

10 years agoexternal-formats: Add support for MacRoman character encoding.
Alastair Bridgewater [Sun, 22 Dec 2013 23:42:43 +0000 (18:42 -0500)]
external-formats: Add support for MacRoman character encoding.

  * This is rarely used these days, having been supplanted by the
use of UTF-8 with the adoption of OSX, but it is occasionally seen
"in the wild", or if someone has an interoperability concern with
antique macs.  I was rather surprised to encounter a CSV file
recently, with data for an event in May of 2013, that happened to
be MacRoman encoded, and then further surprised to find that SBCL
had no support for the encoding.

  * I have tested this interactively only, using OCTETS-TO-STRING
to verify that a sequence of the upper half of the 8-bit encoding
space was correctly mapped to unicode characters.

10 years agoReally restore clisp cross-compilation.
Stas Boukarev [Fri, 20 Dec 2013 00:34:17 +0000 (04:34 +0400)]
Really restore clisp cross-compilation.

Some more loop madness.

Patch by Vasily Postnicov, lp#1261451.

10 years agoRestore cross-compilation with CLISP.
Stas Boukarev [Mon, 16 Dec 2013 14:22:23 +0000 (18:22 +0400)]
Restore cross-compilation with CLISP.

Due to WHILE before FOR in a LOOP in sb-impl::split-version-string.

Reported by Vasily Postnicov.

10 years agoMark (RANGE-REDUCTION PRECISE-PI) as failing on openbsd x86-64.
Joshua Elsasser [Mon, 9 Dec 2013 04:23:04 +0000 (20:23 -0800)]
Mark (RANGE-REDUCTION PRECISE-PI) as failing on openbsd x86-64.

I don't believe it has ever passed on that platform, so mark it as
such to make any new test failures more noticable.

10 years agoFix cut-to-width in the presence of bad constants in dead code.
Stas Boukarev [Sat, 7 Dec 2013 09:04:14 +0000 (13:04 +0400)]
Fix cut-to-width in the presence of bad constants in dead code.

Unreachable branches may have mismatching types and constant values,
and when cut-to-width is run before such nodes are deleted, it gets
confused.

Reported by Douglas Katzman.

10 years agoOptimize make-array for unknown dimensions.
Stas Boukarev [Tue, 3 Dec 2013 18:31:09 +0000 (22:31 +0400)]
Optimize make-array for unknown dimensions.

(make-array x :element-type '(unsigned-byte 8)) went through a costly
procedure of determining what type should be used for
(unsigned-byte 8), but this can be done at compile-time.
That form is now 25 times faster, and only 4 times slower than
(make-array (the integer x) :element-type '(unsigned-byte 8))

10 years agoIterative Chaitin-Briggs style spilling/coloring register allocation
Paul Khuong [Tue, 12 Nov 2013 23:39:35 +0000 (18:39 -0500)]
Iterative Chaitin-Briggs style spilling/coloring register allocation

* sb-regalloc:*register-allocation-method* determine which packing
  algorithm is chosen.
 - :adaptive, the default value, only executes the iterative algorithm
   if some code block has (> speed compilation-speed) and (speed 3);
   otherwise, the usual greedy algorithm is chosen.
 - :greedy always chooses the old greedy algorithm.
 - :iterative always chooses the new iterative algorithm.

Some references describing this family of register allocation, spilling
and coalescing algorithms are listed in the header of
src/compiler/pack-iterative.lisp.

This code is simply an optimised and cleaned up version of the awesome
work done by Alexandra Barchunova as part of Google Summer of Code '13.
It's difficult to overestimate the amount of earlier time and effort
that aren't visible but had to happen to fix bugs and document old code
in order to finally make this possible.

Hectokudos to abarch!

10 years agoNew TN cost computation: directly take depth into account
Paul Khuong [Sun, 1 Dec 2013 23:08:29 +0000 (18:08 -0500)]
New TN cost computation: directly take depth into account

10 years agoMove greedy register allocation to its own function, PACK-GREEDY
Paul Khuong [Tue, 12 Nov 2013 23:35:48 +0000 (18:35 -0500)]
Move greedy register allocation to its own function, PACK-GREEDY

In preparation for there being multiple allocators.

10 years agoMove register allocation to its own package, SB!REGALLOC
Paul Khuong [Tue, 12 Nov 2013 23:31:59 +0000 (18:31 -0500)]
Move register allocation to its own package, SB!REGALLOC

10 years agoSimplify (and robustify) regular PACKing
Paul Khuong [Tue, 12 Nov 2013 23:22:20 +0000 (18:22 -0500)]
Simplify (and robustify) regular PACKing

* Make sure that only wired TNs are allocated to stack locations
  until the final pass.

* When using loop depth to prioritise TNs, find them by iterating over
  the list of TNs, instead of reprocessing global TNs that appear in
  multiple IR2 blocks.

* In the final pass that allocates leftover TNs (mostly to the stack),
  make sure that any TN with a negative spill cost (i.e., the score
  says it's actually useful to spill it) is allocated a stack slot.

10 years agoActually optimize in PACK-TN
Paul Khuong [Wed, 20 Nov 2013 00:53:02 +0000 (19:53 -0500)]
Actually optimize in PACK-TN

We used to track location usage information, but never use it to
determine which register to use.  I'm not actually convinced that
this change improves the quality of the code we generate, but it
can't hurt for PACK-TN to actually do what it says it does: usage-
guided packing can always be disabled if it's not useful.

10 years agoMicrooptimise TN-LEXICAL-DEPTH
Paul Khuong [Tue, 12 Nov 2013 23:19:55 +0000 (18:19 -0500)]
Microoptimise TN-LEXICAL-DEPTH

10 years agoUtility predicates for packing: UNBOUNDED-SC-P and UNBOUNDED-TN-P
Paul Khuong [Wed, 13 Nov 2013 18:18:29 +0000 (13:18 -0500)]
Utility predicates for packing: UNBOUNDED-SC-P and UNBOUNDED-TN-P

Determine if the backing storage base (or the preferred storage
class for a TN) is :UNBOUNDED, i.e., on the stack.

10 years agoUse SCHWARTZIAN-STABLE-SORT-LIST in SELECT-LOCATION
Paul Khuong [Wed, 13 Nov 2013 18:16:27 +0000 (13:16 -0500)]
Use SCHWARTZIAN-STABLE-SORT-LIST in SELECT-LOCATION

LOOP in a :KEY function may not be the best idea.

10 years agoNew function SB-IMPL:SCHWARTZIAN-STABLE-SORT-LIST
Paul Khuong [Wed, 13 Nov 2013 18:14:46 +0000 (13:14 -0500)]
New function SB-IMPL:SCHWARTZIAN-STABLE-SORT-LIST

Stable sort because we really ought to avoid normal sort if we want
reproducible builds, and a Schwartzian transform because we sometimes
sort with fairly computation-heavy sort keys.  Better have that to
make it easy to DTRT.

10 years agoYank DO-TARGET-TNS out of FIND-OK-TARGET-OFFSET
Paul Khuong [Tue, 12 Nov 2013 22:59:02 +0000 (17:59 -0500)]
Yank DO-TARGET-TNS out of FIND-OK-TARGET-OFFSET

Also, try to make the logic a bit more understandable, but I'm
frankly as baffled as everyone else.

10 years agoGeneralise ASSIGN-TN-DEPTHS to expose the reduce function
Paul Khuong [Tue, 12 Nov 2013 22:49:05 +0000 (17:49 -0500)]
Generalise ASSIGN-TN-DEPTHS to expose the reduce function

By default, this still computes the maximum loop depth at which a
TN is accessed, but, e.g., changing that to #'+ will compute the
sum of the depths at which the TN appears.

Also, process all the references to each TN at a time, instead of
walking down the list of IR2 blocks to update every TN that appear
in each block.

10 years agoParameterise ASSIGN-TN-COSTS to make writes more important
Paul Khuong [Tue, 12 Nov 2013 22:47:18 +0000 (17:47 -0500)]
Parameterise ASSIGN-TN-COSTS to make writes more important

*TN-WRITE-COST* determines the weight given to writes when computing
the cost for allocating a TN on the stack. It defaults to 2, versus
1 for reads.

Also, hoist some special lookups out of loops.

10 years agoFix a logic bug in TNS-CONFLICT-GLOBAL-GLOBAL
Paul Khuong [Tue, 12 Nov 2013 21:55:02 +0000 (16:55 -0500)]
Fix a logic bug in TNS-CONFLICT-GLOBAL-GLOBAL

That function was never used, so it's not a correctness issue, but
it's useful (when correct) to debug register allocation.

10 years agoFuller error message in PACK-WIRED-TN
Paul Khuong [Tue, 12 Nov 2013 23:18:32 +0000 (18:18 -0500)]
Fuller error message in PACK-WIRED-TN

Cribbed directly from Alexandra Barchunova's regalloc work.

10 years agoConvert an ASSERT into an AVER in INIT-LIVE-TNS
Paul Khuong [Tue, 12 Nov 2013 22:55:38 +0000 (17:55 -0500)]
Convert an ASSERT into an AVER in INIT-LIVE-TNS

10 years agoLet OFFSET-CONFLICTS-IN-SB check multiple offsets at a time
Paul Khuong [Tue, 12 Nov 2013 22:44:54 +0000 (17:44 -0500)]
Let OFFSET-CONFLICTS-IN-SB check multiple offsets at a time

Instead of calling that function within a loop. Now returns the
offending offset if any, instead of a plain T. It probably doesn't
make that much of a difference, but we might as well factor it out
and recycle some pointer chasing at the same time.

10 years agoRemove a workaround in bit-vector consets
Paul Khuong [Tue, 12 Nov 2013 21:48:46 +0000 (16:48 -0500)]
Remove a workaround in bit-vector consets

FOLD-INDEX-ADDRESSING was fixed in 1.0.9, and there is no compiler bug
anymore on FIND of bit vectors with :END, even at low safety.

When attempting to bootstrap from an older x86oids SBCL, the :END
argument can be commented out without affecting correctness.

10 years agoAdd :application-type parameter for save-lisp-and-die on Windows.
Stas Boukarev [Sun, 1 Dec 2013 15:25:25 +0000 (19:25 +0400)]
Add :application-type parameter for save-lisp-and-die on Windows.

Allows to choose the executable subsystem type, :console or :gui.
Default is :console.

10 years agoLinux/MIPS uses "unsigned long" instead of dev_t in struct stat
David Lichteblau [Wed, 31 Oct 2012 15:20:11 +0000 (16:20 +0100)]
Linux/MIPS uses "unsigned long" instead of dev_t in struct stat

Handle rdev the same way as dev.

10 years agoFix output streams on Windows for GUI executables.
Stas Boukarev [Sun, 1 Dec 2013 09:27:17 +0000 (13:27 +0400)]
Fix output streams on Windows for GUI executables.

Direct *STDIN*, *STDOUT*, and *STDERR* to NUL on Windows when the
standard handles are not available.

Patch by Wilfredo Velazquez. Fixes lp#125603.

10 years agoBetter printing of out of range --dynamic-space-size arguments.
Stas Boukarev [Sat, 30 Nov 2013 20:53:13 +0000 (00:53 +0400)]
Better printing of out of range --dynamic-space-size arguments.

Stop printing unsigned values of dynamic-space-size as signed, %lu, not %ld.
Instead of "argument 4000 is too large, max 4143972351", print
"argument 4000 [MB] is too large, max 4046847 KB".

10 years agoOptimize CONCATENATE transform.
Stas Boukarev [Sat, 30 Nov 2013 16:52:11 +0000 (20:52 +0400)]
Optimize CONCATENATE transform.

Avoid redundant type-checks, avoid passing unnecessary arguments to
REPLACE.

10 years agoMicro-optimize vector creation.
Stas Boukarev [Sat, 30 Nov 2013 16:12:22 +0000 (20:12 +0400)]
Micro-optimize vector creation.

transform-make-array-vector expanded into
(allocate-vector typecode (the index length) (ceiling length x))
but the transform applied to CEILING before it was known that LENGTH
is of type INDEX was producing bad results,
(ceiling (truly-the index length) x) solves that.

10 years ago1.1.14: will be tagged as "sbcl-1.1.14"
Christophe Rhodes [Sat, 30 Nov 2013 14:28:09 +0000 (14:28 +0000)]
1.1.14: will be tagged as "sbcl-1.1.14"

10 years agoFix the cheneygc build
David Lichteblau [Fri, 29 Nov 2013 20:23:48 +0000 (22:23 +0200)]
Fix the cheneygc build

Cheneygc takes a generation argument, but ignores it.

10 years agoFix deadlocks in GC on Windows.
Stas Boukarev [Fri, 22 Nov 2013 18:38:31 +0000 (22:38 +0400)]
Fix deadlocks in GC on Windows.

When multiple threads cons and end up in the GC, they could deadlock
trying to send messages using safepoints and trying to acquire the
*already-in-gc* lock.

Also happens to stop gc.impure.lisp / BUG-936304 test from failing on linux-x86.

Thanks to Paul Khuong for the patch.

10 years agofix manual build
Christophe Rhodes [Wed, 20 Nov 2013 21:23:22 +0000 (21:23 +0000)]
fix manual build

just the wrong include for assert-version->=

10 years agomore targetted warnings for probable DEFSTRUCT syntax errors
Christophe Rhodes [Mon, 18 Nov 2013 14:11:45 +0000 (14:11 +0000)]
more targetted warnings for probable DEFSTRUCT syntax errors

Some keyword defstruct slot names are more deserving of warnings
than others.  In particular, slot names matching defstruct
options (from name-and-options) are highly suspicious, and likely
never to be intended, as there is essentially always a different
way of writing what is meant.

The exception is when the CONC-NAME defstruct option is null,
which makes defstruct slots effectively have symbolic identity
rather than the normal stringish nature; don't emit full
warnings under those circumstances, even though doing
  (defstruct (foo :conc-name) (:constructor))
is a pretty spectacularly bad idea.

10 years agoremove misplaced AVER
Christophe Rhodes [Mon, 18 Nov 2013 14:07:48 +0000 (14:07 +0000)]
remove misplaced AVER

(defstruct nil x) is clearly never going to work, but doesn't
deserve the scary "probably a bug in SBCL itself" message

10 years agoImprove ARRAY-RANK transform.
Stas Boukarev [Mon, 18 Nov 2013 11:16:04 +0000 (15:16 +0400)]
Improve ARRAY-RANK transform.

* Don't crash on bad types.
* Delay the transform if the type isn't yet known.

Fixes lp#1252108.

10 years agoFix a regression in class accessors.
Stas Boukarev [Sat, 16 Nov 2013 21:50:09 +0000 (01:50 +0400)]
Fix a regression in class accessors.

A call to accessor-method-p was lost in the rewrite of
accessor-values-internal.

10 years agoInherit FP modes for new threads on Windows.
Stas Boukarev [Sat, 16 Nov 2013 10:23:08 +0000 (14:23 +0400)]
Inherit FP modes for new threads on Windows.

Newly created threads have all the traps cleared, while on other
platforms they are inherited from the parent thread.

10 years agoFix :bug-309448 test for faster CPUs.
Stas Boukarev [Fri, 15 Nov 2013 20:28:09 +0000 (00:28 +0400)]
Fix :bug-309448 test for faster CPUs.

Despite claiming to be resilient to timing differences of different
machines, it still fails to do so by hard-coding the number of
iterations, which fails on faster machines.
Determine the number of iterations for which the time difference is
not zero.

10 years agoFix system error message decoding on Windows.
Stas Boukarev [Fri, 15 Nov 2013 18:27:21 +0000 (22:27 +0400)]
Fix system error message decoding on Windows.

It used a scheme where negative error codes indicated the need to use
FormatMessage instead of strerror(3), but the sb-int::strerror
function didn't know about such arrangements and called strerror(3)
with negative codes, resulting in "Unknown error".
Remove negation, and unconditionally call FormatMessage on Windows.

10 years agopartially rewrite accessor-values-internal
Christophe Rhodes [Fri, 15 Nov 2013 09:25:51 +0000 (09:25 +0000)]
partially rewrite accessor-values-internal

It looks old and crufty, but the reason was to handle the admittedly
esoteric case of NIL as a slot name, which can happen in structure
classes.  Be more defensive against merrily finding slot definitions
that have nothing to do with the method in question.

This drive-by fixes lp#633911

10 years agorelax restriction on defstruct slot names
Christophe Rhodes [Fri, 15 Nov 2013 09:01:41 +0000 (09:01 +0000)]
relax restriction on defstruct slot names

DEFSTRUCT slot names are a bit weird, but behave basically like
strings rather than like symbols.  This makes their interaction with
the MOP a little problematic, but for now simply allow things to
pass through and generally work "as expected".

Report from Eric Marsden sbcl-devel 2013-11-05

10 years agofix another LET*/:interpret bug
Christophe Rhodes [Thu, 14 Nov 2013 17:36:21 +0000 (17:36 +0000)]
fix another LET*/:interpret bug

reported by Douglas Katzman sbcl-devel 2013-09-08

10 years agoMore meaningful error message for OPEN :IF-EXISTS :NEW-VERSION
Paul Khuong [Thu, 14 Nov 2013 20:15:38 +0000 (15:15 -0500)]
More meaningful error message for OPEN :IF-EXISTS :NEW-VERSION

We don't try to simulate versioned filesystems on top of standard
UNIX operations, because that would be lossy.  Now explained more
explicitly.

Based on a patch by Philip Munksgaard, fixes lp#455381.

10 years agoMore reliable test for asynchronous aborts in semaphore operations
Paul Khuong [Thu, 14 Nov 2013 22:12:57 +0000 (17:12 -0500)]
More reliable test for asynchronous aborts in semaphore operations

Test case by Andreas Franke (lp#1038034, comment #17).  We'll see
about committing the somewhat hairy fix for CONDITION-WAIT in #16
some other time.

10 years agoNew function SB-EXT:ASSERT-VERSION->=
Paul Khuong [Thu, 14 Nov 2013 21:51:18 +0000 (16:51 -0500)]
New function SB-EXT:ASSERT-VERSION->=

Executing (sb-ext:assert-version->= 1 1 13) signals a continuable
error if the running SBCL is older than 1.1.13 (and an undefined
function error before that).

Based on a patch by Philip Munksgaard.

Closes lp#674372.

10 years agoTail call (exec) at the end of run-sbcl.sh
Paul Khuong [Thu, 14 Nov 2013 19:22:47 +0000 (14:22 -0500)]
Tail call (exec) at the end of run-sbcl.sh

exec-ing into the runtime executable doesn't hurt and helps rlwrap.

Suggested by William Cushing (lp#1249183).

10 years agosb-sprof: Move tests into test.lisp.
Stas Boukarev [Wed, 13 Nov 2013 11:34:58 +0000 (15:34 +0400)]
sb-sprof: Move tests into test.lisp.

Instead of having tests in sb-sprof.lisp and running them from
test.lisp, move everything into test.lisp.

10 years agoremove asdf-install contrib
Cyrus Harmon [Tue, 12 Nov 2013 22:10:59 +0000 (14:10 -0800)]
remove asdf-install contrib

10 years agoFix typos in docstrings and function names.
Stas Boukarev [Tue, 12 Nov 2013 14:40:23 +0000 (18:40 +0400)]
Fix typos in docstrings and function names.

Includes an incompatibility change, sb-thread:thread-eMphemeral-p has
a typo, but it doesn't appear to be used anywhere outside of SBCL.

10 years agoAdd test for my commit 0e8649... of last week
Douglas Katzman [Mon, 11 Nov 2013 22:53:37 +0000 (17:53 -0500)]
Add test for my commit 0e8649... of last week

10 years agowin32: provide error messages when loading foreign libraries.
Stas Boukarev [Mon, 11 Nov 2013 11:13:51 +0000 (15:13 +0400)]
win32: provide error messages when loading foreign libraries.

Decode the error codes into messages.

10 years agoMore robust homedir detection on Windows.
Stas Boukarev [Sun, 10 Nov 2013 18:26:17 +0000 (22:26 +0400)]
More robust homedir detection on Windows.

After consulting HOME, try USERPROFILE, then HOMEDRIVE+HOMEPATH.

Fixes lp#922117.

10 years agoFix merging of ~/ pathnames.
Stas Boukarev [Sun, 10 Nov 2013 15:59:35 +0000 (19:59 +0400)]
Fix merging of ~/ pathnames.

Don't merge the device component if the resulting pathname starts with
:absolute :home. The expansion of ~ may contain it's own device,
causing problems, especially on Windows, where
(merge-pathnames "~/") => c:C:\Users\user.

10 years agoEliminate "unused variable" warning from ARRAY-ROW-MAJOR-INDEX
Douglas Katzman [Fri, 8 Nov 2013 21:08:46 +0000 (16:08 -0500)]
Eliminate "unused variable" warning from ARRAY-ROW-MAJOR-INDEX

10 years agoDon't warn when #'(setf fun) is used in the presence of a setf-macro.
Stas Boukarev [Fri, 8 Nov 2013 20:26:44 +0000 (00:26 +0400)]
Don't warn when #'(setf fun) is used in the presence of a setf-macro.

Warn only when defining such a function, not when using it.

Reported by Douglas Katzman.

10 years agoOptimize testing of sealed structures.
Stas Boukarev [Thu, 7 Nov 2013 22:47:41 +0000 (02:47 +0400)]
Optimize testing of sealed structures.

Don't check for the layout validity, redefining structures is
undefined, and the non-sealed case doesn't check for it already.

10 years agoOptimize RESTART-BIND.
Stas Boukarev [Thu, 7 Nov 2013 22:45:12 +0000 (02:45 +0400)]
Optimize RESTART-BIND.

Change MAKE-RESTART lambda-list to
(name function
 &optional report-function interactive-function test-function)
instead of using the default structure constructor with keywords.
MAKE-RESTART is only used in RESTART-BIND, and this allows for more
compact calls and not having to parse keyword parameters should
make the code slightly faster.

10 years agoOptimize RESTART-CASE.
Stas Boukarev [Thu, 7 Nov 2013 22:26:47 +0000 (02:26 +0400)]
Optimize RESTART-CASE.

Optimize a case when restart handlers have zero or one arguments:
instead of saving a &rest list and then applying a function, don't
save anything, or save one argument and use FUNCALL.

Based on a patch by Jan Moringen.

Closes lp#1249055.

10 years agosbcl-pwd.sh: Fix when $OSTYPE is not set.
Stas Boukarev [Thu, 7 Nov 2013 20:02:16 +0000 (00:02 +0400)]
sbcl-pwd.sh: Fix when $OSTYPE is not set.

10 years agoFix equality between #p"~" and (user-homedir-pathname) on Win32.
Stas Boukarev [Wed, 6 Nov 2013 18:39:31 +0000 (22:39 +0400)]
Fix equality between #p"~" and (user-homedir-pathname) on Win32.

Don't use user-homedir-namestring on the windows version of
native-namestring, since the home directory can be specified as
C:/User/user, use (native-namestring (user-homedir-pathname)), which
will get C:\\User\\user\\ instead, making (native-namestring "~/") and
(native-namestring (user-homedir-pathname)) equal.

10 years agoDisable win32 pathnames routines on -win32 and vice versa.
Stas Boukarev [Wed, 6 Nov 2013 17:20:21 +0000 (21:20 +0400)]
Disable win32 pathnames routines on -win32 and vice versa.

#-win32 has all the win32 pathname code enabled, but it's not used
anywhere and not exported. Even if using pathnames of a different OS
may be a good idea, it's currently not presented in any usable way and
only wastes space.

10 years agoFix contrib building on mingw.
Stas Boukarev [Wed, 6 Nov 2013 17:11:53 +0000 (21:11 +0400)]
Fix contrib building on mingw.

The current directory has to be found out using pwd -W, to avoid any
conversion into unix-looking pathnames.

10 years agoRemove get2 variant of get.
Stas Boukarev [Wed, 6 Nov 2013 00:46:26 +0000 (04:46 +0400)]
Remove get2 variant of get.

(get x y [z]) was expand into (get3 x y z) or (get2 x y), and get2
called (get3 x y nil), just expand into (get3 x y nil) directly.

10 years agoOptimize raw-instance-slots-equalp for #-complex-float-vops.
Stas Boukarev [Tue, 5 Nov 2013 15:56:00 +0000 (19:56 +0400)]
Optimize raw-instance-slots-equalp for #-complex-float-vops.

The comparer function for COMPLEX types wasn't properly optimized
during cross-compilation because the types of REALPART and IMAGPART
weren't derived by the cross-compiler on account of
CROSS-FLOAT-INFINITY-KLUDGE, but the derivers do not actually perform
any mathematical derivation, just
(complex (double-float 10d0)) => (double-float 10d0).
Enabling them during cross-compilation allows = on complex floats be
optimized and avoids consing.

10 years agoFix lose() invocation inside sparc-arch.c
Stas Boukarev [Tue, 5 Nov 2013 13:48:03 +0000 (17:48 +0400)]
Fix lose() invocation inside sparc-arch.c

10 years agoOptimize EQUALP on structures with raw slots.
Stas Boukarev [Mon, 4 Nov 2013 22:52:37 +0000 (02:52 +0400)]
Optimize EQUALP on structures with raw slots.

Add a comparer slot to raw-slot-data, which is defined as
(lambda (index x y)
  (= (%raw-instance-ref/double x index)
     (%raw-instance-ref/double y index)))

Which is both faster than calling %raw-instance-ref/double out of
line and does not cons.

10 years ago[N]BUTLAST perform a single pass over the list
Paul Khuong [Mon, 4 Nov 2013 18:55:10 +0000 (13:55 -0500)]
[N]BUTLAST perform a single pass over the list

The old code would first count the number of conses, and then
SUBSEQ/(RPLACD/NTHCDR).  Instead traverse the list with two offset
pointers that advance in lockstep.

Based on a patch by Johan Andersson, on lp#1245697.

10 years agoMore complicated TYPEP tests are marginally transparent to type propagation
Paul Khuong [Thu, 24 Oct 2013 02:36:17 +0000 (22:36 -0400)]
More complicated TYPEP tests are marginally transparent to type propagation

Expansions for TYPEP are wrapped in %typep-wrapper, a fancy identity. The
additional arguments track what value is being tested for what type, which
helps inform constraint propagation, as well as detecting redundant type
tests.

Such a wrapper is a hindrance to lower level control flow rewriting that are
essential for decent code generation. After a single pass of constraint
propagation, the wrapper evaporates and the TYPEP expansion becomes as opaque
as it is now.

10 years agoTwo new optimizer types for flow-sensitive type propagation
Paul Khuong [Thu, 24 Oct 2013 02:34:37 +0000 (22:34 -0400)]
Two new optimizer types for flow-sensitive type propagation

CONSTRAINT-PROPAGATE optimizers can add new information about the
state of the world after/if the function has returned.  Function
type declarations/propagation suffice for simple patterns (e.g.
return types, or unconditional type requirements on arguments),
but this optimizer is more general.

Such optimizers receive two arguments, the combination node and the
current set of constraints, and return a sequence of constraints.
Constraints are lists of three or four values:
 1. a constraint kind (either TYPEP, <, >, or EQL);
 2, 3. two arguments, either LVARs, LAMBDA-VARs or a CTYPE;
 4. optionally, whether the meaning of the constraint must be
    flipped.
This mimics the (defstruct (constraint ...)) in constraint.lisp.
If any of the argument is NIL, the constraint is skipped; otherwise,
it is added to current set of constraints.  Optimizers have access
to that set, and can thus map LVARs to LAMBDA-VARs thanks to
OK-LVAR-LAMBDA-VAR.

CONSTRAINT-PROPAGATE-IF optimizers can instead hook into the
interpretation of functions as predicate, when their result feeds
into an IF node.  They also receive the node and the current set
of constraints as arguments, and return four values.  The first two
values are an LVAR and a CTYPE: if they are non-NIL, that LVAR is
of that CTYPE iff the combination returns true.  The two remaining
values are sequences of constraints (see previous paragraph) for
the consequent (if-true) and alternative (if-false) branches,
respectively.  These are useful for more complex tests, but also
to represent partial information, e.g., if an EQUAL test fails,
the two values are not EQL either.

10 years agoFix foreign-stack-alignment test on SPARC.
Stas Boukarev [Mon, 4 Nov 2013 12:41:59 +0000 (16:41 +0400)]
Fix foreign-stack-alignment test on SPARC.

10 years agoFix raw-instance-slots-equalp on SPARC.
Stas Boukarev [Sun, 3 Nov 2013 21:18:01 +0000 (01:18 +0400)]
Fix raw-instance-slots-equalp on SPARC.

Some slots have to be aligned or they will cause a bus error. Take
alignment into account on #-(or x86 x86-64 ppc).

10 years agoFix EQUALP on structures with raw slots.
Stas Boukarev [Sun, 3 Nov 2013 19:32:09 +0000 (23:32 +0400)]
Fix EQUALP on structures with raw slots.

It always incremented the index by 1, even if slot takes up more than
one word. Increment by raw-slot-data-n-words.

10 years agofix LET* environment semantics in sexp-based evaluator
Christophe Rhodes [Sun, 3 Nov 2013 16:32:49 +0000 (16:32 +0000)]
fix LET* environment semantics in sexp-based evaluator

10 years agoFix undefined function error on SPARC.
Stas Boukarev [Sun, 3 Nov 2013 15:09:04 +0000 (19:09 +0400)]
Fix undefined function error on SPARC.

Adjust the register encoding in sparc-assem.S.

Thanks to John Long for providing access to a SPARC machine.

10 years agoFix run-tests.sh on Solaris.
Stas Boukarev [Sun, 3 Nov 2013 10:57:06 +0000 (14:57 +0400)]
Fix run-tests.sh on Solaris.

10 years agoAdjust the recent defmethod change.
Stas Boukarev [Sat, 2 Nov 2013 13:39:50 +0000 (17:39 +0400)]
Adjust the recent defmethod change.

(compile-or-load-defgeneric name) doesn't need the full eval-when
repertoire, only :compile-toplevel and :execute. :compile-toplevel for
subsequent forms and :execute for references within the body of
defmethod to itself. :load-toplevel is not needed since when the FASLs
are loaded no further processing is performed, this avoids the size
increase of the resulting FASLs.

10 years agoAdd --help to run-tests.sh.
Stas Boukarev [Fri, 1 Nov 2013 12:47:38 +0000 (16:47 +0400)]
Add --help to run-tests.sh.

10 years agotests: better reports when /bin/ed is not present.
Stas Boukarev [Fri, 1 Nov 2013 12:34:27 +0000 (16:34 +0400)]
tests: better reports when /bin/ed is not present.

When /bin/ed is not present the test failed with a confusing "unhandled
error".
* Wrap the whole run-program-ed test into with-test, renaming it to run-program-/bin/ed.
* Add before it a test named :is-/bin/ed-installed?.

Making the report more self-describing:
 Failure:            run-program.impure.lisp / IS-/BIN/ED-INSTALLED?
 Failure:            run-program.impure.lisp / RUN-PROGRAM-/BIN/ED

10 years agodefmethod: make the function known at compile time.
Stas Boukarev [Fri, 1 Nov 2013 11:50:55 +0000 (15:50 +0400)]
defmethod: make the function known at compile time.

(defmethod gf ())
(defun f () (gf))
Produced a warning about an undefined function, even though it would
be implicitly created by defmethod.
Fixes lp#503095.

10 years agoRemove *static-foreign-symbols* from #+sb-dynamic-core builds.
Stas Boukarev [Thu, 31 Oct 2013 18:57:24 +0000 (22:57 +0400)]
Remove *static-foreign-symbols* from #+sb-dynamic-core builds.

10 years agoFix defmethod arglists leaking into make-method-lambda.
Stas Boukarev [Thu, 31 Oct 2013 14:47:09 +0000 (18:47 +0400)]
Fix defmethod arglists leaking into make-method-lambda.

defmethod communicates to make-method-lambda using special variables,
but make-method-lambda then performs code-walking which expands
macros, and if a macro calls another make-method-lambda directly, this
make-method-lambda will receive incorrect information which may cause
problems with wrong lambda lists.
Reported and diagnosed by Attila Lendvai.

10 years agodescribe: show the same information about functions for 'x and #'x.
Stas Boukarev [Thu, 31 Oct 2013 14:44:55 +0000 (18:44 +0400)]
describe: show the same information about functions for 'x and #'x.

Declared type and information about inlining were not shown when used
as #'function.

10 years agoFix install/binary-distribution scripts for new contrib arrangements
Christophe Rhodes [Thu, 31 Oct 2013 14:44:00 +0000 (14:44 +0000)]
Fix install/binary-distribution scripts for new contrib arrangements

Everything has moved, which led the binary-distribution script not to
include test-passed files, and the install script to look for them in
the wrong place anyway.

10 years ago1.1.13: will be tagged as "sbcl-1.1.13"
Christophe Rhodes [Thu, 31 Oct 2013 10:42:43 +0000 (10:42 +0000)]
1.1.13: will be tagged as "sbcl-1.1.13"

10 years agoMake sure quantifiers don't cons
Paul Khuong [Sat, 26 Oct 2013 17:18:23 +0000 (13:18 -0400)]
Make sure quantifiers don't cons

Quantifiers like SOME and EVERY are implemented in terms of (MAP NIL)
of a wrapper function with early RETURN. If type information does not
enable MAP to be open coded, declarations are necessary to avoid
consing up a closure and a value cell for the return.

DX functions really shouldn't cause value cells for return blocks.

Also, revert d0f65b07a30adc989e36a82ddc0ed54d135d638e which is
now mostly redundant.