Next: Semi-Inline Expansion, Up: Inline Expansion [Contents][Index]
Inline expansion requires that the source for the inline expanded function to
be available when calls to the function are compiled. The compiler doesn’t
remember the inline expansion for every function, since that would take an
excessive about of space. Instead, the programmer must tell the compiler to
record the inline expansion before the definition of the inline expanded
function is compiled. This is done by globally declaring the function inline
before the function is defined, by using the inline
and
extensions:maybe-inline
(see maybe-inline-declaration)
declarations.
In addition to recording the inline expansion of inline functions at the time
the function is compiled, compile-file
also puts the inline expansion in
the output file. When the output file is loaded, the inline expansion is made
available for subsequent compilations; there is no need to compile the
definition again to record the inline expansion.
If a function is declared inline, but no expansion is recorded, then the compiler will give an efficiency note like:
Note: MYFUN is declared inline, but has no expansion.
When you get this note, check that the inline
declaration and the
definition appear before the calls that are to be inline expanded. This note
will also be given if the inline expansion for a defun
could not be
recorded because the defun
was in a non-null lexical environment.
Next: Semi-Inline Expansion, Up: Inline Expansion [Contents][Index]