Remove --default-merge-core-pages.
[sbcl.git] / doc / sbcl.1
blob335747a463053ce82d6ca68dd4f9632ab4761c5b
1 .\" -*- Mode: Text -*-
2 .\"
3 .\" man page introduction to SBCL
4 .\"
5 .\" SBCL, including this man page, is derived from CMU Common Lisp, of
6 .\" which it was said (ca. 1991)
7 .\"   **********************************************************************
8 .\"   This code was written as part of the CMU Common Lisp project at
9 .\"   Carnegie Mellon University, and has been placed in the public domain.
10 .\"   If you want to use this code or any part of CMU Common Lisp, please
11 .\"   contact Scott Fahlman or slisp-group@cs.cmu.edu.
12 .\"   **********************************************************************
13 .\" Most of SBCL, including this man page, is in the public domain. See
14 .\" COPYING in the distribution for more information.
15 .\"
16 .TH SBCL 1 "$Date$"
17 .AT 3
18 .SH NAME
19 SBCL -- Steel Bank Common Lisp
21 .SH DESCRIPTION
23 SBCL is an implementation of ANSI Common Lisp, featuring a
24 high-performance native compiler, native threads on several platforms,
25 a socket interface, a source-level debugger, a statistical profiler,
26 and much more.
28 It is free software, mostly in the public domain, but with some
29 subsystems under BSD-style licenses which allow modification and reuse
30 as long as credit is given. It is provided "as is", with no warranty
31 of any kind.
33 For more information about license issues, see the COPYING file in
34 the distribution. For more information about history, see the 
35 CREDITS file in the distribution.
37 .SH RUNNING SBCL
39 To run SBCL, type "sbcl". After startup messages a prompt
40 ("\f(CR*\fR") appears. Enter a Lisp expression, and SBCL will read and
41 execute it, print any values returned, give you another prompt, and
42 wait for your next input.
44 \f(CR
45   $ sbcl
46   ...[startup messages elided]...
47   * (+ 1 2 3)
49   6
50   * (exit)
51 \fR
53 Most people like to run SBCL as a subprocess under Emacs. The Emacs
54 "Slime" mode provides many convenient features, like command line
55 editing, tab completion, and various kinds of coupling between Common
56 Lisp source files and the interactive SBCL subprocess.
58 For information on creating "standalone executables" using SBCL, see
59 \f(CRSB\-EXT:SAVE\-LISP\-AND\-DIE\fR in the User Manual.
61 .SH COMMAND LINE SYNTAX
63 For ordinary interactive use, no command line arguments should be
64 necessary.
66 In order to understand the SBCL command line syntax, it is helpful to
67 understand that the system is composed of two parts: a runtime
68 environment, and the Common Lisp system it supports. Some command line
69 arguments are processed during the initialization of the runtime, and
70 some during the initialization of the Lisp system -- any remaining
71 command line arguments are passed on to user code.
73 The overall command line syntax is:
74 .IP
75 .B sbcl [runtime options] \-\-end\-runtime\-options [toplevel options] \-\-end\-toplevel\-options [user options]
76 .PP
78 Both \-\-end\-runtime\-options and \-\-end\-toplevel\-options are
79 optional, and may be omitted. They are intended for use in situations
80 where any command line options are under user control (\fIe.g.\fR in batch
81 files): by using them you can prevent options intended for your
82 program being accidentally processed by SBCL.
84 Supported runtime options are
85 .TP 3
86 .B \-\-core <corefilename>
87 Use the specified Lisp core file instead of the default. (See the FILES
88 section for the standard core, or the system documentation for
89 \f(CRSB\-EXT:SAVE\-LISP\-AND\-DIE\fR for information about how to create a 
90 custom core.) Note that if the Lisp core file is a user-created core
91 file, it may run a nonstandard toplevel which does not recognize the
92 standard toplevel options.
93 .TP 3
94 .B \-\-dynamic-space-size <megabytes>
95 Size of the dynamic space reserved on startup in megabytes. Default value
96 is platform dependent.
97 .TP 3
98 .B \-\-control-stack-size <megabytes>
99 Size of control stack reserved for each thread in megabytes. Default value
100 is 2.
101 .TP 3
102 .B \-\-noinform
103 Suppress the printing of any banner or other informational message at
104 startup. (This makes it easier to write Lisp programs which work
105 cleanly in Unix pipelines. See also the "\-\-noprint" and
106 "\-\-disable\-debugger" options.)
107 .TP 3
108 .B \-\-disable\-ldb
109 Disable the low-level debugger. Only effective if SBCL is compiled with LDB.
110 .TP 3
111 .B \-\-lose\-on\-corruption
112 There are some dangerous low level errors (for instance, control stack
113 exhausted, memory fault) that (or whose handlers) can corrupt the
114 image. By default SBCL prints a warning, then tries to continue and
115 handle the error in Lisp, but this will not always work and SBCL may
116 malfunction or even hang. With this option, upon encountering such an
117 error SBCL will invoke ldb (if present and enabled) or else exit.
118 .TP 3
119 .B \-\-script <filename>
120 As a runtime option equivalent to \-\-noinform \-\-disable\-ldb
121 \-\-lose\-on\-corruption \-\-end\-runtime\-options \-\-script
122 <filename>. See the description of \-\-script as a toplevel option
123 below.
124 .TP 3
125 .B \-\-merge\-core\-pages
126 When platform support is present, provide hints to the operating
127 system that identical pages may be shared between processes until they
128 are written to. This can be useful to reduce the memory usage on
129 systems with multiple SBCL processes started from similar but
130 differently\-named core files, or from compressed cores. Without
131 platform support, do nothing. By default only compressed cores trigger
132 hinting.
133 .TP 3
134 .B \-\-no-merge\-core\-pages
135 Ensures that no sharing hint is provided to the operating system.
136 .TP 3
137 .B \-\-help
138 Print some basic information about SBCL, then exit.
139 .TP 3
140 .B \-\-version
141 Print SBCL's version information, then exit.
144 In the future, runtime options may be added to control behavior such
145 as lazy allocation of memory.
147 Runtime options, including any \-\-end\-runtime\-options option,
148 are stripped out of the command line before the
149 Lisp toplevel logic gets a chance to see it.
151 The toplevel options supported by the standard SBCL core are
152 .TP 3
153 .B \-\-sysinit <filename>
154 Load filename instead of the default system-wide initialization file.
155 (See the FILES section.)
156 .TP 3
157 .B \-\-no\-sysinit
158 Do not load a system-wide initialization file. If this option is
159 given, the \-\-sysinit option is ignored.
160 .TP 3
161 .B \-\-userinit <filename>
162 Load filename instead of the default user initialization file. (See
163 the FILES section.)
164 .TP 3
165 .B \-\-no\-userinit
166 Do not load a user initialization file. If this option is
167 given, the \-\-userinit option is ignored.
168 .TP 3
169 .B \-\-eval <command>
170 After executing any initialization file, but before starting the
171 read-eval-print loop on standard input, read and evaluate the command
172 given. More than one \-\-eval option can be used, and all will be read
173 and executed, in the order they appear on the command line.
174 .TP 3
175 .B \-\-load <filename>
176 This is equivalent to \-\-eval \(aq(load "<filename>")\(aq. The special
177 syntax is intended to reduce quoting headaches when invoking SBCL
178 from shell scripts.
179 .TP 3
180 .B \-\-noprint
181 When ordinarily the toplevel "read-eval-print loop" would be executed,
182 execute a "read-eval loop" instead, \fIi.e.\fR don't print a prompt and
183 don't echo results. Combined with the \-\-noinform runtime option, this
184 makes it easier to write Lisp "scripts" which work cleanly in Unix
185 pipelines.
186 .TP 3
187 .B \-\-disable\-debugger
188 By default when SBCL encounters an error, it enters the builtin
189 debugger, allowing interactive diagnosis and possible intercession.
190 This option disables the debugger, causing errors to print a backtrace
191 and exit with status 1 instead -- which is a mode of operation better suited
192 for batch processing. See the User Manual on \f(CRSB\-EXT:DISABLE\-DEBUGGER\fR for details.
193 .TP 3
194 .B \-\-quit
195 At the end of toplevel option processing, exit SBCL with a successful
196 code of zero.  Note that the effect of this option is delayed until after
197 toplevel options following this one.
198 .TP 3
199 .B \-\-non-interactive
200 This option disables the read-eval-print loop for both exceptional and
201 non-exceptional reasons.  It is short for --disable-debugger and --quit in
202 combination and is useful for batch uses where the special option processing
203 implied by --script is not desired.
204 .TP 3
205 .B \-\-script <filename>
206 Implies \-\-no-sysinit \-\-no-userinit \-\-disable-debugger
207 \-\-end\-toplevel\-options.
209 Causes the system to load the specified file and exit immediately
210 afterwards, instead of entering the read-eval-print loop. If the file
211 begins with a shebang line, it is ignored.
214 Regardless of the order in which toplevel options appear on the command
215 line, the order of actions is:
217 .nr step 1 1
218 .IP \n[step]. 3
219 Debugger is disabled, if requested.
220 .IP \n+[step].
221 Any system initialization file is loaded, unless prohibited.
222 .IP \n+[step].
223 Any user initialization file is loaded, unless prohibited.
224 .IP \n+[step].
225 \-\-eval and \-\-load options are processed in the order given.
228 Finally, either the read-eval-print loop is entered or the file
229 specified with \-\-script option is loaded.
231 When running in the read-eval-print loop the system exits on end of
232 file. Similarly, the system exits immediately after processing the
233 file specified with \-\-script.
235 Note that when running SBCL with the \-\-core option, using a core
236 file created by a user call to the
237 \f(CRSB\-EXT:SAVE\-LISP\-AND\-DIE\fR, the toplevel options may be
238 under the control of user code passed as arguments to
239 \f(CRSB\-EXT:SAVE\-LISP\-AND\-DIE\fR. For this purpose, the
240 \-\-end\-toplevel\-options option itself can be considered a toplevel
241 option, \fIi.e.\fR the user core, at its option, may not support it.
243 In the standard SBCL startup sequence (\fIi.e.\fR with no user core
244 involved) toplevel options and any \-\-end\-toplevel\-options option are
245 stripped out of the command line argument list before user code gets a
246 chance to see it.
248 .SH OVERVIEW
250 SBCL is derived from the CMU CL. (The name is intended to acknowledge
251 the connection: steel and banking are the industries where Carnegie
252 and Mellon made the big bucks.)
254 SBCL compiles by default: even functions entered in the
255 read-eval-print loop are compiled to native code, unless the evaluator
256 has been explicitly turned on. (Even today, some 40 years after the
257 MacLisp compiler, people will tell you that Lisp is an interpreted
258 language. Ignore them.)
260 SBCL aims for but has not completely achieved compliance with the ANSI
261 standard for Common Lisp. More information about this is available in
262 the BUGS section below.
264 SBCL also includes various non-ANSI extensions, described more fully
265 in the User Manual.  Some of these are in the base system and others
266 are "contrib" modules loaded on request using \f(CRREQUIRE\fR.  For
267 example, to load the \f(CRSB\-BSD\-SOCKETS\fR module that provides
268 TCP/IP connectivity,
269 \f(CR
270    * (require \(aqasdf)
271    * (require \(aqsb\-bsd\-sockets)
274 For more information, see the User Manual.
277 .SH THE COMPILER
279 SBCL inherits from CMU CL the "Python" native code compiler. (Though
280 we often avoid that name in order to avoid confusion with the
281 scripting language also called Python.) This compiler is very clever
282 about understanding the type system of Common Lisp and using it to
283 optimize code, and about producing notes to let the user know when the
284 compiler doesn't have enough type information to produce efficient
285 code. It also tries (almost always successfully) to follow the unusual
286 but very useful principle that "declarations are assertions", \fIi.e.\fR
287 type declarations should be checked at runtime unless the user
288 explicitly tells the system that speed is more important than safety.
290 The compiled code uses garbage collection to automatically manage
291 memory. The garbage collector implementation varies considerably from
292 CPU to CPU. In particular, on some CPUs the GC is nearly exact, while
293 on others it's more conservative, and on some CPUs the GC is
294 generational, while on others simpler stop and copy strategies are
295 used.
297 For more information about the compiler, see the user manual.
299 .SH SYSTEM REQUIREMENTS
301 SBCL currently runs on X86 (Linux, FreeBSD, OpenBSD, and NetBSD),
302 X86-64 (Linux), Alpha (Linux, Tru64), PPC (Linux, Darwin/MacOS X),
303 SPARC (Linux and Solaris 2.x), and MIPS (Linux). For information on
304 other ongoing and possible ports, see the sbcl\-devel mailing list,
305 and/or the web site.
307 SBCL requires on the order of 16Mb RAM to run on X86 systems, though
308 all but the smallest programs would be happier with 32Mb or more.
310 .SH KNOWN BUGS
312 This section attempts to list the most serious and long-standing bugs.
313 For more detailed and current information on bugs, see the BUGS file
314 in the distribution.
316 It is possible to get in deep trouble by exhausting heap memory.  The
317 SBCL system overcommits memory at startup, so, on typical Unix-alikes
318 like Linux and FreeBSD, this means that if the SBCL system turns out
319 to use more virtual memory than the system has available for it, other
320 processes tend to be killed randomly (!).
322 The compiler's handling of function return values unnecessarily
323 violates the "declarations are assertions" principle that it otherwise
324 adheres to. Using \f(CRPROCLAIM\fR or \f(CRDECLAIM\fR to specify the
325 return type of a function causes the compiler to believe you without
326 checking. Thus compiling a file containing
327 \f(CR
328   (DECLAIM (FTYPE (FUNCTION (T) NULL) SOMETIMES))
329   (DEFUN SOMETIMES (X) (ODDP X))
330   (DEFUN FOO (X) (IF (SOMETIMES X) \(aqTHIS\-TIME \(aqNOT\-THIS\-TIME))\fR
332 then running \f(CR(FOO 1)\fR gives \f(CRNOT\-THIS\-TIME\fR, because
333 the compiler relied on the truth of the \f(CRDECLAIM\fR without checking it.
335 Some things are implemented very inefficiently.
336 .TP 3
338 Multidimensional arrays are inefficient, especially
339 multidimensional arrays of floating point numbers.
340 .TP 3
342 SBCL, like most (maybe all?) implementations of Common Lisp on stock
343 hardware, has trouble passing floating point numbers around
344 efficiently, because a floating point number, plus a few extra bits to
345 identify its type, is larger than a machine word. (Thus, they get
346 "boxed" in heap-allocated storage, causing GC overhead.) Within a
347 single compilation unit, or when doing built-in operations like
348 \f(CRSQRT\fR and \f(CRAREF\fR, or some special operations like
349 structure slot accesses, this is avoidable: see the user manual for
350 some efficiency hints. But for general function calls across the
351 boundaries of compilation units, passing the result of a floating
352 point calculation as a function argument (or returning a floating
353 point result as a function value) is a fundamentally slow operation.
356 .SH REPORTING BUGS
358 To report a bug, please send mail to the mailing lists sbcl-help or
359 sbcl-devel. You can find the complete mailing list addresses on the
360 web pages at <\f(CRhttp://sbcl.sourceforge.net/\fR>; note that as a
361 spam reduction measure you must subscribe to the lists before you can
362 post. (You may also find fancy SourceForge bug-tracking machinery
363 there, but don't be fooled. As of 2002-07-25 anyway, we don't actively
364 monitor that machinery, and it exists only because we haven't been
365 able to figure out how to turn it off.)
367 As with any software bug report, it's most helpful if you can provide
368 enough information to reproduce the symptoms reliably, and if you say
369 clearly what the symptoms are.  For example, "There seems to be
370 something wrong with TAN of very small negative arguments. When I
371 execute \f(CR(TAN LEAST\-NEGATIVE\-SINGLE\-FLOAT)\fR interactively on
372 sbcl-1.2.3 on my Linux 4.5 X86 box, I get an \f(CRUNBOUND\-VARIABLE\fR
373 error."
375 .SH DIFFERENCES FROM CMU CL
377 SBCL can be built from scratch using a plain vanilla ANSI Common Lisp
378 system and a C compiler, and all of its properties are specified by
379 the version of the source code that it was created from. This clean
380 bootstrappability was the immediate motivation for forking off of the
381 CMU CL development tree. A variety of implementation differences are
382 motivated by this design goal.
384 Maintenance work in SBCL since the fork has diverged somewhat from the
385 maintenance work in CMU CL. Many but not all bug fixes and
386 improvements have been shared between the two projects, and sometimes
387 the two projects disagree about what would be an improvement.
389 Most extensions supported by CMU CL have been unbundled from SBCL,
390 including Motif support, the Hemlock editor, search paths, the WIRE
391 protocol, various user-level macros and functions (\fIe.g.\fR
392 \f(CRLETF\fR, \f(CRITERATE\fR, \f(CRMEMQ\fR, \f(CRREQUIRED\-ARGUMENT\fR),
393 and many others.
395 (Why doesn't SBCL support more extensions natively? Why drop all those
396 nice extensions from CMU CL when the code already exists? This is a
397 frequently asked question on the mailing list. There are two principal
398 reasons. First, it's a design philosophy issue: arguably SBCL has done
399 its job by supplying a stable FFI, and the right design decision is to
400 move functionality derived from that, like socket support, into
401 separate libraries. Some of these are distributed with SBCL as
402 "contrib" modules, others are distributed as separate software
403 packages by separate maintainers. Second, it's a practical decision -
404 focusing on a smaller number of things will, we hope, let us do a
405 better job on them.)
407 .SH SUPPORT
409 Various information about SBCL is available at
410 <\f(CRhttp://www.sbcl.org/\fR>. The mailing lists there are the recommended
411 place to look for support.
413 .SH AUTHORS
415 Dozens of people have made substantial contributions to SBCL and its
416 subsystems, and to the CMU CL system on which it was based, over the
417 years. See the CREDITS file in the distribution for more information.
419 .SH ENVIRONMENT
421 .TP 10n
422 .BR SBCL_HOME
423 This variable controls where files like "sbclrc", "sbcl.core", and the
424 add-on "contrib" systems are searched for.  If it is not set, then
425 sbcl sets it from a compile-time default location which is usually
426 \fB/usr/local/lib/sbcl/\fR but may have been changed \fIe.g.\fR by a third-party
427 packager.
429 .SH FILES
432 .I sbcl
433 executable program containing some low-level runtime support and
434 a loader, used to read sbcl.core
436 .I sbcl.core
437 dumped memory image containing most of SBCL, to be loaded by
438 the `sbcl' executable.  Looked for in \fB$SBCL_HOME\fR,
439 unless overridden by the \f(CR\-\-core\fR option.
441 .I sbclrc
442 optional system-wide startup script, looked for in \fB$SBCL_HOME\fR
443 then \fB/etc\fR, unless overridden by the \f(CR\-\-sysinit\fR command line
444 option.
446 .I .sbclrc
447 optional per-user customizable startup script (in user's home
448 directory, or as specified by  \f(CR\-\-userinit\fR)
450 .SH SEE ALSO
452 Full SBCL documentation is maintained as a Texinfo manual. If it has
453 been installed, the command
455 .B info sbcl
457 should give you access to the complete manual. Depending on your
458 installation it may also be available in HTML and PDF formats in \fIe.g.\fR
460 .B /usr/local/share/doc/sbcl/
462 See the SBCL homepage 
464 <\f(CRhttp://www.sbcl.org/\fR>
466 for more information, including directions on how to subscribe to the
467 sbcl\-devel and sbcl\-help mailing-lists.