2 (dolist (type '(single-float double-float
(unsigned-byte 8)
3 (unsigned-byte 32) (signed-byte 32)
7 collect
(sb-int:make-static-vector
8 256 :element-type type
)))
9 (saps (mapcar #'sb-sys
:vector-sap vectors
)))
11 (assert (every #'sb-sys
:sap
=
13 (mapcar #'sb-sys
:vector-sap vectors
)))))
15 ;;; Compute the physical size of some vectors and make sure it's right.
16 ;;; Why, you might ask, can't this simply use SB-VM::PRIMITIVE-OBJECT-SIZE
17 ;;; to compare against the size of a non-static vector?
18 ;;; Because PRIMITIVE-OBJECT-SIZE always gives you the _CORRECT_ answer
19 ;;; for the object, not the amount of space the allocator took,
20 ;;; and this test needs to assert correctness of the allocator.
21 (dolist (type '(base-char character
))
22 (loop for i from
1 to
20
23 do
(let* ((before sb-vm
:*static-space-free-pointer
*)
24 (obj (sb-vm::make-static-vector i
:element-type type
))
25 (after sb-vm
:*static-space-free-pointer
*)
26 (used (sb-sys:sap- after before
)))
27 (assert (= used
(sb-vm::primitive-object-size obj
))))))