0.9.11.25:
[sbcl.git] / src / compiler / mips / subprim.lisp
index 91fef15..28542c6 100644 (file)
   (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
   (:temporary (:scs (non-descriptor-reg)) temp)
   (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
-             count)
+              count)
   (:results (result :scs (any-reg descriptor-reg)))
   (:policy :fast-safe)
   (:vop-var vop)
   (:save-p :compute-only)
   (:generator 50
-    (move ptr object)
-    (move count zero-tn)
-    
-    LOOP
-    
-    (inst beq ptr null-tn done)
-    (inst nop)
-    
-    (inst and temp ptr lowtag-mask)
-    (inst xor temp list-pointer-lowtag)
-    (inst bne temp zero-tn not-list)
-    (inst nop)
-    
-    (loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
-    (inst b loop)
-    (inst addu count count (fixnumize 1))
-    
-    NOT-LIST
-    (cerror-call vop done object-not-list-error ptr)
-    
-    DONE
-    (move result count)))
-       
+    (let ((done (gen-label))
+          (loop (gen-label))
+          (not-list (gen-label)))
+      (move ptr object)
+      (move count zero-tn)
 
-(define-static-fun length (object) :translate length)
+      (emit-label loop)
+
+      (inst beq ptr null-tn done)
+      (inst and temp ptr lowtag-mask)
+      (inst xor temp list-pointer-lowtag)
+      (inst bne temp zero-tn not-list)
+      (inst nop)
+
+      (loadw ptr ptr cons-cdr-slot list-pointer-lowtag)
+      (inst b loop)
+      (inst addu count count (fixnumize 1))
 
+      (emit-label not-list)
+      (cerror-call vop done object-not-list-error ptr)
 
+      (emit-label done)
+      (move result count))))
 
+
+(define-static-fun length (object) :translate length)