Next Prev Up Top Contents Index

6.1.2 User-defined method combinations

The LispWorks CLOS implementation achieves fast method dispatch by producing a compiled function for all method combinations used in the application. Since necessary method combinations 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.

Because delivered application should not contain the compiler, method combination functions generated at runtime cannot be compiled on the fly. A solution to this problem is to use closure-based code to represent the combinations. In addition, the image can make use of many "template" method combination functions, already compiled, from which it can choose when deciding upon the right method combination for a particular call. The correct methods can be plugged into these template functions at runtime. The templates provided can deal 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.

The templates included should cover nearly all cases of user-defined method combinations. In those cases where they do not, however, Delivery substitutes closure-based code to do the job.

In most cases the effect on method-dispatch time of using this substitute technique is negligible. Pathological cases might, however, cause a slowdown of 10-20% over compiled method combination functions. Fortunately, you can find out what the correct template would be, return to LispWorks, and pre-compile it.

6.1.2.1 Finding the necessary method combination templates

6.1.2.2 Incorporating the templates into the application


LispWorks Delivery User Guide - 11 Dec 2001

Next Prev Up Top Contents Index