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

[Jeff Morrill: Recursive cache expansion bug rears its ugly head]

------- Forwarded Message

Received: from BBN.COM by DINO.BBN.COM id aa14374; 10 Jul 89 14:13 EDT
Received: from v1.bbn.com by BBN.COM id aa01115; 10 Jul 89 14:11 EDT
Return-path: <@adams.bbn.com:jmorrill@[]>
Received: from adams.bbn.com by v1.bbn.com via TCP; Mon Jul 10 14:01 EDT
Date: Mon, 10 Jul 89 14:03 EDT
From: Jeff Morrill <jmorrill@[]>
Subject: Recursive cache expansion bug rears its ugly head
To: mthome@bbn.com, kanderson@bbn.com, delatizky@bbn.com, jmorrill@bbn.com
Message-ID: <19890710180350.1.JMORRILL@adams.bbn.com>

The recursive cache expansion bug appeared again today on the
XL400 during a demo, despite our previous fix.  That previous
fix was to avoid applying setf to a generic function while
doing an EXPAND-DCODE-CACHE.  Otherwise, PCL tries to
expand the cache for (setf slot-value-using-class) recursively
forever (or until something breaks).  

Well, we didn't fix enough.  EXPAND-DCODE-CACHE calls
setf to a generic function.  Here is a fix that seems to

(defmethod install-discriminating-function
	   ((generic-function standard-generic-function) function)
  (set-funcallable-instance-function generic-function function)
  ;; (setf (generic-function-discriminator-code generic-function) function))
  (setf (slot-value generic-function 'discriminator-code) function))

Jon L White pointed out that although (setf slot-value) expands
into a call to set-slot-value (which in turn calls
(setf slot-value-using-class)), the code walker 
replaces calls to set-slot-value with some low-level ugly fast thing
that doesn't worry about cache expansion.

It seems like a good idea when writing future DCODE algorithms to
avoid like the plague applying setf to generic functions, except
for the case of (setf slot-value).  Of course, even that could
lead to the recursive cache expansion bug if it's in a defun rather
than a defmethod.  It would also help if (setf slot-value-using-class)
wasn't being invalidated every time we define a class whose metaclass
provides a method for it.

Mike, I'll leave it to you to put the patch wherever it goes in
our source files.  Maybe somebody should forward this to Gregor too.

jeff morrill

------- End of Forwarded Message