src/method-{proto,impl}.lisp: Introduce `effective-method-live-p' protocol.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 19:15:23 +0000 (19:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 14:09:03 +0000 (15:09 +0100)
Previously, the `compute-method-entry-functions' method defined on
`simple-effective-method' would bail out early if there were no primary
methods.  This is unsatisfactory: subclasses of `simple-effective-
method' might want to introduce more complicated method combination
machinery.

Make this a proper part of the protocol: introduce `effective-method-
live-p', which gets to decide whether to make method-entry functions or
just leave the vtable pointers null.  Now `simple-effective-method' can
decide, in the same way, to suppress the method entries based on the
existence of primary methods, but subclasses can apply more (or less)
subtle policy.

doc/SYMBOLS
doc/layout.tex
src/method-impl.lisp
src/method-proto.lisp

index 58fdc74..06e2002 100644 (file)
@@ -479,6 +479,7 @@ method-proto.lisp
   effective-method-class                        generic
   effective-method-function-name                generic
   effective-method-keywords                     generic
   effective-method-class                        generic
   effective-method-function-name                generic
   effective-method-keywords                     generic
+  effective-method-live-p                       generic
   effective-method-message                      generic
   ensure-ilayout-var                            function
   inst-chain-head                               generic
   effective-method-message                      generic
   ensure-ilayout-var                            function
   inst-chain-head                               generic
@@ -842,6 +843,7 @@ compute-islots
   sod-class sod-class
 compute-method-entry-functions
   basic-effective-method
   sod-class sod-class
 compute-method-entry-functions
   basic-effective-method
+  effective-method
   simple-effective-method
 compute-sod-effective-method
   sod-message sod-class
   simple-effective-method
 compute-sod-effective-method
   sod-message sod-class
@@ -876,6 +878,8 @@ effective-method-function-name
   effective-method
 effective-method-keywords
   effective-method
   effective-method
 effective-method-keywords
   effective-method
+effective-method-live-p
+  simple-effective-method
 effective-method-message
   effective-method
 effective-slot-class
 effective-method-message
   effective-method
 effective-slot-class
index c52989c..3c6fcf0 100644 (file)
     {effective-method-basic-argument-names @<method> @> @<list>}
 \end{describe}
 
     {effective-method-basic-argument-names @<method> @> @<list>}
 \end{describe}
 
+\begin{describe}{gf}
+    {effective-method-live-p @<method> @> @<generalized-boolean>}
+\end{describe}
 
 
 \begin{describe}{cls}
 
 
 \begin{describe}{cls}
index 1256376..20380a7 100644 (file)
                                       *null-pointer* 0)))
               (call-next-method)))))))
 
                                       *null-pointer* 0)))
               (call-next-method)))))))
 
-(defmethod compute-method-entry-functions
-    ((method simple-effective-method))
-  (if (effective-method-primary-methods method)
+(defmethod effective-method-live-p ((method simple-effective-method))
+  (effective-method-primary-methods method))
+
+(defmethod compute-method-entry-functions :around ((method effective-method))
+  (if (effective-method-live-p method)
       (call-next-method)
       nil))
 
       (call-next-method)
       nil))
 
index f5d8be7..b821912 100644 (file)
    not included, and neither are more exotic arguments added as part of the
    method delegation protocol."))
 
    not included, and neither are more exotic arguments added as part of the
    method delegation protocol."))
 
+(export 'effective-method-live-p)
+(defgeneric effective-method-live-p (method)
+  (:documentation
+   "Returns true if the effective METHOD is live.
+
+   An effective method is `live' if it should actually have proper method entry
+   functions associated with it and stored in the class vtable.  The other
+   possibility is that the method is `dead', in which case the function
+   pointers in the vtable are left null."))
+
 ;;;--------------------------------------------------------------------------
 ;;; Code generation.
 
 ;;;--------------------------------------------------------------------------
 ;;; Code generation.