1.0.4.70: more x86 backend cleanups
authorlisphacker <lisphacker>
Thu, 12 Apr 2007 02:28:52 +0000 (02:28 +0000)
committerlisphacker <lisphacker>
Thu, 12 Apr 2007 02:28:52 +0000 (02:28 +0000)
  * Use make-ea-for-FOO macros instead of make-ea with complex
    displacement in many places.

src/compiler/x86/arith.lisp
src/compiler/x86/array.lisp
src/compiler/x86/c-call.lisp
src/compiler/x86/call.lisp
src/compiler/x86/cell.lisp
src/compiler/x86/float.lisp
src/compiler/x86/memory.lisp
src/compiler/x86/system.lisp
version.lisp-expr

index ad66b62..fc8651c 100644 (file)
   (:results (y :scs (unsigned-reg) :from (:eval 0)))
   (:result-types unsigned-num)
   (:generator 50
-    (inst mov k (make-ea :dword :base state
-                         :disp (- (* (+ 2 vector-data-offset)
-                                     n-word-bytes)
-                                  other-pointer-lowtag)))
+    (loadw k state (+ 2 vector-data-offset) other-pointer-lowtag)
     (inst cmp k 624)
     (inst jmp :ne no-update)
     (inst mov tmp state)        ; The state is passed in EAX.
     (inst mov tmp y)
     (inst inc k)
     (inst shl tmp 7)
-    (inst mov (make-ea :dword :base state
-                       :disp (- (* (+ 2 vector-data-offset)
-                                   n-word-bytes)
-                                other-pointer-lowtag))
-          k)
+    (storew k state (+ 2 vector-data-offset) other-pointer-lowtag)
     (inst and tmp #x9d2c5680)
     (inst xor y tmp)
     ;; y ^= (y << 15) & #xefc60000
index 3926463..b0df555 100644 (file)
          (:temporary (:sc unsigned-reg :to (:result 0)) old)
          (:generator 20
            (multiple-value-bind (word extra) (floor index ,elements-per-word)
-             (inst mov old
-                   (make-ea :dword :base object
-                            :disp (- (* (+ word vector-data-offset)
-                                        n-word-bytes)
-                                     other-pointer-lowtag)))
+             (loadw old object (+ word vector-data-offset) other-pointer-lowtag)
              (sc-case value
                (immediate
                 (let* ((value (tn-value value))
                   (inst or old value)
                   (unless (zerop shift)
                     (inst rol old shift)))))
-             (inst mov (make-ea :dword :base object
-                                :disp (- (* (+ word vector-data-offset)
-                                            n-word-bytes)
-                                         other-pointer-lowtag))
-                   old)
+             (storew old object (+ word vector-data-offset) other-pointer-lowtag)
              (sc-case value
                (immediate
                 (inst mov result (tn-value value)))
index c07deae..ae4a9b6 100644 (file)
     (unless (zerop amount)
       (let ((delta (logandc2 (+ amount 3) 3)))
         (inst mov temp
-              (make-ea :dword
-                       :disp (+ nil-value
-                                (static-symbol-offset '*alien-stack*)
-                                (ash symbol-tls-index-slot word-shift)
-                                (- other-pointer-lowtag))))
+              (make-ea-for-symbol-tls-index *alien-stack*))
         (inst fs-segment-prefix)
         (inst sub (make-ea :dword :base temp) delta)))
     (load-tl-symbol-value result *alien-stack*))
     (aver (not (location= result esp-tn)))
     (unless (zerop amount)
       (let ((delta (logandc2 (+ amount 3) 3)))
-        (inst sub (make-ea :dword
-                           :disp (+ nil-value
-                                    (static-symbol-offset '*alien-stack*)
-                                    (ash symbol-value-slot word-shift)
-                                    (- other-pointer-lowtag)))
+        (inst sub (make-ea-for-symbol-value *alien-stack*)
               delta)))
     (load-symbol-value result *alien-stack*)))
 
     (unless (zerop amount)
       (let ((delta (logandc2 (+ amount 3) 3)))
         (inst mov temp
-              (make-ea :dword
-                       :disp (+ nil-value
-                                (static-symbol-offset '*alien-stack*)
-                                (ash symbol-tls-index-slot word-shift)
-                                (- other-pointer-lowtag))))
+              (make-ea-for-symbol-tls-index *alien-stack*))
         (inst fs-segment-prefix)
         (inst add (make-ea :dword :base temp) delta))))
   #!-sb-thread
   (:generator 0
     (unless (zerop amount)
       (let ((delta (logandc2 (+ amount 3) 3)))
-        (inst add (make-ea :dword
-                           :disp (+ nil-value
-                                    (static-symbol-offset '*alien-stack*)
-                                    (ash symbol-value-slot word-shift)
-                                    (- other-pointer-lowtag)))
+        (inst add (make-ea-for-symbol-value *alien-stack*)
               delta)))))
 
 ;;; these are not strictly part of the c-call convention, but are
index 85d4452..6bd5775 100644 (file)
                (note-this-location vop :call-site)
 
                (inst ,(if (eq return :tail) 'jmp 'call)
-                     (make-ea :dword :base eax
-                              :disp ,(if named
-                                         '(- (* fdefn-raw-addr-slot
-                                                n-word-bytes)
-                                             other-pointer-lowtag)
-                                       '(- (* closure-fun-slot n-word-bytes)
-                                           fun-pointer-lowtag))))
+                     ,(if named
+                          '(make-ea-for-object-slot eax fdefn-raw-addr-slot
+                                                    other-pointer-lowtag)
+                          '(make-ea-for-object-slot eax closure-fun-slot
+                                                    fun-pointer-lowtag)))
                ,@(ecase return
                    (:fixed
                     '((default-unknown-values vop values nvals)))
                        :disp (* thread-stepping-slot n-word-bytes))
           nil-value))
   #!-sb-thread
