1 ;;;; linkage information for standard static functions, and random vops
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
16 (define-vop (length/list)
18 (:args (object :scs (descriptor-reg) :target ptr))
20 (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
21 (:temporary (:scs (non-descriptor-reg)) temp)
22 (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
24 (:results (result :scs (any-reg descriptor-reg)))
27 (:save-p :compute-only)
34 (inst cmpeq ptr null-tn temp)
37 (inst and ptr lowtag-mask temp)
38 (inst xor temp list-pointer-lowtag temp)
39 (inst bne temp not-list)
41 (loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
42 (inst addq count (fixnumize 1) count)
43 (inst br zero-tn loop)
46 (cerror-call vop done object-not-list-error ptr)
51 (define-static-fun length (object) :translate length)