Previous: Compiler Policy, Up: The Compiler [Contents][Index]
Since Common Lisp forbids the redefinition of standard functions9, the compiler can have special knowledge of these standard functions embedded in it. This special knowledge is used in various ways (open coding, inline expansion, source transformation), but the implications to the user are basically the same:
trace
macro. Special-casing of standard functions can be
inhibited using the notinline
declaration.
When a function call is open coded, inline code whose effect is
equivalent to the function call is substituted for that function call.
When a function call is closed coded, it is usually left as is,
although it might be turned into a call to a different function with
different arguments. As an example, if nthcdr
were to be open
coded, then
(nthcdr 4 foobar)
might turn into
(cdr (cdr (cdr (cdr foobar))))
or even
(do ((i 0 (1+ i)) (list foobar (cdr foobar))) ((= i 4) list))
If nth
is closed coded, then
(nth x l)
might stay the same, or turn into something like:
(car (nthcdr x l))
In general, open coding sacrifices space for speed, but some functions (such as
car
) are so simple that they are always open-coded. Even when not
open-coded, a call to a standard function may be transformed into a
different function call (as in the last example) or compiled as
static call. Static function call uses a more efficient calling
convention that forbids redefinition.
Previous: Compiler Policy, Up: The Compiler [Contents][Index]