X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fppc%2Fmemory.lisp;h=ad195d11cff58dfa65b154ceccc0080b87d592b9;hb=5d3a728a1d9a91e7218fe53f12f96ab63b846810;hp=1f593e43ac82f23c85df91cb31df6cd746d5d819;hpb=52cfe54802db8736f1f4e2b67764c43bba9b78b3;p=sbcl.git diff --git a/src/compiler/ppc/memory.lisp b/src/compiler/ppc/memory.lisp index 1f593e4..ad195d1 100644 --- a/src/compiler/ppc/memory.lisp +++ b/src/compiler/ppc/memory.lisp @@ -104,3 +104,39 @@ (define-indexer signed-byte-index-ref nil lbz lbzx 2 t) (define-indexer byte-index-set t stb stbx 2) +#!+compare-and-swap-vops +(define-vop (word-index-cas) + (:args (object :scs (descriptor-reg)) + (index :scs (any-reg zero immediate)) + (old-value :scs (any-reg descriptor-reg)) + (new-value :scs (any-reg descriptor-reg))) + (:arg-types * tagged-num * *) + (:temporary (:sc non-descriptor-reg) temp) + (:results (result :scs (any-reg descriptor-reg) :from :load)) + (:result-types *) + (:variant-vars offset lowtag) + (:policy :fast-safe) + (:generator 5 + (sc-case index + ((immediate zero) + (let ((offset (- (+ (if (sc-is index zero) + 0 + (ash (tn-value index) word-shift)) + (ash offset word-shift)) + lowtag))) + (inst lr temp offset))) + (t + ;; KLUDGE: This relies on N-FIXNUM-TAG-BITS being the same as + ;; WORD-SHIFT. I know better than to do this. --AB, 2010-Jun-16 + (inst addi temp index + (- (ash offset word-shift) lowtag)))) + + (inst sync) + LOOP + (inst lwarx result temp object) + (inst cmpw result old-value) + (inst bne EXIT) + (inst stwcx. new-value temp object) + (inst bne LOOP) + EXIT + (inst isync)))