(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
`(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
(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)
#!+(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))
(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)))
;;; 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"