diff --git a/CHANGELOG b/CHANGELOG index ae8dbb76a..45a4bc07a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -51,6 +51,8 @@ =--with-libgc-incdir= and =--with-libgc-libdir= (these flags work the same as flags for =libffi= and =libgmp=) ** Issues fixed +- initarg caches are now invalidated when new methods are defined. Problem + found and fixed by Alexander Wood. - ECL allocated too much space in lisp stack. Instead of the specified size x in bytes, ECL allocated roughly x^2/p where p is defined in LISP_PAGESIZE (2048 by default). If you're setting the value of diff --git a/src/clos/fixup.lsp b/src/clos/fixup.lsp index a19f39f58..55b2a83b4 100644 --- a/src/clos/fixup.lsp +++ b/src/clos/fixup.lsp @@ -328,11 +328,21 @@ their lambda lists ~A and ~A are not congruent." (mapc #'recursively-update-classes (class-direct-subclasses a-class))) -(defmethod update-dependent ((object generic-function) - (dep initargs-updater) - &rest initargs) - (declare (ignore dep initargs object)) - (recursively-update-classes +the-class+)) +(defmethod update-dependent ((object generic-function) (dep initargs-updater) + &rest initargs + &key + ((add-method added-method) nil am-p) + ((remove-method removed-method) nil rm-p) + &allow-other-keys) + (declare (ignore object dep initargs)) + (let ((method (cond (am-p added-method) + (rm-p removed-method)))) + ;; update-dependent is also called when the gf itself is reinitialized, + ;; so make sure we actually have a method that's added or removed + (when method + (let ((spec (first (method-specializers method)))) ; the class being initialized or allocated + (when (classp spec) ; sanity check against eql specialization + (recursively-update-classes spec)))))) (let ((x (make-instance 'initargs-updater))) (add-dependent #'shared-initialize x)