-  (inst cmp (make-ea :dword
-                     :disp (+ nil-value (static-symbol-offset
-                                         'sb!impl::*stepping*)
-                              (* symbol-value-slot n-word-bytes)
-                              (- other-pointer-lowtag)))
+  (inst cmp (make-ea-for-symbol-value sb!impl::*stepping*)
         nil-value))
 
 (define-vop (step-instrument-before-vop)
index 5a549f5..d1bc473 100644 (file)
   (:generator 4
     (move result value)
     (inst lock)
-    (inst add (make-ea :dword :base object
-                       :disp (- (* symbol-value-slot n-word-bytes)
-                                other-pointer-lowtag))
+    (inst add (make-ea-for-object-slot object symbol-value-slot
+                                       other-pointer-lowtag)
           value)))
 
 #!+sb-thread
   (:generator 38
     (load-type type function (- fun-pointer-lowtag))
     (inst lea raw
-          (make-ea :byte :base function
-                   :disp (- (* simple-fun-code-offset n-word-bytes)
-                            fun-pointer-lowtag)))
+          (make-ea-for-object-slot function simple-fun-code-offset
+                                   fun-pointer-lowtag))
     (inst cmp type simple-fun-header-widetag)
     (inst jmp :e normal-fn)
     (inst lea raw (make-fixup "closure_tramp" :foreign))
index cd2c3ba..fd69f80 100644 (file)
 (in-package "SB!VM")
 \f
 (macrolet ((ea-for-xf-desc (tn slot)
-             `(make-ea
-               :dword :base ,tn
-               :disp (- (* ,slot n-word-bytes)
-                        other-pointer-lowtag))))
+             `(make-ea-for-object-slot ,tn ,slot other-pointer-lowtag)))
   (defun ea-for-sf-desc (tn)
     (ea-for-xf-desc tn single-float-value-slot))
   (defun ea-for-df-desc (tn)
                        :disp (frame-byte-offset (tn-offset temp)))))
        (descriptor-reg
         (inst movsx exp-bits
-              (make-ea :word :base float
-                       :disp (- (* (+ 2 long-float-value-slot)
-                                   n-word-bytes)
-                                other-pointer-lowtag)))))))
+              (make-ea-for-object-slot float (+ 2 long-float-value-slot)
+                                       other-pointer-lowtag :word))))))
 
 #!+long-float
 (define-vop (long-float-high-bits)
index 6f5ef02..2d89272 100644 (file)
@@ -78,8 +78,7 @@
   (:policy :fast-safe)
   (:generator 4
     (move result value)
-    (inst xadd (make-ea :dword :base object
-                        :disp (- (* offset n-word-bytes) lowtag))
+    (inst xadd (make-ea-for-object-slot object offset lowtag)
           value)))
 
 ;;; SLOT-REF and SLOT-SET are used to define VOPs like CLOSURE-REF,
          (let ((val (tn-value value)))
            (etypecase val
              (integer
-              (inst mov
-                    (make-ea :dword :base object
-                             :disp (- (* (+ base offset) n-word-bytes) lowtag))
-                    (fixnumize val)))
+              (storew (fixnumize val)
+                      object (+ base offset) lowtag))
              (symbol
-              (inst mov
-                    (make-ea :dword :base object
-                             :disp (- (* (+ base offset) n-word-bytes) lowtag))
-                    (+ nil-value (static-symbol-offset val))))
+              (storew (+ nil-value (static-symbol-offset val))
+                      object (+ base offset) lowtag))
              (character
-              (inst mov
-                    (make-ea :dword :base object
-                             :disp (- (* (+ base offset) n-word-bytes) lowtag))
-                    (logior (ash (char-code val) n-widetag-bits)
-                            character-widetag)))))
+              (storew (logior (ash (char-code val) n-widetag-bits)
+                              character-widetag)
+                      object (+ base offset) lowtag))))
          ;; Else, value not immediate.
          (storew value object (+ base offset) lowtag))))
 
   (:generator 4
     (move eax old-value)
     (move temp new-value)
-    (inst cmpxchg (make-ea :dword :base object
-                           :disp (- (* (+ base offset) n-word-bytes) lowtag))
+    (inst cmpxchg (make-ea-for-object-slot object (+ base offset) lowtag)
           temp)
     (move result eax)))
 
   (:info offset)
   (:generator 4
     (move result value)
-    (inst xadd (make-ea :dword :base object
-                        :disp (- (* (+ base offset) n-word-bytes) lowtag))
+    (inst xadd (make-ea-for-object-slot object (+ base offset) lowtag)
           value)))
index 67bf3a3..f3a65a3 100644 (file)
   (:args (count-vector :scs (descriptor-reg)))
   (:info index)
   (:generator 0
-    (inst inc (make-ea :dword :base count-vector
-                       :disp (- (* (+ vector-data-offset index) n-word-bytes)
-                                other-pointer-lowtag)))))
+    (inst inc (make-ea-for-object-slot count-vector
+                                       (+ vector-data-offset index)
+                                       other-pointer-lowtag))))
index 33d2cb4..2897c50 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.4.69"
+"1.0.4.70"