1 ;;; -*- Package: ALPHA; Log: C.Log -*-
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
9 ;;; **********************************************************************
11 ;;; Linkage information for standard static functions, and random vops.
13 ;;; Written by William Lott.
14 ;;; Converted by Sean Hallgren.
23 (define-vop (length/list)
25 (:args (object :scs (descriptor-reg) :target ptr))
27 (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
28 (:temporary (:scs (non-descriptor-reg)) temp)
29 (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
31 (:results (result :scs (any-reg descriptor-reg)))
34 (:save-p :compute-only)
41 (inst cmpeq ptr null-tn temp)
44 (inst and ptr lowtag-mask temp)
45 (inst xor temp list-pointer-type temp)
46 (inst bne temp not-list)
48 (loadw ptr ptr cons-cdr-slot list-pointer-type)
49 (inst addq count (fixnumize 1) count)
50 (inst br zero-tn loop)
53 (cerror-call vop done object-not-list-error ptr)
59 (define-static-function length (object) :translate length)