Changeset 7191


Ignore:
Timestamp:
Sep 11, 2007, 11:11:22 AM (12 years ago)
Author:
gb
Message:

No more %TRY-READ-LOCK-RWLOCK.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0709/ccl/level-0/PPC/ppc-misc.lisp

    r7028 r7191  
    551551  (blr))
    552552
    553 ;;; Return true iff we were able to increment a non-negative
    554 ;;; lock._value
    555 (defppclapfunction %try-read-lock-rwlock ((lock arg_z))
    556   (check-nargs 1)
    557   (li imm1 target::lock._value)
    558   @try
    559   (lrarx imm0 lock imm1)
    560   (cmpri imm0 0)
    561   (blt @fail)                           ; locked for writing
    562   (addi imm0 imm0 '1)
    563   (strcx. imm0 lock imm1)
    564   (bne @try)                            ; lost reservation, try again
    565   (isync)
    566   (blr)                                 ; return the lock
    567 @fail
    568   (li imm0 target::reservation-discharge)
    569   (strcx. rzero rzero imm0)
    570   (li arg_z nil)
    571   (blr))
    572 
    573 
    574 
    575 (defppclapfunction unlock-rwlock ((lock arg_z))
    576   (ldr imm2 target::lock._value lock)
    577   (cmpri imm2 0)
    578   (li imm1 target::lock._value)
    579   (ble @unlock-write)
    580   @unlock-read
    581   (lrarx imm0 lock imm1)
    582   (subi imm0 imm0 '1)
    583   (strcx. imm0 lock imm1)
    584   (bne @unlock-read)
    585   (isync)
    586   (blr)
    587   @unlock-write
    588   ;;; If we aren't the writer, return NIL.
    589   ;;; If we are and the value's about to go to 0, clear the writer field.
    590   (ldr imm0 target::lock.writer lock)
    591   (cmpr imm0 target::rcontext)
    592   (ldrx imm0 lock imm1)
    593   (cmpri cr1 imm0 '-1)
    594   (addi imm0 imm0 '1)
    595   (bne @fail)
    596   (bne cr1 @noclear)
    597   (str rzero target::lock.writer lock)
    598   @noclear
    599   (str imm0 target::lock._value lock)
    600   (blr)
    601   @fail
    602   (li arg_z nil)
    603   (blr))
     553
    604554
    605555(defppclapfunction %atomic-incf-node ((by arg_x) (node arg_y) (disp arg_z))
Note: See TracChangeset for help on using the changeset viewer.