X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fppc%2Farray.lisp;h=0f66433ffc4138bb674827e4feca08bb3c533e1c;hb=96aa790ea1d70810e862665c3c8be4ce405a964c;hp=81f79c0c36a40d4d01761efbd500c49f56c6c1dc;hpb=08917ec0d00a781a1089922a5419b7f136cdf08f;p=sbcl.git diff --git a/src/compiler/ppc/array.lisp b/src/compiler/ppc/array.lisp index 81f79c0..0f66433 100644 --- a/src/compiler/ppc/array.lisp +++ b/src/compiler/ppc/array.lisp @@ -78,7 +78,7 @@ (:vop-var vop) (:save-p :compute-only) (:generator 5 - (let ((error (generate-error-code vop invalid-array-index-error + (let ((error (generate-error-code vop 'invalid-array-index-error array bound index))) (inst cmplw index bound) (inst bge error) @@ -140,6 +140,13 @@ (def-data-vector-frobs simple-array-signed-byte-32 word-index signed-num signed-reg)) +#!+compare-and-swap-vops +(define-vop (%compare-and-swap-svref word-index-cas) + (:note "inline array compare-and-swap") + (:policy :fast-safe) + (:variant vector-data-offset other-pointer-lowtag) + (:translate %compare-and-swap-svref) + (:arg-types simple-vector positive-fixnum * *)) ;;; Integer vectors whos elements are smaller than a byte. I.e. bit, 2-bit, ;;; and 4-bit vectors. @@ -551,4 +558,31 @@ (value :scs (signed-reg))) (:results (result :scs (signed-reg))) (:result-types tagged-num)) + +;;;; 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)))