(emit-label get-tls-index-lock)
(inst mov target 1)
(zeroize rax-tn)
- (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*) target :lock)
+ (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*)
+ target :lock)
(inst jmp :ne get-tls-index-lock)
;; The symbol is now in OTHER.
(inst pop other)
(inst jmp :ne release-tls-index-lock)
;; Allocate a new tls-index.
(load-symbol-value target *free-tls-index*)
- (let ((error (generate-error-code nil 'tls-exhausted-error)))
+ (let ((not-error (gen-label))
+ (error (generate-error-code nil 'tls-exhausted-error)))
(inst cmp target (fixnumize tls-size))
- (inst jmp :ge error))
+ (inst jmp :l not-error)
+ (%clear-pseudo-atomic)
+ (inst jmp error)
+ (emit-label not-error))
(inst add (make-ea-for-symbol-value *free-tls-index*)
(fixnumize 1))
(storew target other symbol-tls-index-slot other-pointer-lowtag)
(emit-label get-tls-index-lock)
(inst mov target 1)
(inst xor eax-tn eax-tn)
- (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*) target :lock)
+ (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*)
+ target :lock)
(inst jmp :ne get-tls-index-lock)
;; The symbol is now in OTHER.
(inst pop other)
(inst jmp :ne release-tls-index-lock)
;; Allocate a new tls-index.
(load-symbol-value target *free-tls-index*)
- (let ((error (generate-error-code nil 'tls-exhausted-error)))
+ (let ((not-error (gen-label))
+ (error (generate-error-code nil 'tls-exhausted-error)))
(inst cmp target (fixnumize tls-size))
- (inst jmp :ge error))
+ (inst jmp :l not-error)
+ (%clear-pseudo-atomic)
+ (inst jmp error)
+ (emit-label not-error))
(inst add (make-ea-for-symbol-value *free-tls-index*)
(fixnumize 1))
(storew target other symbol-tls-index-slot other-pointer-lowtag)
(progn ,@body)
(pseudo-atomic ,@body)))
+;;; Unsafely clear pa flags so that the image can properly lose in a
+;;; pa section.
+#!+sb-thread
+(defmacro %clear-pseudo-atomic ()
+ '(inst mov (make-ea :qword :base thread-base-tn
+ :disp (* 8 thread-pseudo-atomic-bits-slot))
+ 0))
+
#!+sb-thread
(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
(progn ,@forms)
(pseudo-atomic ,@forms)))
+;;; Unsafely clear pa flags so that the image can properly lose in a
+;;; pa section.
+#!+sb-thread
+(defmacro %clear-pseudo-atomic ()
+ '(inst mov (make-ea :dword :disp (* 4 thread-pseudo-atomic-bits-slot)) 0 :fs))
+
#!+sb-thread
(defmacro pseudo-atomic (&rest forms)
(with-unique-names (label)
;;; 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.33.10"
+"1.0.33.11"