Change initialization of interned array ctypes.
[sbcl.git] / src / compiler / ppc / subprim.lisp
blobafb7015c208bf5e8711b029d2dd74077721e3c4a
1 ;;;
2 ;;; Written by William Lott.
3 ;;;
4 (in-package "SB!VM")
7 \f
8 ;;;; Length
10 (define-vop (length/list)
11 (:translate length)
12 (:args (object :scs (descriptor-reg) :target ptr))
13 (:arg-types list)
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)
17 count)
18 (:results (result :scs (any-reg descriptor-reg)))
19 (:policy :fast-safe)
20 (:vop-var vop)
21 (:save-p :compute-only)
22 (:generator 50
23 (let ((done (gen-label))
24 (loop (gen-label))
25 (not-list (generate-error-code vop 'object-not-list-error ptr)))
26 (move ptr object)
27 (move count zero-tn)
29 (inst cmpw ptr null-tn)
30 (inst beq done)
32 (emit-label loop)
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)
40 (inst bne loop)
42 (emit-label done)
43 (move result count))))
46 (define-static-fun length (object) :translate length)