home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!apple!cambridge.apple.com!bill@cambridge.apple.com
- From: bill@cambridge.apple.com (Bill St. Clair)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Is this a bug or am I just not understanding applying Wood?
- Message-ID: <9208131621.AA12953@cambridge.apple.com>
- Date: 13 Aug 92 17:23:30 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 50
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Full-Name: Bill St. Clair
- Original-To: cornell@freya.cs.umass.edu
- Original-Cc: info-mcl
-
- >Bill: I think the definition of set-slot-value-in-both-worlds
- >(repeated below) is buggy. I'm pretty sure the second WHEN should use
- >slot-value, not p-slot-value. (P-slot-value does nothing if its arg is
- >not a pptr).
- >
- >matt
- >
- > (defun wood::set-slot-value-in-both-worlds (pheap instance slot-name value)
- > (let ((in-memory (wood::in-memory-p instance))
- > (on-disk (wood::on-disk-p pheap instance)))
- > (when on-disk
- > (setf (p-slot-value on-disk slot-name) value))
- > (when in-memory
- > (setf (p-slot-value in-memory slot-name) value))) ;should be slot-value
- > value)
-
- You're right, though this code should work since (setf p-slot-value)
- simply calls (setf slot-value) if the instance is not a PPTR.
-
- Well, that's what it was supposed to do, but (setf p-slot-value)
- had a bug as well. Here's a patch:
-
- ------------------------------------------------------------------------
-
- ; setf-p-slot-value-patch.lisp
- ;
- ; (setf (p-slot-value instance slot) value)
- ; now calls (setf slot-value) when instance is not a PPTR.
-
- (in-package :wood)
-
- (let ((*warn-if-redefine* nil))
-
- (defun (setf p-slot-value) (value p slot-name)
- (if (pptr-p p)
- (let* ((pheap (pptr-pheap p))
- (disk-cache (pheap-disk-cache pheap))
- (pointer (pptr-pointer p)))
- (multiple-value-bind (slots index)
- (dc-%slot-vector-and-index disk-cache pointer slot-name)
- (unless slots
- (dc-slot-missing disk-cache pointer slot-name '(setf p-slot-value)))
- (multiple-value-bind (v imm?) (%p-store pheap value)
- (setf (dc-%svref disk-cache slots index imm?) v)
- (if imm?
- v
- (pptr pheap v)))))
- (setf (slot-value p slot-name) value)))
-
- )
-