(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
`(let ((,label (gen-label)))
- (inst or (make-ea :byte
- :base thread-base-tn
- :disp (* 8 thread-pseudo-atomic-bits-slot))
- (fixnumize 1))
- ,@forms
- (inst xor (make-ea :byte
- :base thread-base-tn
- :disp (* 8 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)
- (emit-label ,label))))
+ (inst mov (make-ea :qword
+ :base thread-base-tn
+ :disp (* 8 thread-pseudo-atomic-bits-slot))
+ rbp-tn)
+ ,@forms
+ (inst xor (make-ea :qword
+ :base thread-base-tn
+ :disp (* 8 thread-pseudo-atomic-bits-slot))
+ rbp-tn)
+ (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)
+ (emit-label ,label))))
#!-sb-thread
(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
`(let ((,label (gen-label)))
- ;; FIXME: The MAKE-EA noise should become a MACROLET macro or
- ;; something. (perhaps SVLB, for static variable low byte)
- (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 xor (make-ea :byte :disp (+ nil-value
- (static-symbol-offset
- '*pseudo-atomic-bits*)
- (ash symbol-value-slot word-shift)
- (- other-pointer-lowtag)))
- (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)
- (emit-label ,label))))
-
-
+ ;; FIXME: The MAKE-EA noise should become a MACROLET macro or
+ ;; something. (perhaps SVLB, for static variable low byte)
+ (inst mov (make-ea :qword :disp (+ nil-value
+ (static-symbol-offset
+ '*pseudo-atomic-bits*)
+ (ash symbol-value-slot word-shift)
+ (- other-pointer-lowtag)))
+ rbp-tn)
+ ,@forms
+ (inst xor (make-ea :qword :disp (+ nil-value
+ (static-symbol-offset
+ '*pseudo-atomic-bits*)
+ (ash symbol-value-slot word-shift)
+ (- other-pointer-lowtag)))
+ rbp-tn)
+ (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)
+ (emit-label ,label))))
\f
;;;; indexed references
(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
`(let ((,label (gen-label)))
- (inst or (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
- (fixnumize 1) :fs)
+ (inst mov (make-ea :dword :disp (* 4 thread-pseudo-atomic-bits-slot))
+ ebp-tn :fs)
,@forms
- (inst xor (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
- (fixnumize 1) :fs)
+ (inst xor (make-ea :dword :disp (* 4 thread-pseudo-atomic-bits-slot))
+ ebp-tn :fs)
(inst jmp :z ,label)
- ;; if PAI was set, interrupts were disabled at the same
- ;; time using the process signal mask.
+ ;; if PAI was set, interrupts were disabled at the same time
+ ;; using the process signal mask.
(inst break pending-interrupt-trap)
(emit-label ,label))))
(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
`(let ((,label (gen-label)))
- (inst or (make-ea-for-symbol-value *pseudo-atomic-bits* :byte)
- (fixnumize 1))
+ (inst mov (make-ea-for-symbol-value *pseudo-atomic-bits* :dword)
+ ebp-tn)
,@forms
- (inst xor (make-ea-for-symbol-value *pseudo-atomic-bits* :byte)
- (fixnumize 1))
+ (inst xor (make-ea-for-symbol-value *pseudo-atomic-bits* :dword)
+ ebp-tn)
(inst jmp :z ,label)
- ;; if PAI was set, interrupts were disabled at the same
- ;; time using the process signal mask.
+ ;; if PAI was set, interrupts were disabled at the same time
+ ;; using the process signal mask.
(inst break pending-interrupt-trap)
(emit-label ,label))))
\f
static inline int
get_pseudo_atomic_atomic(struct thread *thread)
{
- return fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) &
- make_fixnum(1));
+ return SymbolValue(PSEUDO_ATOMIC_BITS, thread) & (~1);
}
static inline void
set_pseudo_atomic_atomic(struct thread *thread)
{
lispobj *p = SymbolValueAddress(PSEUDO_ATOMIC_BITS, thread);
+ if (*p)
+ lose("set_pseudo_atomic_atomic: pseudo atomic bits is %d.", *p);
__asm__ __volatile__
("or" LISPOBJ_ASM_SUFFIX " %0,%1"
:
- : "g" (make_fixnum(1)), "m" (*p)
+ : "g" (~1), "m" (*p)
: "memory");
}
__asm__ __volatile__
("and" LISPOBJ_ASM_SUFFIX " %0,%1"
:
- : "g" (~make_fixnum(1)), "m" (*p)
+ : "g" (1), "m" (*p)
: "memory");
}
static inline int
get_pseudo_atomic_interrupted(struct thread *thread)
{
- return fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) &
- make_fixnum(2));
+ return SymbolValue(PSEUDO_ATOMIC_BITS, thread) & 1;
}
static inline void
set_pseudo_atomic_interrupted(struct thread *thread)
{
+ if (!get_pseudo_atomic_atomic(thread))
+ lose("set_pseudo_atomic_interrupted not in pseudo atomic");
lispobj *p = SymbolValueAddress(PSEUDO_ATOMIC_BITS, thread);
__asm__ __volatile__
("or" LISPOBJ_ASM_SUFFIX " %0,%1"
:
- : "g" (make_fixnum(2)), "m" (*p)
+ : "g" (1), "m" (*p)
: "memory");
}
static inline void
clear_pseudo_atomic_interrupted(struct thread *thread)
{
+ if (get_pseudo_atomic_atomic(thread))
+ lose("clear_pseudo_atomic_interrupted in pseudo atomic");
lispobj *p = SymbolValueAddress(PSEUDO_ATOMIC_BITS, thread);
__asm__ __volatile__
("and" LISPOBJ_ASM_SUFFIX " %0,%1"
:
- : "g" (~make_fixnum(2)), "m" (*p)
+ : "g" (~1), "m" (*p)
: "memory");
}
;;; 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.27.7"
+"1.0.27.8"