Fix make-array transforms.
[sbcl.git] / doc / manual / compiler.texinfo
index 9a3533d..5fa6525 100644 (file)
@@ -64,17 +64,17 @@ Local control:
       (* x -5))))
 @end lisp
 
-@deffn {Declaration} sb-ext:muffle-conditions
+@deffn {Declaration} @sbext{muffle-conditions}
 Syntax: type*
 
 Muffles the diagnostic messages that would be caused by compile-time
 signals of given types.
 @end deffn
 
-@deffn {Declaration} sb-ext:unmuffle-conditions
+@deffn {Declaration} @sbext{unmuffle-conditions}
 Syntax: type*
 
-Cancels the effect of a previous @code{sb-ext:muffle-condition}
+Cancels the effect of a previous @code{sb-ext:muffle-conditions}
 declaration.
 @end deffn
 
@@ -130,11 +130,11 @@ compiler, see @ref{Customization Hooks for Users}.
 @subsection Diagnostic Severity
 @cindex Severity of compiler messages
 @cindex Compiler Diagnostic Severity
-@tindex error
-@tindex warning
-@tindex style-warning
-@tindex compiler-note
-@tindex code-deletion-note
+@tindex @cl{error}
+@tindex @cl{warning}
+@tindex @cl{style-warning}
+@tindex @sbext{compiler-note}
+@tindex @sbext{code-deletion-note}
 
 There are four levels of compiler diagnostic severity: 
 
@@ -156,8 +156,8 @@ to the @code{sb-ext:compiler-note}, and is used for problems which are
 too mild for the standard condition classes, typically hints about how
 efficiency might be improved. The @code{sb-ext:code-deletion-note}, a
 subtype of @code{compiler-note}, is signalled when the compiler
-deletes user-supplied code, usually after proving that the code in
-question is unreachable.
+deletes user-supplied code after proving that the code in question is
+unreachable.
 
 Future work for SBCL includes expanding this hierarchy of types to
 allow more fine-grained control over emission of diagnostic messages.
@@ -217,7 +217,7 @@ diagnostic:
 @enumerate
 
 @item
-@findex with-compilation-unit
+@findex @cl{with-compilation-unit}
 @samp{file: /tmp/foo.lisp} This is the name of the file that the
 compiler read the relevant code from.  The file name is displayed
 because it may not be immediately obvious when there is an error
@@ -456,11 +456,10 @@ one level.
 @comment  node-name,  next,  previous,  up
 @section Handling of Types
 
-The most unusual features of the SBCL compiler (which is very
-similar to the original CMUCL compiler, also known as @dfn{Python})
-is its unusually sophisticated understanding of the Common Lisp type
-system and its unusually conservative approach to the implementation
-of type declarations.
+One of the most important features of the SBCL compiler (similar to
+the original CMUCL compiler, also known as @dfn{Python}) is its fairly
+sophisticated understanding of the Common Lisp type system and its
+conservative approach to the implementation of type declarations.
 
 These two features reward the use of type declarations throughout
 development, even when high performance is not a concern. Also, as
@@ -468,7 +467,7 @@ discussed in the chapter on performance (@pxref{Efficiency}), the use
 of appropriate type declarations can be very important for performance
 as well.
 
-@findex satisfies
+@findex @cl{satisfies}
 The SBCL compiler also has a greater knowledge of the Common Lisp
 type system than other compilers. Support is incomplete only for types
 involving the @code{satisfies} type specifier.
@@ -491,23 +490,30 @@ involving the @code{satisfies} type specifier.
 @node Declarations as Assertions
 @comment  node-name,  next,  previous,  up
 @subsection Declarations as Assertions
-@findex safety
+@cindex Safety optimization quality
 
-The SBCL compiler treats type declarations differently from most
-other Lisp compilers. Under default compilation policy the compiler
-doesn't blindly believe type declarations, but considers them
-assertions about the program that should be checked: all type
-declarations that have not been proven to always hold are asserted at
-runtime.
+The SBCL compiler treats type declarations differently from most other
+Lisp compilers. Under default compilation policy the compiler doesn't
+blindly believe type declarations, but considers them assertions about
+the program that should be checked: all type declarations that have
+not been proven to always hold are asserted at runtime.
 
 @quotation
 @emph{Remaining bugs in the compiler's handling of types unfortunately
 provide some exceptions to this rule, see @ref{Implementation
-Limitations}).}
+Limitations}.}
 @end quotation
 
-There are three type checking policies available in SBCL,
-selectable via @code{optimize} declarations.
+CLOS slot types form a notable exception. Types declared using the
+@code{:type} slot option in @code{defclass} are asserted if and only
+if the class was defined in @emph{safe code} and the slot access
+location is in @emph{safe code} as well. This laxness does not pose
+any internal consistency issues, as the CLOS slot types are not
+available for the type inferencer, nor do CLOS slot types provide any
+efficiency benefits.
+
+There are three type checking policies available in SBCL, selectable
+via @code{optimize} declarations.
 
 @table @strong
 
@@ -522,8 +528,9 @@ provides full type checks.
 Used when @code{(or (>= safety 2) (>= safety speed 1))}.
 
 @item Weak Type Checks
-Declared types may be simplified into faster to check supertypes: for example,
-@code{(and unsigned-byte fixnum)} is simplified into @code{fixnum}.
+Declared types may be simplified into faster to check supertypes: for
+example, @code{(or (integer -17 -7) (integer 7 17))} is simplified
+into @code{(integer -17 17)}.
 
 @strong{Note}: it is relatively easy to corrupt the heap when weak
 type checks are used if the program contains type-errors.
@@ -917,6 +924,10 @@ is to slow the program by causing cache misses or even swapping.
 @c      _(end of section on compiler policy)
 @c      _-->
 
+@include fun-sb-ext-describe-compiler-policy.texinfo
+@include fun-sb-ext-restrict-compiler-policy.texinfo
+@include macro-common-lisp-with-compilation-unit.texinfo
+
 @node Compiler Errors
 @comment  node-name,  next,  previous,  up
 @section Compiler Errors
@@ -1103,15 +1114,15 @@ a more efficient calling convention that forbids redefinition.
 @comment  node-name,  next,  previous,  up
 @section Interpreter
 @cindex Interpreter
-@vindex sb-ext:*evaluator-mode*
+@findex @cl{eval}
+@vindex @sbext{@earmuffs{evaluator-mode}}
 
 By default SBCL implements @code{eval} by calling the native code
-compiler. SBCL also includes an interpreter for use in special cases
-where using the compiler is undesirable, for example due to compilation
-overhead. Unlike in some other Lisp implementations, in SBCL interpreted
-code is not safer or more debuggable than compiled code.
-
-Switching between the compiler and the interpreter is done using the
-special variable @code{sb-ext:*evaluator-mode*}. As of 0.9.17, valid
-values for @code{sb-ext:*evaluator-mode*} are @code{:compile} and
-@code{:interpret}.
+compiler.
+
+SBCL also includes an interpreter for use in special cases where using
+the compiler is undesirable, for example due to compilation overhead.
+Unlike in some other Lisp implementations, in SBCL interpreted code is
+not safer or more debuggable than compiled code.
+
+@include var-sb-ext-star-evaluator-mode-star.texinfo