<html lang="en"> <head> <title>History and Implementation of SBCL - SBCL 1.0.31 User Manual</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="SBCL 1.0.31 User Manual"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Introduction.html#Introduction" title="Introduction"> <link rel="prev" href="More-Common-Lisp-Information.html#More-Common-Lisp-Information" title="More Common Lisp Information"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual is part of the SBCL software system. See the `README' file for more information. This manual is largely derived from the manual for the CMUCL system, which was produced at Carnegie Mellon University and later released into the public domain. This manual is in the public domain and is provided with absolutely no warranty. See the `COPYING' and `CREDITS' files for more information. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="History-and-Implementation-of-SBCL"></a> <p> Previous: <a rel="previous" accesskey="p" href="More-Common-Lisp-Information.html#More-Common-Lisp-Information">More Common Lisp Information</a>, Up: <a rel="up" accesskey="u" href="Introduction.html#Introduction">Introduction</a> <hr> </div> <!-- node-name, next, previous, up --> <h3 class="section">2.7 History and Implementation of SBCL</h3> <p>You can work productively with SBCL without knowing or understanding anything about where it came from, how it is implemented, or how it extends the ANSI Common Lisp standard. However, a little knowledge can be helpful in order to understand error messages, to troubleshoot problems, to understand why some parts of the system are better debugged than others, and to anticipate which known bugs, known performance problems, and missing extensions are likely to be fixed, tuned, or added. <p>SBCL is descended from CMUCL, which is itself descended from Spice Lisp, including early implementations for the Mach operating system on the IBM RT, back in the 1980s. Some design decisions from that time are still reflected in the current implementation: <ul> <li>The system expects to be loaded into a fixed-at-compile-time location in virtual memory, and also expects the location of all of its heap storage to be specified at compile time. <li>The system overcommits memory, allocating large amounts of address space from the system (often more than the amount of virtual memory available) and then failing if ends up using too much of the allocated storage. <li>The system is implemented as a C program which is responsible for supplying low-level services and loading a Lisp <samp><span class="file">.core</span></samp> file. </ul> <p><a name="index-Garbage-Collection_002c-generational-2"></a>SBCL also inherited some newer architectural features from CMUCL. The most important is that on some architectures it has a generational garbage collector (“GC”), which has various implications (mostly good) for performance. These are discussed in another chapter, <a href="Efficiency.html#Efficiency">Efficiency</a>. <p>SBCL has diverged from CMUCL in that SBCL is now essentially a “compiler-only implementation” of Common Lisp. This is a change in implementation strategy, taking advantage of the freedom “any of these facilities might share the same execution strategy” guaranteed in the ANSI specification section 3.1 (“Evaluation”). It does not mean SBCL can't be used interactively, and in fact the change is largely invisible to the casual user, since SBCL still can and does execute code interactively by compiling it on the fly. (It is visible if you know how to look, like using <code>compiled-function-p</code>; and it is visible in the way that SBCL doesn't have many bugs which behave differently in interpreted code than in compiled code.) What it means is that in SBCL, the <code>eval</code> function only truly “interprets” a few easy kinds of forms, such as symbols which are <code>boundp</code>. More complicated forms are evaluated by calling <code>compile</code> and then calling <code>funcall</code> on the returned result. <p>The direct ancestor of SBCL is the x86 port of CMUCL. This port was in some ways the most cobbled-together of all the CMUCL ports, since a number of strange changes had to be made to support the register-poor x86 architecture. Some things (like tracing and debugging) do not work particularly well there. SBCL should be able to improve in these areas (and has already improved in some other areas), but it takes a while. <p><a name="index-Garbage-Collection_002c-conservative-3"></a>On the x86 SBCL – like the x86 port of CMUCL – uses a <em>conservative</em> GC. This means that it doesn't maintain a strict separation between tagged and untagged data, instead treating some untagged data (e.g. raw floating point numbers) as possibly-tagged data and so not collecting any Lisp objects that they point to. This has some negative consequences for average time efficiency (though possibly no worse than the negative consequences of trying to implement an exact GC on a processor architecture as register-poor as the X86) and also has potentially unlimited consequences for worst-case memory efficiency. In practice, conservative garbage collectors work reasonably well, not getting anywhere near the worst case. But they can occasionally cause odd patterns of memory usage. <p>The fork from CMUCL was based on a major rewrite of the system bootstrap process. CMUCL has for many years tolerated a very unusual “build” procedure which doesn't actually build the complete system from scratch, but instead progressively overwrites parts of a running system with new versions. This quasi-build procedure can cause various bizarre bootstrapping hangups, especially when a major change is made to the system. It also makes the connection between the current source code and the current executable more tenuous than in other software systems – it's easy to accidentally “build” a CMUCL system containing characteristics not reflected in the current version of the source code. <p>Other major changes since the fork from CMUCL include <ul> <li>SBCL has removed many CMUCL extensions, (e.g. IP networking, remote procedure call, Unix system interface, and X11 interface) from the core system. Most of these are available as contributed modules (distributed with sbcl) or third-party modules instead. <li>SBCL has deleted or deprecated some nonstandard features and code complexity which helped efficiency at the price of maintainability. For example, the SBCL compiler no longer implements memory pooling internally (and so is simpler and more maintainable, but generates more garbage and runs more slowly), and various block-compilation efficiency-increasing extensions to the language have been deleted or are no longer used in the implementation of SBCL itself. </ul> </body></html>