[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Caching bug?



I am running into what looks like a bug in the PCL caches.  Specifically, I
defined a slot-unbound method to catch references to unbound slots and compute
appropriate values.  Unfortunately, in some cases calling a slot accessor
function appears to fall into an infinite loop within PCL before the
slot-unbound method is ever called.  On the other hand, calling slot-value on
that slot returns the correct value.

The problem is 100% reproducible; unfortunately, the bug appears only after a
specific sequence of calls to the accessor (everything works fine the first few
times the accessor is called), so the smallest example I have which exhibits
this problem is a large program.  Effectively, I am doing something akin to the
following sketch of code:

(defclass c1 () ((x :reader x)))
(defclass c2 (c1) ((y :reader y)))
(defclass cc () ())

(defmethod slot-unbound (class (instance c1) (slot (eql 'x)))
  (setf (slot-value instance 'x)
        (make-instance 'cc)))

(In my large program there are a few more classes in the hierarchy between c1
and c2.)

Calling
  (slot-value (make-instance 'c2) 'x)
always works, while calling
  (x (make-instance 'c2))
falls into an infinite loop (in my large program, not this example).

Interestingly enough, using defclass to define a new subclass of c1 makes the
problem temporarily go away.

I'd like to isolate the problem, but I am not familiar enough with PCL's
internals to know what to do next.  What should I look for to determine what is
causing the problem?

I am using the 12/7/88 PCL on a Macintosh using Coral Common Lisp 1.2.2.

				Waldemar Horwat
				waldemar@hx.lcs.mit.edu