clos: invalidate initarg caches when new methods are defined

Closes #425. Fix contributed by Bike from #clasp.
This commit is contained in:
Daniel Kochmanski 2018-04-06 16:36:36 +02:00
parent 3fd005d8df
commit d641c39bd9
2 changed files with 17 additions and 5 deletions

View file

@ -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

View file

@ -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)