sbcl.git
11 years agofix constant-list-related initargs in CTOR optimization
Christophe Rhodes [Wed, 16 Jan 2013 13:51:19 +0000 (13:51 +0000)]
fix constant-list-related initargs in CTOR optimization

lp#1099708, reported by Derek Baldwin; also test for _3b's #sbcl irc insight
that this would break non-EQLity of distinct but EQUAL list constants

Also deal with pathnames, bit-vectors and strings, which are precisely the
types EQUAL descends into.

(The general problem of function names being looked up using EQUAL remains
a problem, though with fewer observable consequences: for example, methods
with EQUAL eql-specializers will have their function names collide with
each other, though since in CLOS the functions are looked up through the
method objects this is less serious than with CTORs.

11 years agoformat: ~R should check a type only if base is not supplied.
Stas Boukarev [Fri, 11 Jan 2013 03:38:13 +0000 (07:38 +0400)]
format: ~R should check a type only if base is not supplied.

(format t "~2r" 1/2) is valid.

11 years agoformat: Check types for ~C and ~R.
Stas Boukarev [Thu, 10 Jan 2013 20:26:32 +0000 (00:26 +0400)]
format: Check types for ~C and ~R.

Both require arguments to be characters and integers respectively.

11 years agosb-sprof.lisp: Remove trailing white-spaces.
Stas Boukarev [Sat, 5 Jan 2013 17:09:52 +0000 (21:09 +0400)]
sb-sprof.lisp: Remove trailing white-spaces.

11 years agoadjust-array: Make sure that :initial-element is used.
Stas Boukarev [Sat, 5 Jan 2013 15:43:05 +0000 (19:43 +0400)]
adjust-array: Make sure that :initial-element is used.

Adjust-array ignored :initial-element for arrays of type T.

Fixes lp#1096359.

11 years agosb-sprof: Define pthread-kill only on +sb-thread.
Stas Boukarev [Fri, 4 Jan 2013 12:59:01 +0000 (16:59 +0400)]
sb-sprof: Define pthread-kill only on +sb-thread.

pthread_kill alien is not present on -sb-thread, because libpthread is
not loaded, and it results in unnecessary style warnings.

11 years agoFix reading `#3(x).
Stas Boukarev [Fri, 4 Jan 2013 12:46:43 +0000 (16:46 +0400)]
Fix reading `#3(x).

Previously it returned #(x), while it should be #(x x x).

Fixes lp#1095918.

11 years agoDo not traverse long constant lists when expanding DOLIST
Paul Khuong [Thu, 3 Jan 2013 15:31:09 +0000 (10:31 -0500)]
Do not traverse long constant lists when expanding DOLIST

* Only gather type information on the list contents' if it's short
  (at most 20 elements); otherwise, do not derive type information.

* Thanks to Douglas Katzman for the bug report (lp#1095488).

11 years ago1.1.3: will be tagged as "sbcl-1.1.3"
Christophe Rhodes [Mon, 31 Dec 2012 21:29:02 +0000 (21:29 +0000)]
1.1.3: will be tagged as "sbcl-1.1.3"

11 years agoFix attach_thread to allocate a TLS index for *gc-inhibit* if needed
David Lichteblau [Wed, 26 Dec 2012 14:39:34 +0000 (15:39 +0100)]
Fix attach_thread to allocate a TLS index for *gc-inhibit* if needed

Instead of occasionally setting a global value for this variable...

Thanks to Stas Boukarev for the bug report.

11 years agoUpdate NEWS
David Lichteblau [Fri, 21 Dec 2012 20:29:23 +0000 (21:29 +0100)]
Update NEWS

11 years agoPreserve superclass structure accessors in infodb
David Lichteblau [Mon, 17 Dec 2012 17:33:43 +0000 (18:33 +0100)]
Preserve superclass structure accessors in infodb

Do not overwrite inherited structure accessor entries in infodb when
a sub-structure-class gets defined with same conc-name.

Fixes CAS access to slots of direct superclass instances in this
case (and in particular, non-futex safepoint builds).

11 years agoSet a console Ctrl handler for Windows
David Lichteblau [Mon, 10 Dec 2012 12:56:17 +0000 (13:56 +0100)]
Set a console Ctrl handler for Windows

Install a Lisp callback using SetConsoleCtrlHandler, allowing users
to interrupt SBCL using C-c in the Windows console.

We cannot currently control the size of the stack available to us in
this handler, but since we are mainly only calling INTERRUPT-THREAD,
even a small stack might be sufficient for our purposes.

Thanks to Anton Kovalenko.

11 years agoAdd STDCALL alien convention support for Windows
David Lichteblau [Fri, 9 Nov 2012 13:54:19 +0000 (14:54 +0100)]
Add STDCALL alien convention support for Windows

Thanks to Anton Kovalenko.

11 years agoSupport building without PSEUDO-ATOMIC on POSIX safepoints
David Lichteblau [Wed, 5 Dec 2012 18:08:23 +0000 (19:08 +0100)]
Support building without PSEUDO-ATOMIC on POSIX safepoints

  - Mark Lisp signal handlers with a flag `synchronous' to indicate
    whether we can (and must) handle them immediately.  Conversely,
    we understand this flag to imply a guarantee that the signal
    does not occur during allocation.

  - Any signal with a Lisp handler that is not synchronous is
    implemented in the runtime using a trampoline, which (instead of
    invoking Lisp code directly) first spawns a new pthread, which
    only then calls back into Lisp to invoke the handler function
    (with a fake signal context).

  - Used in particular for SIGINT.

  - For SIGPROF, introduce a second per-thread allocation region,
    which gets swapped with the usual region around the call into
    SIGPROF-HANDLER.  This handler is a special case, because it is
    careful not to trigger GC nor non-local unwinds, and we can
    safely return to the original region afterwards.

  - Add a new subclass SIGNAL-HANDLER-THREAD for this purpose,
    making it easy to identify these threads (e.g. in the test
    driver).

  - Run sprof tests while building the contrib.  Add a test stressing
    time profiling of allocation sequences.

Enable using :SB-SAFEPOINT-STRICTLY on features.

Quite usable already on x86 and x86-64; PPC still has more prominent
issues, e.g. in threads.impure.lisp.

11 years agoForeign callbacks
David Lichteblau [Wed, 12 Dec 2012 13:30:52 +0000 (14:30 +0100)]
Foreign callbacks

Allow alien callbacks to be invoked in pthreads created outside of
the Lisp runtime:

Add new runtime functions attach_os_thread, detach_os_thread
allowing such threads to acquire a `struct thread' temporarily,
turning them into Lisp threads.

In a main deviation from the Windows branch (which has a similar
feature), this mechanism does not involve user-land thread (fiber)
mechanisms to switch between stacks.  Instead, Lisp code merely runs
on the existing pthread's stack.

Currently a safepoint-only feature, because only safepoint-based
builds already go through a convenient trampoline function for
callbacks, but a backport of this feature to non-safepoint builds
might be straightforward.

11 years agoRe-complicate all_threads check in arch_os_get_current_thread
David Lichteblau [Fri, 21 Dec 2012 19:27:33 +0000 (20:27 +0100)]
Re-complicate all_threads check in arch_os_get_current_thread

This check used to be x86-only, and apparently for good reason.
Make it so again.

11 years agoadjust DATA-VECTOR-FROM-INITS to avoid full calls to MAKE-ARRAY when possible
Nathan Froyd [Thu, 20 Dec 2012 04:31:23 +0000 (23:31 -0500)]
adjust DATA-VECTOR-FROM-INITS to avoid full calls to MAKE-ARRAY when possible

We don't need to do full calls to MAKE-ARRAY in certain cases for
ADJUST-ARRAY now, which avoids calls to SUBTYPEP and friends.  This
change significantly speeds up ADJUST-ARRAY for common cases, like the
calls made by VECTOR-PUSH-EXTEND.

11 years agofactor out ALLOCATE-VECTOR-WITH-WIDETAG function from MAKE-ARRAY
Nathan Froyd [Thu, 20 Dec 2012 04:27:32 +0000 (23:27 -0500)]
factor out ALLOCATE-VECTOR-WITH-WIDETAG function from MAKE-ARRAY

11 years agoadjust call to REPLACE inside ADJUST-ARRAY
Nathan Froyd [Thu, 20 Dec 2012 04:16:01 +0000 (23:16 -0500)]
adjust call to REPLACE inside ADJUST-ARRAY

The more information we can provide, the better.

11 years agodon't check SUBTYPEP of ELEMENT-TYPE in ADJUST-ARRAY unnecessarily
Nathan Froyd [Thu, 20 Dec 2012 04:13:47 +0000 (23:13 -0500)]
don't check SUBTYPEP of ELEMENT-TYPE in ADJUST-ARRAY unnecessarily

11 years agolazily compute MIN-EXTENSION for VECTOR-PUSH-EXTEND
Nathan Froyd [Thu, 20 Dec 2012 04:10:42 +0000 (23:10 -0500)]
lazily compute MIN-EXTENSION for VECTOR-PUSH-EXTEND

This change avoids a full call to LENGTH on every call to VECTOR-PUSH-EXTEND.

11 years agoFix a typo in the previous commit.
Stas Boukarev [Tue, 18 Dec 2012 17:51:09 +0000 (21:51 +0400)]
Fix a typo in the previous commit.

-1 should be ~S.

11 years agoBetter error message for SLEEP.
Stas Boukarev [Tue, 18 Dec 2012 17:38:24 +0000 (21:38 +0400)]
Better error message for SLEEP.

Add explicit-check to defknown, sleep already explicitly checks the
argument.
Slightly improve the produced error message.

11 years agomake.sh --help no longer runs clean.sh
Stas Boukarev [Tue, 18 Dec 2012 15:04:15 +0000 (19:04 +0400)]
make.sh --help no longer runs clean.sh

Fixes lp#937001

11 years agosb-rotate-byte: Don't use :if-component-dep-fails.
Stas Boukarev [Mon, 17 Dec 2012 19:07:22 +0000 (23:07 +0400)]
sb-rotate-byte: Don't use :if-component-dep-fails.

Newer ASDF doesn't support it anymore.

11 years agoIn x86 arch_os_get_current_thread(), do not load from %fs
David Lichteblau [Wed, 12 Dec 2012 13:12:50 +0000 (14:12 +0100)]
In x86 arch_os_get_current_thread(), do not load from %fs

Simplify arch_os_get_current_thread() such that %fs is not being
loaded directly even on platforms which preserve it reliably (in
particular, Linux/x86 and Solaris/x86).

Aside from a code simplification and reduction of cross-platform
differences, this change is an improvement in the following way:

If arch_os_get_current_thread() gets called in a non-Lisp pthread,
it now returns NULL cleanly even on the platforms mentioned above.

On the other platforms, keep the support for restoring %fs, but
refactor to remove code duplication with arch_os_thread_init().
Coalesce the two differently-spelled Lisp features for this case
into one.

11 years agoSplit up new_thread_trampoline
David Lichteblau [Wed, 5 Dec 2012 17:36:10 +0000 (18:36 +0100)]
Split up new_thread_trampoline

Refactor it into two independent pieces for initialization and
deinitialization around the point of its central funcall.

11 years agoFactor INITIAL-THREAD-FUNCTION out of MAKE-THREAD
David Lichteblau [Wed, 5 Dec 2012 17:05:06 +0000 (18:05 +0100)]
Factor INITIAL-THREAD-FUNCTION out of MAKE-THREAD

11 years agoFix a typo.
Stas Boukarev [Mon, 17 Dec 2012 13:35:05 +0000 (17:35 +0400)]
Fix a typo.

In the previous commit, varaibles -> variables.

Adjust NEWS by adding lp#n.

11 years agoWarn about misconfigured locale.
Stas Boukarev [Sun, 16 Dec 2012 17:10:08 +0000 (21:10 +0400)]
Warn about misconfigured locale.

Check the return value of setlocale(3) and inform about values of
relevant environment variables.
Fixes lp#727625

11 years agoRemove a few :FAILS-ON test flags for Windows
David Lichteblau [Mon, 26 Nov 2012 15:30:35 +0000 (16:30 +0100)]
Remove a few :FAILS-ON test flags for Windows

11 years agoSupport long file names on Windows; more CRT function avoidance
David Lichteblau [Mon, 26 Nov 2012 13:53:17 +0000 (14:53 +0100)]
Support long file names on Windows; more CRT function avoidance

  - Use native namestrings of the form \\?\ and \\?\UNC\ as required.

  - UNC pathnames now represented using the keyword :UNC in the device.
    This aspect of the implementation is user-visible, but considered
    subject to change.

  - Update a few final holdouts among the file system routines which
    were still using CRT functions and replace them with native versions:
    FILE-LENGTH, QUERY-FILE-SYSTEM, DELETE-FILE, DELETE-DIRECTORY.

  - Sneakily include a getenv change, technically unrelated.

Thanks to Anton Kovalenko.

11 years agoMore Windows Installer tweaks
David Lichteblau [Mon, 26 Nov 2012 16:38:34 +0000 (17:38 +0100)]
More Windows Installer tweaks

  - look for version 3.7 or 3.5 automatically

  - make the "start menu" shortcut optional

  - suppress "test-output" directory

11 years agoUpgrade to Windows Installer XML 3.5
David Lichteblau [Mon, 26 Nov 2012 15:34:07 +0000 (16:34 +0100)]
Upgrade to Windows Installer XML 3.5

Includes miscellaneous installer improvements from the Windows branch.

Thanks to Dmitry Kalyanov and Anton Kovalenko.

11 years agosb-bsd-sockets: Implement NON-BLOCKING-MODE on Windows
David Lichteblau [Fri, 23 Nov 2012 17:15:31 +0000 (18:15 +0100)]
sb-bsd-sockets: Implement NON-BLOCKING-MODE on Windows

Thanks to Anton Kovalenko.

11 years agowin32 pathname host: Switch to :lower canonical case
David Lichteblau [Fri, 23 Nov 2012 17:10:13 +0000 (18:10 +0100)]
win32 pathname host: Switch to :lower canonical case

11 years agoSome support for platforms whose libraries do not maintain a frame pointer
David Lichteblau [Mon, 12 Nov 2012 19:13:09 +0000 (20:13 +0100)]
Some support for platforms whose libraries do not maintain a frame pointer

For platforms on which system libraries are built with the
equivalent of -fomit-frame-pointer, i.e. do not maintain EBP, save
it in the thread structure upon entry to an exception handler, and
restore the register during call_into_lisp.

Currently for Windows on x86-64 only, where it is required.
Analogous changes had been implemented for x86, but are not included
here.

Thanks to Anton Kovalenko.

11 years agoUpdate tests for 64 bit Windows builds
David Lichteblau [Mon, 19 Nov 2012 13:49:27 +0000 (14:49 +0100)]
Update tests for 64 bit Windows builds

11 years agoPort to x86-64 versions of Windows
David Lichteblau [Mon, 12 Nov 2012 16:32:51 +0000 (17:32 +0100)]
Port to x86-64 versions of Windows

  - Microsoft x86-64 calling convention differences compared to the
    the System V ABI: Argument passing registers; shadow space.
  - Inform gcc that we are using the System V ABI for a few functions.
  - Define long, unsigned-long to be 32 bit.  This change just falls
    into place now, since incompatible code had been adjusted earlier.
  - Use VEH, not SEH.
  - No pseudo atomic needed around inline allocation, but tweak alloc().
  - Use the gencgc space alignment that also works on win32 x86.
  - Factor "function end breakpoint" handling out of the sigtrap handler.

Beware known bugs, manifested as hangs during threads.impure.lisp,
happening rather frequently with 64 bit builds and at least much
less frequently (or not at all) with 32 bit binaries on the same
version of Windows, tested on Server 2012.  (All credit for features
goes to Anton, all bugs are my fault.)

Thanks to Anton Kovalenko.

11 years agoSpill XMM registers in alloc_tramp
David Lichteblau [Fri, 9 Nov 2012 14:34:32 +0000 (15:34 +0100)]
Spill XMM registers in alloc_tramp

Thanks to Anton Kovalenko.

11 years agofix a bug in signed modular arithmetic
Christophe Rhodes [Tue, 4 Dec 2012 20:50:12 +0000 (20:50 +0000)]
fix a bug in signed modular arithmetic

Sadly not the ones that Eric gently reminds us of every month or so, but
a far more basic one.  If something is a (signed-byte x), its integer-length
will be at most (1- x).  Search appropriately for a signed arithmetic
variant.

11 years agofix direct execution of (shebanged) fasls
Christophe Rhodes [Tue, 4 Dec 2012 20:19:23 +0000 (20:19 +0000)]
fix direct execution of (shebanged) fasls

Broken since 4993cd5, when fasl-header-p stopped working on bivalent
streams.  Make it work on bivalent streams, as long as they're
seekable (i.e. don't sniff stdin for a fasl header; bad things happen).

11 years agoSuppress warnings about possible slot name conflicts with slots from SB-PCL.
Stas Boukarev [Sat, 1 Dec 2012 19:44:37 +0000 (23:44 +0400)]
Suppress warnings about possible slot name conflicts with slots from SB-PCL.

When inheriting from STANDARD-CLASS and using common slot names, like
SLOTS or NAME, SBCL signals a style-warning about possible package
problems with slots with the same name from SB-PCL, which is unlikely
to ever cause a problem.

11 years agoupdate release.sh to my version of reality
Christophe Rhodes [Sat, 1 Dec 2012 14:32:25 +0000 (14:32 +0000)]
update release.sh to my version of reality

Mostly removing features and writing FIXMEs about what isn't yet
working for me.

11 years ago1.1.2: will be tagged as "sbcl-1.1.2"
Christophe Rhodes [Sat, 1 Dec 2012 11:32:29 +0000 (11:32 +0000)]
1.1.2: will be tagged as "sbcl-1.1.2"

11 years agoLLP64: replace use of unsigned long with size_t in parse_size_arg
David Lichteblau [Mon, 12 Nov 2012 16:33:47 +0000 (17:33 +0100)]
LLP64: replace use of unsigned long with size_t in parse_size_arg

Thanks to Anton Kovalenko.

11 years agoAdd mswin.def
David Lichteblau [Fri, 23 Nov 2012 14:05:52 +0000 (15:05 +0100)]
Add mswin.def

Fixes the build on Windows.

11 years agoNEWS tweaks
David Lichteblau [Mon, 19 Nov 2012 19:25:57 +0000 (20:25 +0100)]
NEWS tweaks

11 years agoLLP64: change signed long to sword_t
David Lichteblau [Mon, 12 Nov 2012 17:19:47 +0000 (18:19 +0100)]
LLP64: change signed long to sword_t

Adjust uses of `long' in the C runtime for LLP64 platforms:
Replace `long' with `sword_t' where applicable.

Thanks to Anton Kovalenko.

11 years agoLLP64: change UNSIGNED-LONG to UNSIGNED
David Lichteblau [Fri, 9 Nov 2012 13:25:42 +0000 (14:25 +0100)]
LLP64: change UNSIGNED-LONG to UNSIGNED

Adjust references to alien types within Lisp code for LLP64 platforms,
replacing UNSIGNED-LONG with UNSIGNED.

UNSIGNED-LONG is currently used when pointer-size values are desirable,
but does not have that meaning on LLP64 platforms.

Note: UNSIGNED does not in general refer to C's `unsigned'; rather it
means (UNSIGNED N-WORD-BITS).  UNSIGNED-LONG actually means `unsigned
long'.  The implication is that

  32 <= sizeof(UNSIGNED-LONG) <= sizeof(UNSIGNED) <= 64

and not, as one might have expected, the other way around.  Existing
platforms were assuming these two types to be the same.

Thanks to Anton Kovalenko.

11 years agoLLP64: change unsigned long to uword_t
David Lichteblau [Mon, 12 Nov 2012 15:35:23 +0000 (16:35 +0100)]
LLP64: change unsigned long to uword_t

Adjust uses of `unsigned long' in the C runtime for LLP64 platforms:
Replace with `uword_t' where applicable.

Thanks to Anton Kovalenko.

11 years agoLLP64: replace uses of sizeof(long) where pointer size is meant
David Lichteblau [Mon, 12 Nov 2012 15:11:28 +0000 (16:11 +0100)]
LLP64: replace uses of sizeof(long) where pointer size is meant

Thanks to Anton Kovalenko.

11 years agoLLP64: adjust calls to printf-like functions with pointer arguments
David Lichteblau [Mon, 12 Nov 2012 15:19:58 +0000 (16:19 +0100)]
LLP64: adjust calls to printf-like functions with pointer arguments

For the benefit of LLP64 platforms, do not cast to long when printing a
pointer, and use %p instead of %lx.  If casting is required, cast to
a pointer-sized unsigned integer, not signed long.

Thanks to Anton Kovalenko.

11 years agoLLP64: change long to uword_t (thereby flipping signedness)
David Lichteblau [Mon, 12 Nov 2012 16:01:08 +0000 (17:01 +0100)]
LLP64: change long to uword_t (thereby flipping signedness)

Replace `long' with `uword_t' in the runtime where applicable.

In these cases, signed long could have been translated literally as
sword_t to support LLP64 platforms, but uword_t seems clearer.

Thanks to Anton Kovalenko.

11 years agoNew types uword_t, sword_t
David Lichteblau [Thu, 8 Nov 2012 16:04:03 +0000 (17:04 +0100)]
New types uword_t, sword_t

First commit in a series of changes for LLP64 platform support.

We have been using `(un)signed long' assuming that it is an integer
of the same size as a pointer.  On Windows x64 this assumption does
not hold, and `(un)signed long long' is required for the same
purpose.

Code will be updated to use our own types uword_t, sword_t instead,
which are defined to be synonyms of uintptr_t and intptr_t, respectively.

Note that uword_t is also synonymous with our older type
pointer_sized_uint_t, and technically (albeit not conceptually) the
same as lispobj.

Thanks to Anton Kovalenko.

11 years agoAdd a lock to io_end_interruptible, win32_maybe_interrupt_io
David Lichteblau [Mon, 19 Nov 2012 16:54:58 +0000 (17:54 +0100)]
Add a lock to io_end_interruptible, win32_maybe_interrupt_io

Fixes hangs in test :INTERRUPT-IO-UNNAMED-PIPE.

11 years agoUnbreak ppc builds with 4k *backend-page-bytes*
Joshua Elsasser [Sun, 18 Nov 2012 22:38:16 +0000 (14:38 -0800)]
Unbreak ppc builds with 4k *backend-page-bytes*

11 years agoOnly try frlock.1 test on #+sb-thread
Joshua Elsasser [Sun, 18 Nov 2012 21:27:17 +0000 (13:27 -0800)]
Only try frlock.1 test on #+sb-thread

11 years ago Update ASDF to 2.26.
Stas Boukarev [Wed, 14 Nov 2012 14:22:50 +0000 (18:22 +0400)]
 Update ASDF to 2.26.

11 years agoForcibly fail frlock.1 on Windows by means of a timeout
David Lichteblau [Tue, 13 Nov 2012 17:13:08 +0000 (18:13 +0100)]
Forcibly fail frlock.1 on Windows by means of a timeout

Presumably due to windows sb-thread bugs, this test often hangs on
Windows.  For now, establish a timeout, and mark the test as a known
failure on this platform.

11 years agoFurther work towards use of win32 file HANDLEs
David Lichteblau [Mon, 5 Nov 2012 13:36:31 +0000 (14:36 +0100)]
Further work towards use of win32 file HANDLEs

Expose the fact that we are working with file handles (not simulated
file descriptors), and directly store those handles in fd-streams.

Represent them as integers (not SAPs) to avoid needless
incompatibilities between POSIX and Windows builds.  However, adjust
types so as to remove fixnum assumptions.

Includes some further tweaks to file-related foreign definitions
(and run-program in particular), to remove remaining uses of CRT
when possible.

Does not add any `feature' to help user code distinguish between
this SBCL and versions prior to this change using read-time
conditionals, since the changes are, in principle, not considered
user-visible.  (We are now unconditionally running the equivalent of
what is marked #!+fds-are-windows-handles on the Windows branch.)

To avoid breaking any user code that might have learned to retrieve
handles from our streams previously, preserve "osf handle"
conversion functions as trivial identity definitions for a while.

Thanks to Anton Kovalenko.

11 years agoPowerPC safepoints
David Lichteblau [Mon, 1 Oct 2012 18:10:44 +0000 (20:10 +0200)]
PowerPC safepoints

"I saw it almost pass tests once.  Ship it."

Rough PowerPC port of sb-safepoint and related features.  Occasional
issues remain (see comment in test suite).

  - Sprinkle fake_foreign_function_call fairy dust over safepoint code.

  - Use the CSP page for synchronization, but not for its value.

  - No altstack, hence no tricks to escape from it.

  - Remove workarounds related to the SIGALRM handler; but keep
    SIGINT happy for now, with a somewhat less questionable check.

11 years agomips: Revert remaining badness from 0.9.1.45.
Alastair Bridgewater [Sat, 9 Jun 2012 15:50:49 +0000 (11:50 -0400)]
mips: Revert remaining badness from 0.9.1.45.

  * There were two pieces of badness in 0.9.1.45, both to do with
the call_into_lisp LRA handling, and each compensated for the other
to a limited extent.  One change (since reverted) was to decrease
the alignment requirement on positioning the LRA header, allowing
it to be placed on a non-doubleword boundary.  The second change
(being reverted here) was to change the LRA address calculation to
subtract the entry point offset from the address of the header
instead of adding OTHER_POINTER_LOWTAG.  If the header wound up on
a doubleword boundary (the correct alignment) then the LRA computed
would have LIST_POINTER_LOWTAG, leading to badness when doing a
backtrace.  In any event, typechecking the resulting LRA would
fail, and actually attempting to return to it would also fail.

  * Revert to computing the LRA by adding OTHER_POINTER_LOWTAG to
the address of the header, bringing MIPS inline with all of the
other RETURN-PC-HEADER (LRA) using backends.

11 years agoruntime/thread.h: Fix non-thread binding and control stack pointer access.
Alastair Bridgewater [Thu, 8 Nov 2012 23:32:36 +0000 (18:32 -0500)]
runtime/thread.h: Fix non-thread binding and control stack pointer access.

  * In the non-threaded case, these macros used to break up into two
groups, one for x86oids and one for everything else.  This is wrong
just as soon as a non-x86oid port uses a static symbol for the binding
stack pointer.

  * Reorganize the non-threaded cases to parallel the structure of the
threaded case, dispatching on the presense of the static symbol for
binding stack access and specifically detecting non-x86oids for the
control frame pointer access.

11 years agoruntime/cheneygc.c: Use binding-stack-pointer access macro.
Alastair Bridgewater [Thu, 8 Nov 2012 23:32:29 +0000 (18:32 -0500)]
runtime/cheneygc.c: Use binding-stack-pointer access macro.

  * Rather than access current_binding_stack_pointer (a global
variable) directly, use access_binding_stack_pointer() (a macro
defined in thread.h).

11 years agoThou shalt not MAKE-OTHER-IMMEDIATE-TYPE.
Alastair Bridgewater [Tue, 23 Oct 2012 17:47:27 +0000 (13:47 -0400)]
Thou shalt not MAKE-OTHER-IMMEDIATE-TYPE.

  * Really, it's only ever used to make unbound-markers, for which
we have MAKE-UNBOUND-MARKER, which produces more optimal code in
the first place, has a shorter invocation, and reveals intention
far better than using MAKE-OTHER-IMMEDIATE-TYPE.

  * Rewrite all uses of MAKE-OTHER-IMMEDIATE-TYPE, excise the VOPs
from all of the backends, and remove the symbol name from package-
data.

  * And add DESCRIPTOR-REG to the permitted SCs for
MAKE-UNBOUND-MARKER, since it now must be legal to use a TN of
primitive-type T.

11 years agocompiler/generic/genesis: Report FDEFN addresses for undefined functions.
Alastair Bridgewater [Sun, 4 Nov 2012 17:43:27 +0000 (12:43 -0500)]
compiler/generic/genesis: Report FDEFN addresses for undefined functions.

  * In order to make debugging bootstrapping problems easier,
include the address of FDEFNs which have not been defined in the
cold-sbcl.map file.  This address is what shows up in ldb when
such an FDEFN is invoked.

11 years agocompiler/sparc/arith: Fix SCs for FAST-EQL{,-C}/FIXNUM.
Alastair Bridgewater [Thu, 8 Nov 2012 23:18:28 +0000 (18:18 -0500)]
compiler/sparc/arith: Fix SCs for FAST-EQL{,-C}/FIXNUM.

  * There's a KLUDGE in build-order.lisp-expr wherein failures
when building this file are ignored.

  * The failures are specifically an SC vs. arg-type mismatch for
the FAST-EQL/FIXNUM and FAST-EQL-C/FIXNUM VOPs.

  * Fix the mismatch by altering the VOP definitions to match what
the MIPS backend uses (since it doesn't have the failure).

  * And remove SPARC from the reader conditional on the KLUDGE.

11 years agoalien type improvement: handle offsets in unparse-alien-record-type
Cyrus Harmon [Mon, 15 Oct 2012 06:12:58 +0000 (23:12 -0700)]
alien type improvement: handle offsets in unparse-alien-record-type

Previously, when recomputing the offset to struct fields we would
ignore the offset and attempt to recompute it, occasionally getting it
wrong. Now store the offset in uparse-alien-record-field and use in
parse-alien-record-fields.

Also, fix some comment typos.

11 years agosb-concurrency: frlocks
Nikodemus Siivola [Mon, 8 Oct 2012 07:09:53 +0000 (10:09 +0300)]
sb-concurrency: frlocks

11 years agoSafepoint protocol upgrade
David Lichteblau [Wed, 31 Oct 2012 17:06:00 +0000 (18:06 +0100)]
Safepoint protocol upgrade

Upgrade to the new stop-the-world protocol from the Windows branch,
dating back to late 2011, an all-in-one readability and correctness
improvement.

Replace per-thread qrl locks with one process-wide lock for all
operations relating to GC state and the threads' CSP area.  Use
condition variables for notifications on GC state changes.

Thanks to Anton Kovalenko.

11 years agoUpdate NEWS; explain Windows system requirements
David Lichteblau [Tue, 30 Oct 2012 13:51:26 +0000 (14:51 +0100)]
Update NEWS; explain Windows system requirements

11 years agoExtend use of the linkage table to static symbols
David Lichteblau [Tue, 23 Oct 2012 19:55:02 +0000 (21:55 +0200)]
Extend use of the linkage table to static symbols

  - Formerly static symbols are static no more:

  - Always use the linkage table, even in cross compilation.  The
    runtime retrieves the resulting list of foreign symbols and installs
    linkage table entries before calling into Lisp for the first time.

  - Simplify/remove various win32 foreign symbol special cases.

  - Almost remove scratch().

Conditional on feature SB-DYNAMIC-CORE; required on Windows and optional
on other platforms supporting the linkage table.

With this feature, changes to src/runtime can be built using make,
without requiring a slam.sh step to update core files.

For LINKAGE-TABLE platforms only.  Currently supported on x86 and
x86-64.  (PowerPC does not yet work.)  In the interest of simplicity,
disable this feature permanently on non-SB-THREAD platforms, because
these would require unpleasant changes to allocation macros.

Thanks to Anton Kovalenko.

11 years agoMove the global safepoint to one page before static space
David Lichteblau [Mon, 29 Oct 2012 12:43:07 +0000 (13:43 +0100)]
Move the global safepoint to one page before static space

New attempt at finding an optimal location for the global safepoint
page.  Hopefully this solution will cover all our use cases for
the foreseeable future.

  - Relative to static space for architectures with small immediates.

  - Also addresses the requirements of sb-dynamic-core, which needs
    the safepoint to have an absolute address on x86(-64).

Hence, a new macro !gencgc-space-setup -- tweaks space parameters to
squeeze in the safepoint page, while also simplifying parms.lisp for
some platforms.

11 years agoWindows console I/O overhaul
David Lichteblau [Mon, 22 Oct 2012 15:04:38 +0000 (17:04 +0200)]
Windows console I/O overhaul

  - Make non-interruptible I/O interruptable by means of a
    background thread.

  - Fixes lp#308923.

  - Use Unicode in stdio streams.

Thanks to Anton Kovalenko.

11 years agoAllow synchronous win32 I/O to be interrupted, too
David Lichteblau [Fri, 5 Oct 2012 20:10:53 +0000 (22:10 +0200)]
Allow synchronous win32 I/O to be interrupted, too

... if and only if running on a version of Windows new enough to
support doing so.  Two scenarios come to mind where synchronous (i.e.
non-overlapped) I/O might matter:

  - There is one kind of HANDLE which is never overlapped: Unnamed
    pipes.  Unlike named pipes, the feature added by this commit is
    our only option of interrupting I/O on the former.

  - User code might pass in a HANDLE through MAKE-FD-STREAM without
    the right flag set.  In principle, non-interruptibily of such a
    HANDLE is a bug in said user code, but it doesn't hurt to deal
    with these correctly as a side benefit.  (The only Windows
    releases which support re-opening of a HANDLE with the right
    flag also have the functions needed by this commit.)

One downside for users might be an element of surprise, in that the
same SBCL binary will exhibit the presence or lack of features,
respectively, when started on recent Windows or old Windows.  However,
the advantages of offering the feature seem to me to outweigh that
disadvantage.

Thanks to Anton Kovalenko.

11 years ago1.1.1: will be tagged as "sbcl-1.1.1"
Christophe Rhodes [Fri, 2 Nov 2012 09:42:04 +0000 (09:42 +0000)]
1.1.1: will be tagged as "sbcl-1.1.1"

11 years agoFix the single-threaded Windows build
David Lichteblau [Fri, 26 Oct 2012 17:35:17 +0000 (19:35 +0200)]
Fix the single-threaded Windows build

For this release, we purport to support Windows without threads as
an option.  Make it so.

11 years agoDo not assert that the integer returned by UNIX-ISATTY is a BIT
David Lichteblau [Thu, 25 Oct 2012 12:49:08 +0000 (14:49 +0200)]
Do not assert that the integer returned by UNIX-ISATTY is a BIT

11 years agoFix build on MinGW (again)
David Lichteblau [Mon, 22 Oct 2012 14:20:15 +0000 (16:20 +0200)]
Fix build on MinGW (again)

Remove -mno-cygwin, re-added by mistake earlier.

11 years ago.gitignore: Add src/runtime/sparc-funcdef.h
nyef [Thu, 11 Oct 2012 19:55:56 +0000 (19:55 +0000)]
.gitignore: Add src/runtime/sparc-funcdef.h

  * Just another auto-generated file for a rarely-maintained
target.

11 years agoDisable an SB-INTROSPECT test on GENCGC SPARC.
nyef [Thu, 11 Oct 2012 18:28:13 +0000 (18:28 +0000)]
Disable an SB-INTROSPECT test on GENCGC SPARC.

  * Test ALLOCATION-INFORMATION.4 is known to be flaky at best on
GENCGC PPC, and has been observed to fail on GENCGC SPARC.  Since
it's been marked :FAILS-ON for GENCGC PPC, mark it as failing for
GENCGC SPARC as well.

11 years agoGENCGC on SPARC/Linux
nyef [Thu, 11 Oct 2012 18:18:59 +0000 (18:18 +0000)]
GENCGC on SPARC/Linux

  * Tweak make-config.sh to automatically select GENCGC, and to
update the fallback message for those poor bsd-using folks.

  * Copied the gencgc memory map from the SunOS version to use for
Linux (the cheneygc maps were identical, we may as well keep the
parallelism).

  * Also tweaked the linker flags to match.  Not because it was
required to build, but because I don't know why they were changed
for SunOS, and in the absence of such knowledge I'd rather keep
things more or less parallel.

11 years agosrc/runtime/sparc-arch.c: Use si_addr in arch_get_bad_addr().
nyef [Thu, 11 Oct 2012 18:13:02 +0000 (18:13 +0000)]
src/runtime/sparc-arch.c: Use si_addr in arch_get_bad_addr().

  * Since the sparc port was first merged, arch_get_bad_addr() has
only worked when the program counter is within read-only or the
current dynamic space.

  * This is fragile simply because of the existance of static
space and PURIFY.  It is WORSE when you add GENCGC to the mix (to
the point where SunOS with GENCGC doesn't even call
arch_get_bad_addr() anymore).

  * The existing implementation looks like it predates the switch
to sigaction(2) style signal handlers.  SBCL uses si_addr on all
other backends save Alpha (long undermaintained) and HPPA (even
longer undermaintained).  Clearly, this approach works on SunOS.
From testing, it works on at least linux-2.6.32.  We might as well
run with it, since we need it for GENCGC anyway, and we can easily
concoct a test case that would cause a failure using CHENEYGC.

  * So, implementation patterned on any of the other backends, but
leaving the old code in place, conditional-compiled out, as a bit
of a historical note / warning to future historians.

11 years agoUpdate NEWS, make-config.sh
David Lichteblau [Tue, 18 Sep 2012 15:11:40 +0000 (17:11 +0200)]
Update NEWS, make-config.sh

11 years agosb-bsd-sockets: Add a test for interruptible I/O
David Lichteblau [Mon, 24 Sep 2012 16:48:34 +0000 (18:48 +0200)]
sb-bsd-sockets: Add a test for interruptible I/O

Test TCP sockets even without :internet-available, albeit only on
threaded builds.  Check that INTERRUPT-THREAD works in a timely
fashion on threads currently blocked in I/O on a socket.

11 years agoWindows: Use overlapped I/O, CreateFile
David Lichteblau [Tue, 18 Sep 2012 15:12:19 +0000 (17:12 +0200)]
Windows: Use overlapped I/O, CreateFile

Overlapped I/O is win32's asynchronous I/O mechanism, which allows
us to start an I/O operation and explicitly wait for it to finish at
a time of our choosing, such that we can simultaneously await other
events instead of blocking unconditionally.

  - Support for overlapped I/O is a per-HANDLE flag specified at
    file opening time, necessitating a switch to win32's CreateFile
    and away from the CRT's _open.

  - Wrap win32 file operations in POSIX-compatible functions, so
    that UNIX-OPEN, UNIX-READ, UNIX-WRITE, UNIX-CLOSE continue to
    work as before.  Under the hood, these now call our Lisp or C
    functions instead of versions from CRT.

  - For now, these functions still return and expect what passes as
    file descriptors in CRT.

  - INTERRUPT-THREAD is now capable of performing the interruption
    in a target thread blocked in socket I/O, indicated using an
    errno of "EINTR".  Minor changes in FD streams to retry the I/O
    operation explicitly in that case.

Does not yet include changes for console I/O, and instead still
falls back to _read and _write in that case.  Also not yet included
is interruptible non-overlapped I/O, e.g. for unnamed pipes.

Thanks to Anton Kovalenko.

11 years agoImprove basic block ordering for some loops.
Lutz Euler [Wed, 17 Oct 2012 19:05:58 +0000 (21:05 +0200)]
Improve basic block ordering for some loops.

Currently the compiler rotates most loops to minimize branching costs,
but for some loops this actually has the opposite effect (i.e., larger
and slower code being generated), namely for those that already have the
termination test at the end.

So, inhibit loop rotation if such a loop is detected. The decision is
based upon whether the loop's back edge starts with a conditional branch
(don't rotate) or an unconditional branch (do rotate). This heuristic is
correct in simple cases but may err, e.g. if a loop has multiple back
edges. As we didn't try before and don't try now to analyse complex
loops to aid the decision whether to rotate or not, or even how far,
hopefully any differences introduced here will cancel on average with
respect to their impact on performance and code size.

(Loops consisting of only one basic block -- which necessarily have the
termination test at the end -- were (obviously) treated correctly
already. But even small loops can easily consist of multiple blocks, for
example if the loop body contains code from inlining a function call.)

11 years agoTypo and other small fixes in the manuals and the man page
Lutz Euler [Sat, 13 Oct 2012 19:11:43 +0000 (21:11 +0200)]
Typo and other small fixes in the manuals and the man page

That is, in the texinfo files of the user manual, the internals manual,
and in sbcl.1. Fix spelling and grammar errors, put sufficiently many
dots in abbreviations and consistently write "SBCL" in all caps in
prose. Also, SIGABORT should be SIGABRT.

11 years agoallow SB-CONTRIB operation without explicitly set CC
Nikodemus Siivola [Mon, 8 Oct 2012 05:49:41 +0000 (08:49 +0300)]
allow SB-CONTRIB operation without explicitly set CC

  Fall back to "cc" with a style-warning.

11 years agodon't close runtime dlhandle on Darwin
Nikodemus Siivola [Sun, 7 Oct 2012 12:20:21 +0000 (15:20 +0300)]
don't close runtime dlhandle on Darwin

  On newish Darwin it works, but some people still run old enough
  version that it won't work. As long as we're not explicitly checking
  for "Darwin new enough?", let's try not to break...

  Fixes lp#957385

11 years agomake it possible to run tests on an installed SBCL
Francois-Rene Rideau [Sat, 14 Apr 2012 16:09:46 +0000 (12:09 -0400)]
make it possible to run tests on an installed SBCL

 Allow override of SBCL location via TEST_SBCL_HOME,
 TEST_SBCL_RUNTIME, and TEST_SBCL_CORE.

 Allow override of temporary file location via TEST_DIRECTORY. (Some
 tests still write to /tmp, though -- so user beware!)

 Small unrelated whitespace / style-warning fixes.

11 years agoteach NODE-CONSERVATIVE-TYPE about union types
Nikodemus Siivola [Sun, 7 Oct 2012 11:12:59 +0000 (14:12 +0300)]
teach NODE-CONSERVATIVE-TYPE about union types

  Conservative type of STRING is STRING -- and this makes it so.

  Fixes lp#1050768 (but also future-proof ARRAY-IN-BOUNDS-P against
  '*) explicitly.

11 years agoKill a build warning about unreachable code in MAKE-SEQUENCE.
Lutz Euler [Sat, 6 Oct 2012 18:36:10 +0000 (20:36 +0200)]
Kill a build warning about unreachable code in MAKE-SEQUENCE.

Drop the T clause in a TYPECASE testing for ATOM, CONS and T as ATOM is
specified to be (NOT CONS) which the compiler well knows.

Break some overly long lines.

11 years agoFix some tests for builds without sb-eval.
Lutz Euler [Sat, 6 Oct 2012 16:56:19 +0000 (18:56 +0200)]
Fix some tests for builds without sb-eval.

Conditionalize on #+SB-EVAL test parts that bind *EVALUATOR-MODE* to
:INTERPRET. The affected tests are:
- compiler.pure.lisp / :multiple-args-to-function
- eval.impure.lisp / (eval :empty-let-is-not-toplevel)

11 years agountangle WITH-IR1-NAMESPACE and WITH-COMPILATION-VALUES
Nikodemus Siivola [Fri, 5 Oct 2012 05:26:47 +0000 (08:26 +0300)]
untangle WITH-IR1-NAMESPACE and WITH-COMPILATION-VALUES

 * Move the first out from the latter, and put parts of the first that
   belong in the latter there. They're sufficiently unrelated that
   it's just confusing. Also clarify why some stuff is in W-C-V and
   not W-IR1-N.

 * Places that need W-IR1-N: %COMPILE, COMPILE-LOAD-TIME-STUFF,
   CONVERT-AND-MAYBE-COMPILE. These are our topmost entry points into
   the convert & compile dance.

   ...and PROCESS-TOPLEVEL-LOCALLY, which needs to process
   declarations. We really should separate environment handling and
   compiler.

 * This also removes the unsightly (REMHASH NAME *FREE-FUNS*) hack
   from couple of places.

 * Move *SOURCE-PATHS* binding to WITH-SOURCE-PATHS (new), also
   sufficiently unrelated to be confusing.

 (This fixes the compiler.test.sh regression I managed to introduce.)

11 years agouse SB-EXT:EXIT in expect.sh instead of QUIT
Nikodemus Siivola [Thu, 4 Oct 2012 21:01:43 +0000 (00:01 +0300)]
use SB-EXT:EXIT in expect.sh instead of QUIT

11 years agofix PARSE-NATIVE-NAMESTRING :JUNK-ALLOWED T
Nikodemus Siivola [Thu, 4 Oct 2012 19:39:35 +0000 (22:39 +0300)]
fix PARSE-NATIVE-NAMESTRING :JUNK-ALLOWED T

 (and word-wrap NEWS)

11 years agofix GC-LOGFILE when none has been set
SANO Masatoshi [Wed, 3 Oct 2012 19:11:17 +0000 (22:11 +0300)]
fix GC-LOGFILE when none has been set

  ...and the return value from (SETF GC-LOGFILE).