Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 17, 2012
  1. implement ATOMIC-UPDATE

      Nicer than having to write explicit CAS loops.
      Also improve COMPARE-AND-SWAP docstring, and remove the EXPERIMENTAL label
      from it.
Commits on May 2, 2012
  1. @sb-studio

    clock_nanosleep based SLEEP on Posix platforms

    sb-studio authored committed
      Looping around nanosleep() isn't a winning solution: we don't know if the
      remainder from nanosleep reflects the time spent in signal handler or not.
      Keep the nanosleep() based version around for Darwin and other
      non-conformant platforms: :OS-PROVIDES-CLOCK-NANOSLEEP tells us if we need
      to use it or not.
      Since neither clock_nanosleep nor nanosleep is guaranteed to be asynch
      signal safe, add a test-case that tries to hang them via nesting.  My theory
      is that in practise they both /are/ asynch signal safe...
      FIXME: Stress test fails!
  2. more deprecation

     * Add "Deprecated Interfaces" chapter to the manual.
     * Add list of deprecated interfaces along with a policy note to a comment
     * Add a proper deprecation warning for SB-C::MERGE-TAIL-CALLS.
     * Fix the deprecation warning for WITH-SPINLOCK. (Accidentally referred to
  3. sb-posix: abort(3), exit(3), and _exit(2)

      Also fix docstring of SB-EXT:EXIT, which referred to exit as being section 2.
Commits on May 1, 2012
  1. @stassats

    runtime clean up.

    stassats authored
    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
  2. @leuler

    Better equidistributed and faster/less consing integer RANDOM.

    leuler authored
    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
    I took some inspiration from WHN's attempt at an accept-reject loop
    implementation in commit 0a7604d and
    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.
  3. @leuler

    Add some tests for basic RANDOM functionality.

    leuler authored
    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.
  4. @leuler

    Fix the DEFTRANSFORM of RANDOM for hairy integer types.

    leuler authored
    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.
  5. add SB-UNIX:UNIX-EXIT back, use the deprecation framwork for it and S…

      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.
Commits on Apr 29, 2012
  1. 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
     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
      * 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
  2. @sb-studio

    tune bug-981106 test based on the heap size

    sb-studio authored
      Fixes lp#983807.
  3. @sb-studio

    gencgc: scale generation.bytes_consed_between_gc to number of gens

    sb-studio authored
      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
Commits on Apr 27, 2012
  1. @stassats
  2. @sb-studio

    gencgc: i in add_new_area needs to be signed

    sb-studio authored
      Regression from 7be8d14,
      broke on x86 builds.
      Fixes lp#989958.
  3. @sb-studio

    fix compiler reader error reporting

    sb-studio authored
      Stream slot was left unbound along one leg, which is bad because
      READER-ERROR is a subtype of STREAM-ERROR.
Commits on Apr 25, 2012
  1. @leuler

    Micro-optimizations in MOVE-IMMEDIATE and MOVE-ARG on x86-64

    leuler authored
    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.
Commits on Apr 24, 2012
  1. @stassats

    Better arglists for some package accessors.

    stassats authored
    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
  2. 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.
  3. @sb-studio

    globaldb: remove ENV-LIST arguments from INFO functions

    sb-studio authored committed
      Unused except by %DEFKNOWN, which passed in *INFO-ENVIRONMENT* anyways.
  4. 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.
  5. move ABOUT-TO-MODIFY-SYMBOL-VALUE to symbol.lisp

      Doesn't really belong in early-extensions.lisp.
  6. better reader-errors for COMPILE-FILE

     * Make reader signal a SIMPLE-READER-PACKAGE-ERROR for missing packages,
       instead of a vanilla PACKAGE-ERROR: that way get the position reported as
     * Factor out line and column reporting logic for reader-errors into a
       separate function, and allow using other than current file position.
       INPUT-ERROR-IN-COMPILE-FILE is a subclass of READER-ERROR, not a
     * *COMPILER-ERROR-BAILOUT* binding in SUB-COMPILE-FILE was missing the
       condition argument from the lambda-list, and should not mumble to
     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
Commits on Apr 23, 2012
  1. @leuler

    Allow larger immediate values in fixnum arithmetic on x86-64.

    leuler authored
    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
    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.
  2. @csrhodes

    Fix ldb / %%ldb / rlwinm on PowerPC

    csrhodes authored
    Thanks to Bruce O'Neel for confirming the validity of the fix.
Commits on Apr 20, 2012
  1. @leuler

    Typo fixes in comments

    leuler authored
  2. @leuler

    Fix typos in docstrings.

    leuler authored
    LP #958931, thanks to Juanma Barranquero.
  3. 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.)
Commits on Apr 19, 2012
  1. 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.
  2. sanitize one of the recent c-string decoding tests

      No out-of-bounds accesses, thanks!
      ...and thanks to Nathan who spotted my bogosity.
  3. 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 ...>"
  4. wrap a couple of long lines

  5. associate stream decoding and encoding errors with their restarts

      ERROR call needs to appear inline for that to happen without
      extra acrobatics.
  6. 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
Commits on Apr 17, 2012
  1. @leuler

    Micro-optimize machine code for some register tests on x86[-64].

    leuler authored
    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.
  2. @leuler

    Micro-optimization: Shorter encoding of MOVZX in more cases on x86-64

    leuler authored
    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.
Something went wrong with that request. Please try again.