Skip to content
Snippets Groups Projects
Commit c3fd05a9 authored by gerd's avatar gerd
Browse files

CLtS effectively forbids method load-time precomputation of

	effective methods (which I think is either yet another oversight,
	or bad language design).  Found by Paul Dietz.

	Set *max-emf-precomputation-methods* to > 0 to allow
	precomputation of effective methods at method load-time for
	generic functions having less than the specified number of
	methods.

	* src/pcl/dfun.lisp (*max-emf-precomputation-methods*): Set to 0.

	* src/pcl/pkg.lisp ("PCL"): Export *max-emf-precomputation-methods*.
parent 8350d9d9
No related branches found
No related tags found
No related merge requests found
......@@ -2187,6 +2187,31 @@ provided for forcing such an update of effective methods.
\subsection{Effective Method Precomputation}
\cpsubindex{effective method}{precomputation}
\cpsubindex{methods}{load time}
\cpsubindex{methods}{emf precomputation}
When a generic function is called, the generic function's
discriminating function computes the set of methods applicable to
actual arguments and constructs an effective method function from
applicable methods, using the generic function's method combination.
Effective methods can be precomputed at method load time instead of
when the generic function is called by setting
\code{pcl:*max-emf-precomputation-methods*} to a nonzero number.
\begin{defvar}{pcl:}{*max-emf-precomputation-methods*}
If nonzero, precompute effective methods when methods are loaded,
and the method's generic function has less than the specified
number of methods.
If zero, the default, compute effective methods only when the
generic function is called.
\end{defvar}
\subsection{Sealing}
\cindex{sealing}
\cpsubindex{sealing}{subclasses}
......
......@@ -207,9 +207,12 @@ New in this release:
called, the generic function PCL:NO-PRIMARY-METHOD is called.
The default method of this generic function signals a
continuable error of type PCL:NO-PRIMARY-METHOD-ERROR.
- Effective methods are not precomputed at method load time if
the generic function has >= PCL::*MAX-EMF-PRECOMPUTATION-METHODS*
methods (default value 100). This prevents a O(n^3) behavior.
- Effective methods are no longer precomputed at method load
time, for conformance with CLtS.
PCL:*MAX-EMF-PRECOMPUTATION-METHODS* can be set to a number >
0 to allow effective method precomputation when the generic
function in question has less than the specified number of
methods.
* Improvements to Hemlock, the Emacs-like editor:
......
......@@ -25,7 +25,7 @@
;;; *************************************************************************
(file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/dfun.lisp,v 1.31 2003/07/17 12:40:35 gerd Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/dfun.lisp,v 1.32 2003/07/28 10:43:15 gerd Exp $")
(in-package :pcl)
......@@ -769,9 +769,11 @@ And so, we are saved.
;;;
(defvar *early-p* nil)
(defvar *max-emf-precomputation-methods* 100
"Precompute effective methods only if the generic function
has less than this number of methods.")
(defvar *max-emf-precomputation-methods* 0
"Precompute effective methods at method load time if the generic
function has less than this number of methods. The default value
of 0 means do not precompute effective methods at method load time,
which seems to be the behavior required by ANSI.")
;;;
;;; Try to finalize all unfinalized class specializers of all methods
......
......@@ -26,7 +26,7 @@
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/pkg.lisp,v 1.28 2003/06/17 09:45:40 gerd Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/pkg.lisp,v 1.29 2003/07/28 10:43:15 gerd Rel $")
;;;
;;; CMUCL 18a: Jan-1998 -- Changing to DEFPACKAGE.
......@@ -92,7 +92,8 @@
"WITH-SLOTS"
)
(:export "SEAL" "UNSEAL" "SEALED-ERROR")
(:export "SEAL" "UNSEAL" "SEALED-ERROR"
"*MAX-EMF-PRECOMPUTATION-METHODS*")
;; Function names.
(:export "EFFECTIVE-METHOD" "FAST-METHOD" "SLOT-ACCESSOR"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment