LispWorks Delivery User Guide > 9 Delivery and Internal Systems > 9.1 Delivery and CLOS

NextPrevUpTopContentsIndex

9.1.2 Special dispatch functions and templates for them

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:

  1. A simple method combination, with the operator naming a function (or generic function) -- not a macro or special form.
  2. A more complicated method combination, constructing a form which should effectively be a tree of 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.

9.1.2.1 Finding the necessary templates

9.1.2.2 Incorporating the templates into the application


LispWorks Delivery User Guide - 22 Dec 2009

NextPrevUpTopContentsIndex