[closer-devel] ContextL: Garbage collector for layer activation caches added
Pascal Costanza
pc at p-cos.net
Mon Nov 26 00:31:34 UTC 2007
Hi,
The darcs repository for ContextL contains new changes which add a
garbage collector for layer activation caches. The garbage collector
works as follows:
- Whenever a layer is redefined or reinitialized (either via
reinitialize-instance or via reevaluating a deflayer form for an
already existing layer), all entries for that layer in the layer
activation and deactivation caches are removed. Since layer-makunbound
is expressed in terms of (setf find-class) and (setf class-name),
which triggers a call of reinitialize-instance according to the CLOS
MOP specification, this also removes the respective layer from the
layer activation caches.
- Likewise, whenever methods are added to adjoin-layer-using-class and
remove-layer-using-class, the layers which are instances of the layer
metaclasses on which these methods are specialized are removed from
the layer activation and deactivation caches. (More specifically, the
activation caches for adjoin-layer-using-class and the deactivation
caches for remove-layer-using-class.)
Both cases are primarily intended to better support development of new
layer metaclasses, but also specific functionality when adjoin-layer-
using-class / remove-layer-using-class depend on properties of the
respective layers. Methods on these generic functions can now return a
second value of t to indicate that the result can be cached, but are
reassured that if their assumptions are invalidated, they will get
called again no matter what.
ContextL now also exports a function clear-layer-caches which blindly
clears all layer activation and deactivation caches, so that you can
start building your caches from scratch.
There are now two asdf-files included in ContextL: contextl-with-layer-
gc.asd includes the layer garbage collector, whereas contextl-without-
layer-gc.asd doesn't include it. If you don't trust the garbage
collector, this means that you can use the latter system definition.
The default case (in contextl.asd) is to include the garbage collector.
The function clear-layer-caches doesn't exist when the garbage
collector is not included.
The garbage collector adds a feature :contextl-layer-gc to *features*.
However, don't count on this being there in the long run. The long-
term goal is to keep the garbage collector as the default and to
remove the version without the garbage collector. The feature is only
used for internal purposes.
And yes, the garbage collector shouldn't affect the performance of
layer activation and deactivation, and the meta-level API also works
as before. ;)
Please let me know what you think, especially when you see problems in
the approach I have taken.
Best,
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the closer-devel
mailing list