Changeset 102


Ignore:
Timestamp:
Dec 10, 2003, 12:22:43 AM (21 years ago)
Author:
Gary Byers
Message:

SLOT-ID stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-clos-boot.lisp

    r99 r102  
    2020; l1-clos-boot.lisp
    2121
     22
    2223(in-package :ccl)
    2324
     
    149150;;; Map slot-names (symbols) to SLOT-ID objects (which contain unique indices).
    150151(let* ((slot-id-lock (make-lock))
    151        (next-slot-index 0)
     152       (next-slot-index 1)              ; 0 is never a valid slot-index
    152153       (slot-id-hash (make-hash-table :test #'eq :weak t)))
    153154  (defun ensure-slot-id (slot-name)
     
    156157      (or (gethash slot-name slot-id-hash)
    157158          (setf (gethash slot-name slot-id-hash)
    158                 (%istruct 'slot-id slot-name (incf next-slot-index))))))
     159                (%istruct 'slot-id slot-name (prog1
     160                                                 next-slot-index
     161                                               (incf next-slot-index)))))))
    159162  (defun current-slot-index () next-slot-index)
    160163  )
     164
     165
     166(defun %slot-id-lookup-obsolete (instance slot-id)
     167  (update-obsolete-instance instance)
     168  (funcall (%wrapper-slot-id->slotd (instance.class-wrapper instance))
     169           instance slot-id))
     170(defun slot-id-lookup-no-slots (instance slot-id)
     171  (declare (ignore instance slot-id)))
     172
     173(defun %slot-id-ref-obsolete (instance slot-id)
     174  (update-obsolete-instance instance)
     175  (funcall (%wrapper-slot-id-value (instance.class-wrapper instance))
     176           instance slot-id))
     177(defun %slot-id-ref-missing (instance slot-id)
     178  (slot-missing (class-of instance) instance (slot-id.name slot-id) 'slot-value))
     179
     180(defun %slot-id-set-obsolete (instance slot-id new-value)
     181  (update-obsolete-instance instance)
     182  (funcall (%wrapper-set-slot-id-value (instance.class-wrapper instance))
     183           instance slot-id new-value))
     184
     185(defun %slot-id-set-missing (instance slot-id new-value)
     186  (slot-missing (class-of instance) instance (slot-id.name slot-id) '(setf slot-value) new-value))
    161187
    162188
     
    22992325    (find-slotd name slots)))
    23002326
    2301 ;;; Stupid, temporary definitions that miss the point completely:
     2327
    23022328(defun slot-id-value (instance slot-id)
    2303   (slot-value instance (slot-id.name slot-id)))
     2329  (let* ((wrapper (if (eq (typecode instance) ppc32::subtag-instance)
     2330                    (instance.class-wrapper instance)
     2331                    (%class.own-wrapper (class-of instance)))))
     2332    (funcall (%wrapper-slot-id-value wrapper) instance slot-id)))
    23042333
    23052334(defun set-slot-id-value (instance slot-id value)
    2306   (set-slot-value instance (slot-id.name slot-id) value))
     2335  (let* ((wrapper (if (eq (typecode instance) ppc32::subtag-instance)
     2336                    (instance.class-wrapper instance)
     2337                    (%class.own-wrapper (class-of instance)))))
     2338    (funcall (%wrapper-set-slot-id-value wrapper) instance slot-id value)))
    23072339
    23082340; returns nil if (apply gf args) wil cause an error because of the
Note: See TracChangeset for help on using the changeset viewer.