1.0.42.33: ppc: Improve pseudo-atomic implementation
authorAlastair Bridgewater <lisphacker@users.sourceforge.net>
Sun, 5 Sep 2010 17:01:01 +0000 (17:01 +0000)
committerAlastair Bridgewater <lisphacker@users.sourceforge.net>
Sun, 5 Sep 2010 17:01:01 +0000 (17:01 +0000)
  * The runtime (ppc-assem.S) used a shorter, more concise
    sequence of instructions for testing pseudo-atomic than the
    compiler (ppc/macros.lisp) did.  Altered the compiler to use
    the same sequence as the runtime.

  * Both the compiler and the runtime used magic numbers in the
    pseudo-atomic sequence instead of using named constants.
    Fixed, using the existing named constants.

src/compiler/ppc/macros.lisp
src/runtime/ppc-assem.S
version.lisp-expr

index c52d4d5..c84757d 100644 (file)
        ;; Extra debugging stuff:
        #+debug
        (progn
-         (inst andi. ,flag-tn alloc-tn 7)
+         (inst andi. ,flag-tn alloc-tn lowtag-mask)
          (inst twi :ne ,flag-tn 0))
-       (inst ori alloc-tn alloc-tn 4))
+       (inst ori alloc-tn alloc-tn pseudo-atomic-flag))
      ,@forms
      (without-scheduling ()
-       (inst li ,flag-tn -5)
-       (inst and alloc-tn alloc-tn ,flag-tn)
+       (inst subi alloc-tn alloc-tn pseudo-atomic-flag)
        ;; Now test to see if the pseudo-atomic interrupted bit is set.
-       (inst andi. ,flag-tn alloc-tn 1)
+       (inst andi. ,flag-tn alloc-tn pseudo-atomic-interrupted-flag)
        (inst twi :ne ,flag-tn 0))
      #+debug
      (progn
-       (inst andi. ,flag-tn alloc-tn 7)
+       (inst andi. ,flag-tn alloc-tn lowtag-mask)
        (inst twi :ne ,flag-tn 0))))
 
 (def!macro with-pinned-objects ((&rest objects) &body body)
index 5ecd384..a8a165c 100644 (file)
@@ -344,7 +344,7 @@ x:
 #endif
        /* Turn on pseudo-atomic */
 
-       li reg_ALLOC,4
+       li reg_ALLOC,flag_PseudoAtomic
 #if defined(LISP_FEATURE_SB_THREAD)
        stw reg_ZERO,THREAD_FOREIGN_FUNCTION_CALL_ACTIVE_OFFSET(reg_THREAD)
        lwz reg_BSP,THREAD_BINDING_STACK_POINTER_OFFSET(reg_THREAD)
@@ -364,8 +364,8 @@ x:
        add reg_ALLOC,reg_ALLOC,reg_NL4
 
        /* No longer atomic, and check for interrupt */
-       subi reg_ALLOC,reg_ALLOC,4
-       andi. reg_NL3, reg_ALLOC, 1
+       subi reg_ALLOC,reg_ALLOC,flag_PseudoAtomic
+       andi. reg_NL3, reg_ALLOC, flag_PseudoAtomicInterrupted
        twnei reg_NL3, 0
 
        /* Pass in the arguments */
@@ -407,7 +407,7 @@ lra:
        mr REG(3),reg_A0
 
        /* Turn on  pseudo-atomic */
-       la reg_ALLOC,4(reg_ALLOC)
+       la reg_ALLOC,flag_PseudoAtomic(reg_ALLOC)
 
 #if defined(LISP_FEATURE_SB_THREAD)
        /* Store lisp state */
@@ -433,8 +433,8 @@ lra:
 #endif
 
        /* Check for interrupt */
-       subi reg_ALLOC, reg_ALLOC, 4
-       andi. reg_NL3, reg_ALLOC, 1
+       subi reg_ALLOC, reg_ALLOC, flag_PseudoAtomic
+       andi. reg_NL3, reg_ALLOC, flag_PseudoAtomicInterrupted
        twnei reg_NL3,0
        
        /* Back to C */
@@ -465,7 +465,7 @@ lra:
        mr reg_NARGS,reg_NL3
 
        /* Turn on pseudo-atomic */
-       la reg_ALLOC,4(reg_ALLOC)
+       la reg_ALLOC,flag_PseudoAtomic(reg_ALLOC)
 
        /* Convert the return address to an offset and save it on the stack. */
        sub reg_NFP,reg_LIP,reg_CODE
@@ -495,8 +495,8 @@ lra:
 #endif
        /* load(reg_POLL,saver2) */
        /* Disable pseudo-atomic; check pending interrupt */
-       subi reg_ALLOC, reg_ALLOC, 4
-       andi. reg_NL3, reg_ALLOC, 1
+       subi reg_ALLOC, reg_ALLOC, flag_PseudoAtomic
+       andi. reg_NL3, reg_ALLOC, flag_PseudoAtomicInterrupted
        twnei reg_NL3, 0
 
        mr reg_NL3,reg_NARGS
@@ -542,8 +542,7 @@ lra:
        li reg_LIP,0
 
        /* Atomic ... */
-        li reg_NL3,-4        
-       li reg_ALLOC,4
+       li reg_ALLOC,flag_PseudoAtomic
 
 #if defined(LISP_FEATURE_SB_THREAD)
        /* No longer in foreign function call. */
@@ -578,8 +577,8 @@ lra:
        la reg_LIP,-OTHER_POINTER_LOWTAG(reg_LIP)
 
        /* No longer atomic */
-       subi reg_ALLOC, reg_ALLOC, 4
-       andi. reg_NL3, reg_ALLOC, 1
+       subi reg_ALLOC, reg_ALLOC, flag_PseudoAtomic
+       andi. reg_NL3, reg_ALLOC, flag_PseudoAtomicInterrupted
        twnei reg_NL3, 0
 
        mtlr reg_LIP
index 110b44e..99b1066 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.42.32"
+"1.0.42.33"