- (defvar *raw-type->rawref-fun-name*
- '(;; The compiler thinks that the raw data vector is a vector of
- ;; unsigned bytes, so if the slot we want to access actually *is*
- ;; an unsigned byte, it'll access the slot for us even if we don't
- ;; lie to it at all.
- (unsigned-byte . aref)
- ;; "A lie can travel halfway round the world while the truth is
- ;; putting on its shoes." -- Mark Twain
- (single-float . %raw-ref-single)
- (double-float . %raw-ref-double)
- #!+long-float (long-float . %raw-ref-long)
- (complex-single-float . %raw-ref-complex-single)
- (complex-double-float . %raw-ref-complex-double)
- #!+long-float (complex-long-float . %raw-ref-complex-long))))
+
+ ;; information about how a slot of a given DSD-RAW-TYPE is to be accessed
+ (defstruct raw-slot-data
+ ;; the raw slot type, or T for a non-raw slot
+ ;;
+ ;; (Raw slots are allocated in the raw slots array in a vector which
+ ;; the GC doesn't need to scavenge. Non-raw slots are in the
+ ;; ordinary place you'd expect, directly indexed off the instance
+ ;; pointer.)
+ (raw-type (missing-arg) :type (or symbol cons) :read-only t)
+ ;; What operator is used (on the raw data vector) to access a slot
+ ;; of this type?
+ (accessor-name (missing-arg) :type symbol :read-only t)
+ ;; How many words are each value of this type? (This is used to
+ ;; rescale the offset into the raw data vector.)
+ (n-words (missing-arg) :type (and index (integer 1)) :read-only t))
+
+ (defvar *raw-slot-data-list*
+ (list
+ ;; The compiler thinks that the raw data vector is a vector of
+ ;; word-sized unsigned bytes, so if the slot we want to access
+ ;; actually *is* an unsigned byte, it'll access the slot for us
+ ;; even if we don't lie to it at all, just let it use normal AREF.
+ (make-raw-slot-data :raw-type 'unsigned-byte
+ :accessor-name 'aref
+ :n-words 1)
+ ;; In the other cases, we lie to the compiler, making it use
+ ;; some low-level AREFish access in order to pun the hapless
+ ;; bits into some other-than-unsigned-byte meaning.
+ ;;
+ ;; "A lie can travel halfway round the world while the truth is
+ ;; putting on its shoes." -- Mark Twain
+ (make-raw-slot-data :raw-type 'single-float
+ :accessor-name '%raw-ref-single
+ :n-words 1)
+ (make-raw-slot-data :raw-type 'double-float
+ :accessor-name '%raw-ref-double
+ :n-words 2)
+ (make-raw-slot-data :raw-type 'complex-single-float
+ :accessor-name '%raw-ref-complex-single
+ :n-words 2)
+ (make-raw-slot-data :raw-type 'complex-double-float
+ :accessor-name '%raw-ref-complex-double
+ :n-words 4)
+ #!+long-float
+ (make-raw-slot-data :raw-type long-float
+ :accessor-name '%raw-ref-long
+ :n-words #!+x86 3 #!+sparc 4)
+ #!+long-float
+ (make-raw-slot-data :raw-type complex-long-float
+ :accessor-name '%raw-ref-complex-long
+ :n-words #!+x86 6 #!+sparc 8))))