X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fassembly%2Fx86%2Falloc.lisp;h=ef7a0261d59b102fbe3a07b3d8c5e7925648b193;hb=33a45339444f8418c8c537c43d59fc3d5ea3098b;hp=65cfdb066d6e0610c785d80bed9744e0123d8991;hpb=b71ea3ac652d67b53d415378ed27da80cc90806f;p=sbcl.git diff --git a/src/assembly/x86/alloc.lisp b/src/assembly/x86/alloc.lisp index 65cfdb0..ef7a026 100644 --- a/src/assembly/x86/alloc.lisp +++ b/src/assembly/x86/alloc.lisp @@ -100,10 +100,12 @@ (inst push other) (inst push target) (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 jmp :ne get-tls-index-lock) + (let ((not-eax ,(if (eql 'eax reg) 'other 'target))) + (inst mov not-eax 1) + (inst xor eax-tn eax-tn) + (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*) + not-eax :lock) + (inst jmp :ne get-tls-index-lock)) ;; The symbol is now in OTHER. (inst pop other) ;; Now with the lock held, see if the symbol's tls index has been @@ -113,9 +115,13 @@ (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)