Micro-optimize calling alloc_tramp on x86_64.
[sbcl.git] / src / compiler / x86-64 / call.lisp
index 9684aa5..645f745 100644 (file)
            ;; We must stop when we run out of stack args, not when we
            ;; run out of more args.
            ;; Number to copy = nargs-3
-           (inst sub rcx-tn (fixnumize register-arg-count))
+           (inst sub rbx-tn (fixnumize register-arg-count))
            ;; Everything of interest in registers.
            (inst jmp :be DO-REGS))
           (t
            ;; Number to copy = nargs-fixed
-           (inst sub rcx-tn (fixnumize fixed))))
+           (inst sub rbx-tn (fixnumize fixed))))
 
     ;; Initialize R8 to be the end of args.
     (inst lea source (make-ea :qword :base rbp-tn
 
     ;; We need to copy from downwards up to avoid overwriting some of
     ;; the yet uncopied args. So we need to use R9 as the copy index
-    ;; and RCX as the loop counter, rather than using RCX for both.
+    ;; and RBX as the loop counter, rather than using RBX for both.
     (zeroize copy-index)
 
     ;; We used to use REP MOVS here, but on modern x86 it performs
     (inst mov temp (make-ea :qword :base source :index copy-index))
     (inst mov (make-ea :qword :base rsp-tn :index copy-index) temp)
     (inst add copy-index n-word-bytes)
-    (inst sub rcx-tn (fixnumize 1))
+    (inst sub rbx-tn (fixnumize 1))
     (inst jmp :nz COPY-LOOP)
 
     DO-REGS
 
-    ;; Restore RCX
-    (inst mov rcx-tn rbx-tn)
-
     ;; Here: nargs>=1 && nargs>fixed
     (when (< fixed register-arg-count)
       ;; Now we have to deposit any more args that showed up in
                                 :disp n-word-bytes))))
 
 (define-vop (more-arg)
-    (:translate sb!c::%more-arg)
+  (:translate sb!c::%more-arg)
   (:policy :fast-safe)
   (:args (object :scs (descriptor-reg) :to (:result 1))
          (index :scs (any-reg) :to (:result 1) :target value))
       (inst lea dst (make-ea :qword :index rcx :scale (ash 2 (- word-shift n-fixnum-tag-bits))))
       (maybe-pseudo-atomic stack-allocate-p
        (allocation dst dst node stack-allocate-p list-pointer-lowtag)
-       ;; Set decrement mode (successive args at lower addresses)
-       (inst std)
        ;; Set up the result.
        (move result dst)
        ;; Jump into the middle of the loop, 'cause that's where we want
        (inst sub rcx (fixnumize 1))
        (inst jmp :nz loop)
        ;; NIL out the last cons.
-       (storew nil-value dst 1 list-pointer-lowtag)
-       (inst cld))
+       (storew nil-value dst 1 list-pointer-lowtag))
       (emit-label done))))
 
 ;;; Return the location and size of the &MORE arg glob created by