Skip to content

Commit

Permalink
Remove leading NIL from slot name lists
Browse files Browse the repository at this point in the history
A FIXME comment said:

  NIL at the head of the list is a remnant from old purged code, that
  hasn't been quite cleaned up yet.

Changed producers of such lists:

* SLOT-NAME-LISTS-FROM-SLOTS
* MAKE-STD-{WRITER,READER,BOUNDP}-METHOD-FUNCTION

Changed consumers:

* INTERN-PV-TABLE
* COMPUTE-PV
  • Loading branch information
scymtym committed Jul 17, 2016
1 parent 65bde5f commit 0038790
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/pcl/slots-boot.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
.pv. instance-slots 0
(slot-value instance slot-name))))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list (list nil slot-name)))
(list (list slot-name)))
initargs))
((:custom :accessor)
(let* ((initargs (copy-tree
Expand All @@ -454,7 +454,7 @@
(instance) nil)
(instance-read-custom .pv. 0 instance)))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list (list nil slot-name)))
(list (list slot-name)))
initargs))))

(defun make-std-writer-method-function (class-or-name slot-name)
Expand All @@ -479,7 +479,7 @@
.pv. instance-slots 0 nv
(setf (slot-value instance slot-name) .good-new-value.)))))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list nil (list nil slot-name)))
(list nil (list slot-name)))
initargs))
((:custom :accessor)
(let ((initargs (copy-tree
Expand All @@ -489,7 +489,7 @@
(instance) nil)
(instance-write-custom .pv. 0 instance nv)))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list nil (list nil slot-name)))
(list nil (list slot-name)))
initargs)))))

(defun make-std-boundp-method-function (class-or-name slot-name)
Expand All @@ -504,7 +504,7 @@
.pv. instance-slots 0
(slot-boundp instance slot-name))))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list (list nil slot-name)))
(list (list slot-name)))
initargs))
((:custom :accessor)
(let ((initargs (copy-tree
Expand All @@ -514,7 +514,7 @@
(instance) nil)
(instance-boundp-custom .pv. 0 instance)))))))
(setf (getf (getf initargs 'plist) :slot-name-lists)
(list (list nil slot-name)))
(list (list slot-name)))
initargs))))

;;;; FINDING SLOT DEFINITIONS
Expand Down
13 changes: 3 additions & 10 deletions src/pcl/vector.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,13 @@

(defun intern-pv-table (&key slot-name-lists)
(flet ((intern-slot-names (slot-names)
;; FIXME: NIL at the head of the list is a remnant from
;; old purged code, that hasn't been quite cleaned up yet.
;; ...but as long as we assume it is there, we may as well
;; assert it.
(aver (not (car slot-names)))
(or (gethash slot-names *slot-name-lists*)
(setf (gethash slot-names *slot-name-lists*) slot-names)))
(%intern-pv-table (snl)
(or (gethash snl *pv-tables*)
(setf (gethash snl *pv-tables*)
(make-pv-table :slot-name-lists snl
:pv-size (* 2 (reduce #'+ snl
:key (lambda (slots)
(length (cdr slots))))))))))
:pv-size (* 2 (reduce #'+ snl :key #'length)))))))
(sb-thread:with-mutex (*pv-lock*)
(%intern-pv-table (mapcar #'intern-slot-names slot-name-lists)))))

Expand Down Expand Up @@ -105,7 +98,7 @@
(let* ((wrapper (pop wrappers))
(std-p (layout-for-std-class-p wrapper))
(class (wrapper-class* wrapper)))
(dolist (slot-name (cdr slot-names))
(dolist (slot-name slot-names)
(let ((cell
(or (find-slot-cell wrapper slot-name)
(cons nil (slot-missing-info class slot-name)))))
Expand Down Expand Up @@ -533,7 +526,7 @@
(defun slot-name-lists-from-slots (slots)
(mapcar (lambda (parameter-entry)
(when (cdr parameter-entry)
(cons nil (mapcar #'car (cdr parameter-entry)))))
(mapcar #'car (cdr parameter-entry))))
(mutate-slots slots)))

(defun mutate-slots (slots)
Expand Down

0 comments on commit 0038790

Please sign in to comment.