0.9.18.49:
[sbcl.git] / src / compiler / x86 / macros.lisp
index e99bf9b..c010cfd 100644 (file)
 ;;; place and there's no logical single place to attach documentation.
 ;;; grep (mostly in src/runtime) is your friend
 
-;;; FIXME: *PSEUDO-ATOMIC-FOO* could be made into *PSEUDO-ATOMIC-BITS*,
-;;; set with a single operation and cleared with SHR *PSEUDO-ATOMIC-BITS*,-2;
-;;; the ATOMIC bit is bit 0, the INTERRUPTED bit is bit 1, and you check
-;;; the C flag after the shift to see whether you were interrupted.
-;;;
 ;;; KLUDGE: since the stack on the x86 is treated conservatively, it
 ;;; does not matter whether a signal occurs during construction of a
 ;;; dynamic-extent object, as the half-finished construction of the
   (with-unique-names (label)
     `(let ((,label (gen-label)))
        (inst fs-segment-prefix)
-       (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot))
+       (inst or (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
             (fixnumize 1))
        ,@forms
        (inst fs-segment-prefix)
-       (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot)) 0)
-       (inst fs-segment-prefix)
-       (inst cmp (make-ea :byte
-                          :disp (* 4 thread-pseudo-atomic-interrupted-slot)) 0)
-       (inst jmp :eq ,label)
+       (inst xor (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
+             (fixnumize 1))
+       (inst jmp :z ,label)
        ;; if PAI was set, interrupts were disabled at the same
        ;; time using the process signal mask.
        (inst break pending-interrupt-trap)
        ;; FIXME: The MAKE-EA noise should become a MACROLET macro
        ;; or something. (perhaps SVLB, for static variable low
        ;; byte)
-       (inst mov (make-ea :byte :disp (+ nil-value
-                                         (static-symbol-offset
-                                          '*pseudo-atomic-atomic*)
-                                         (ash symbol-value-slot word-shift)
-                                         (- other-pointer-lowtag)))
+       (inst or (make-ea :byte :disp (+ nil-value
+                                        (static-symbol-offset
+                                         '*pseudo-atomic-bits*)
+                                        (ash symbol-value-slot word-shift)
+                                        (- other-pointer-lowtag)))
              (fixnumize 1))
        ,@forms
-       (inst mov (make-ea :byte :disp (+ nil-value
+       (inst xor (make-ea :byte :disp (+ nil-value
                                          (static-symbol-offset
-                                          '*pseudo-atomic-atomic*)
+                                          '*pseudo-atomic-bits*)
                                          (ash symbol-value-slot word-shift)
                                          (- other-pointer-lowtag)))
-             0)
-       (inst cmp (make-ea :byte
-                          :disp (+ nil-value
-                                   (static-symbol-offset
-                                    '*pseudo-atomic-interrupted*)
-                                   (ash symbol-value-slot word-shift)
-                                   (- other-pointer-lowtag)))
-             0)
-       (inst jmp :eq ,label)
+             (fixnumize 1))
+       (inst jmp :z ,label)
        ;; if PAI was set, interrupts were disabled at the same
        ;; time using the process signal mask.
        (inst break pending-interrupt-trap)