7 (define-vop (length/list)
9 (:args (object :scs (descriptor-reg) :target ptr))
11 (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
12 (:temporary (:scs (non-descriptor-reg)) temp)
13 (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
15 (:results (result :scs (any-reg descriptor-reg)))
18 (:save-p :compute-only)
20 (let ((done (gen-label))
22 (not-list (gen-label)))
28 (inst beq ptr null-tn done)
29 (inst and temp ptr lowtag-mask)
30 (inst xor temp list-pointer-lowtag)
31 (inst bne temp not-list)
34 (loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
36 (inst addu count count (fixnumize 1))
39 (cerror-call vop done object-not-list-error ptr)
42 (move result count))))
45 (define-static-fun length (object) :translate length)