1.0.43.33: ppc: Implement %ARRAY-ATOMIC-INCF/WORD
authorAlastair Bridgewater <lisphacker@users.sourceforge.net>
Thu, 7 Oct 2010 16:37:10 +0000 (16:37 +0000)
committerAlastair Bridgewater <lisphacker@users.sourceforge.net>
Thu, 7 Oct 2010 16:37:10 +0000 (16:37 +0000)
  * Implement new VOP ARRAY-ATOMIC-INCF/WORD

  * Add ppc to the appropriate reader coditionals to
enable use of the new VOP.

package-data-list.lisp-expr
src/code/late-extensions.lisp
src/compiler/generic/vm-fndb.lisp
src/compiler/ppc/array.lisp
version.lisp-expr

index 397a658..5873842 100644 (file)
@@ -1223,7 +1223,7 @@ is a good idea, but see SB-SYS re. blurring of boundaries."
                "%ARRAY-DISPLACED-FROM"
                "%ARRAY-DISPLACEMENT" "%ARRAY-FILL-POINTER"
                "%ARRAY-FILL-POINTER-P" "%ARRAY-RANK"
-               #!+(or x86 x86-64)
+               #!+(or x86 x86-64 ppc)
                "%ARRAY-ATOMIC-INCF/WORD"
                "%ASSOC"
                "%ASSOC-EQ"
index 0903f52..5d2d598 100644 (file)
@@ -177,7 +177,7 @@ EXPERIMENTAL: Interface subject to change."
         (aref
          (when (cddr args)
            (invalid-place))
-         #!+(or x86 x86-64)
+         #!+(or x86 x86-64 ppc)
          (with-unique-names (array)
            `(let ((,array (the (simple-array sb!ext:word (*)) ,(car args))))
               (%array-atomic-incf/word
@@ -189,7 +189,7 @@ EXPERIMENTAL: Interface subject to change."
                                 `(the sb!vm:signed-word ,diff))
                                (atomic-decf
                                 `(- (the sb!vm:signed-word ,diff))))))))
-         #!-(or x86 x86-64)
+         #!-(or x86 x86-64 ppc)
          (with-unique-names (array index old-value)
            (let ((incremented-value
                   (ecase name
@@ -289,7 +289,7 @@ EXPERIMENTAL: Interface subject to change."
   (expand-atomic-frob 'atomic-decf place diff))
 
 ;; Interpreter stubs for ATOMIC-INCF.
-#!+(or x86 x86-64)
+#!+(or x86 x86-64 ppc)
 (defun %array-atomic-incf/word (array index diff)
   (declare (type (simple-array word (*)) array)
            (fixnum index)
index 59608a9..e608152 100644 (file)
 #!+(or x86 x86-64 ppc)
 (defknown %raw-instance-atomic-incf/word (instance index sb!vm:word) sb!vm:word
     (unsafe always-translatable))
-#!+(or x86 x86-64)
+#!+(or x86 x86-64 ppc)
 (defknown %array-atomic-incf/word (t index sb!vm:word) sb!vm:word
   (unsafe always-translatable))
 
index 37cf6ea..0f66433 100644 (file)
          (value :scs (signed-reg)))
   (:results (result :scs (signed-reg)))
   (:result-types tagged-num))
+\f
+;;;; ATOMIC-INCF for arrays
 
+(define-vop (array-atomic-incf/word)
+  (:translate %array-atomic-incf/word)
+  (:policy :fast-safe)
+  (:args (object :scs (descriptor-reg))
+         (index :scs (any-reg) :target offset)
+         (diff :scs (unsigned-reg)))
+  (:arg-types * positive-fixnum unsigned-num)
+  (:results (result :scs (unsigned-reg) :from :load))
+  (:result-types unsigned-num)
+  (:temporary (:sc unsigned-reg :from (:argument 1)) offset)
+  (:temporary (:sc non-descriptor-reg) sum)
+  (:generator 4
+    (inst addi offset index
+          (- (* vector-data-offset n-word-bytes)
+             other-pointer-lowtag))
+    ;; load the slot value, add DIFF, write the sum back, and return
+    ;; the original slot value, atomically, and include a memory
+    ;; barrier.
+    (inst sync)
+    LOOP
+    (inst lwarx result offset object)
+    (inst add sum result diff)
+    (inst stwcx. sum offset object)
+    (inst bne LOOP)
+    (inst isync)))
index 613ccfb..b0f1c21 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.43.32"
+"1.0.43.33"