Changeset 103


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

Set things up for faster slot lookup.

File:
1 edited

Legend:

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

    r99 r103  
    293293      (setf (%wrapper-instance-slots new-wrapper) new-ordering
    294294            (%wrapper-class-slots new-wrapper) (%class-get class :class-slots)
    295             (%class.own-wrapper class) new-wrapper))))
     295            (%class.own-wrapper class) new-wrapper)
     296      (setup-slot-lookup new-wrapper eslotds))))
     297
     298
     299 
     300(defun setup-slot-lookup (wrapper eslotds)
     301  (let* ((nslots (length eslotds))
     302         (total-slot-ids (current-slot-index))
     303         (small (< nslots 255))
     304         (map
     305          (if small
     306            (make-array total-slot-ids :element-type '(unsigned-byte 8))
     307            (make-array total-slot-ids :element-type '(unsigned-byte 32))))
     308         (table (make-array (the fixnum (1+ nslots))))
     309         (i 0))
     310    (declare (fixnum nslots total-slot-ids i) (simple-vector table))
     311    (setf (svref table 0) nil)
     312    (dolist (slotd eslotds)
     313      (incf i)
     314      (setf (svref table i) slotd)
     315      (setf (aref map
     316                  (slot-id.index
     317                   (standard-effective-slot-definition.slot-id slotd)))
     318            i))
     319    (let* ((lookup-f (gvector :function
     320                              (%svref (if small
     321                                        #'%small-map-slot-id-lookup
     322                                        #'%large-map-slot-id-lookup) 0)
     323                              map
     324                              table
     325                              (dpb 1 $lfbits-numreq
     326                                   (ash -1 $lfbits-noname-bit))))
     327           (class (%wrapper-class wrapper))
     328           (get-cell (list #'slot-value-using-class))
     329           (get-f (gvector :function
     330                           (%svref (if small
     331                                     #'%small-slot-id-value
     332                                     #'%large-slot-id-value) 0)
     333                           map
     334                           table
     335                           class
     336                           get-cell
     337                           '%slot-id-ref-missing
     338                           (dpb 2 $lfbits-numreq
     339                                (ash -1 $lfbits-noname-bit))))
     340           (set-cell (list #'(setf slot-value-using-class)))
     341           (set-f (gvector :function
     342                           (%svref (if small
     343                                     #'%small-set-slot-id-value
     344                                     #'%large-set-slot-id-value) 0)
     345                           map
     346                           table
     347                           class
     348                           set-cell
     349                           '%slot-id-set-missing
     350                           (dpb 2 $lfbits-numreq
     351                                (ash -1 $lfbits-noname-bit)))))
     352      (setf (%wrapper-slot-id->slotd wrapper) lookup-f
     353            (%wrapper-class-svuc-effective-method-function wrapper) get-cell
     354            (%wrapper-class-ssvuc-effective-method-function wrapper) set-cell
     355            (%wrapper-slot-id-value wrapper) get-f
     356            (%wrapper-set-slot-id-value wrapper) set-f
     357            (%wrapper-slot-id-map wrapper) map
     358            (%wrapper-slot-definition-table wrapper) table)
     359      wrapper)))
     360
     361                       
     362   
    296363
    297364(defmethod validate-superclass ((class class) (super class))
Note: See TracChangeset for help on using the changeset viewer.