(:translate length)
(:args (object :scs (descriptor-reg control-stack) :target ptr))
(:arg-types list)
- (:temporary (:sc unsigned-reg :offset eax-offset) eax)
+ (:temporary (:sc dword-reg :offset eax-offset) eax)
(:temporary (:sc descriptor-reg :from (:argument 0)) ptr)
(:results (count :scs (any-reg)))
(:result-types positive-fixnum)
(:policy :fast-safe)
(:vop-var vop)
(:save-p :compute-only)
+ (:ignore eax)
(:generator 40
;; Move OBJECT into a temp we can bash on, and initialize the count.
(move ptr object)
- (inst xor count count)
+ (zeroize count)
;; If we are starting with NIL, then it's really easy.
(inst cmp ptr nil-value)
- (inst jmp :e done)
+ (inst jmp :e DONE)
;; Note: we don't have to test to see whether the original argument is a
;; list, because this is a :fast-safe vop.
LOOP
(inst add count (fixnumize 1))
;; If we hit NIL, then we are done.
(inst cmp ptr nil-value)
- (inst jmp :e done)
+ (inst jmp :e DONE)
;; Otherwise, check to see whether we hit the end of a dotted list. If
;; not, loop back for more.
- (move eax ptr)
- (inst and al-tn lowtag-mask)
- (inst cmp al-tn list-pointer-lowtag)
- (inst jmp :e loop)
+ (%test-lowtag ptr LOOP nil list-pointer-lowtag)
;; It's dotted all right. Flame out.
- (error-call vop object-not-list-error ptr)
+ (error-call vop 'object-not-list-error ptr)
;; We be done.
DONE))
;; Get a copy of OBJECT in a register we can bash on, and
;; initialize COUNT.
(move ptr object)
- (inst xor count count)
+ (zeroize count)
;; If we are starting with NIL, we be done.
(inst cmp ptr nil-value)
- (inst jmp :e done)
+ (inst jmp :e DONE)
;; Indirect the next cons cell, and boost the count.
LOOP
(loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
(inst add count (fixnumize 1))
;; If we aren't done, go back for more.
(inst cmp ptr nil-value)
- (inst jmp :ne loop)
+ (inst jmp :ne LOOP)
DONE))
(define-static-fun length (object) :translate length)
+(define-static-fun %coerce-callable-to-fun (callable)
+ :translate %coerce-callable-to-fun)