Previous: , Up: Slot Access Optimization   [Contents][Index]


2.23.3.3 Automatic Method Recompilation

Methods using inline slot access can be automatically recompiled after class changes. Two declarations control which methods are automatically recompiled.

declaim (ext:auto-compile specifier*)
declaim (ext:not-auto-compile specifier*)

specifier   ::= gf-name | (gf-name qualifier* (specializer*))
gf-name     ::= the name of a generic function
qualifier   ::= a method qualifier
specializer ::= a method specializer

If no specifier is given, auto-compilation is by default done/not done for all methods of all generic functions using inline slot access; current default is that it is not done. This global policy can be overridden on a generic function and method basis. If specifier is a generic function name, it applies to all methods of that generic function.

Examples:

(declaim (ext:auto-compile foo))
(defmethod foo :around ((x bar)) ...)

The around-method foo will be automatically recompiled because the declamation applies to all methods with name foo.

(declaim (ext:auto-compile (foo (bar))))
(defmethod foo :around ((x bar)) ...)
(defmethod foo ((x bar)) ...)

The around-method will not be automatically recompiled, but the primary method will.

(declaim (ext:auto-compile foo))
(declaim (ext:not-auto-compile (foo :around (bar)))  
(defmethod foo :around ((x bar)) ...)
(defmethod foo ((x bar)) ...)

The around-method will not be automatically recompiled, because it is explicitly declaimed not to be. The primary method will be automatically recompiled because the first declamation applies to it.

Auto-recompilation works by recording method bodies using inline slot access. When PCL determines that a recompilation is necessary, a defmethod form is constructed and evaluated.

Auto-compilation can only be done for methods defined in a null lexical environment. PCL prints a warning and doesn’t record the method body if a method using inline slot access is defined in a non-null lexical environment. Instead of doing a recompilation on itself, PCL will then print a warning that the method must be recompiled manually when classes are changed.


Previous: inline Declaration, Up: Slot Access Optimization   [Contents][Index]