The LispWorks CLOS implementation achieves fast method dispatch by producing special functions to perform discrimination and method dispatch. Since the required operation can often only be determined by seeing what arguments a generic function is called with, these functions can often end up being generated and compiled at runtime.
If the compiler has been removed in a delivered application, then these special runtime-generated functions cannot be compiled on the fly.
There are two ways in which the delivery system deals with this problem.
The first is to have a set of pre-compiled "template" constructors which can construct an appropriate function. LispWorks comes with extensive set of such constructors, which should cover most of cases. The programmer can add her own, as explained below.
The other mechanism is to construct generic closures to do the work. The code that generates the closures can cope with:
progn
,
multiple-value-prog1
and
call-method
forms.In most cases the effect on method dispatch time of using the generic technique is negligible. Pathological cases might, however, cause a slowdown of 10-20% over compiled special functions. In this case, as well as for cases of user-defined complex method combinations which the generic mechanism cannot cope with, the delivered image must have precompiled "template" constructors, and if they are not already there the user needs to add them, as described next.