2 ;;; Written by William Lott.
10 (define-vop (length/list
)
12 (:args
(object :scs
(descriptor-reg) :target ptr
))
14 (:temporary
(:scs
(descriptor-reg) :from
(:argument
0)) ptr
)
15 (:temporary
(:scs
(non-descriptor-reg)) temp
)
16 (:temporary
(:scs
(any-reg) :type fixnum
:to
(:result
0) :target result
)
18 (:results
(result :scs
(any-reg descriptor-reg
)))
21 (:save-p
:compute-only
)
23 (let ((done (gen-label))
25 (not-list (generate-error-code vop
'object-not-list-error ptr
)))
29 (inst cmpw ptr null-tn
)
34 (test-type ptr not-list t
(list-pointer-lowtag) :temp temp
)
36 (loadw ptr ptr cons-cdr-slot list-pointer-lowtag
)
37 (inst addi count count
(fixnumize 1))
39 (inst cmpw ptr null-tn
)
43 (move result count
))))
46 (define-static-fun length
(object) :translate length
)