-
- ;; FIXME:
- ;; * We should ensure the existence of TLS index for LET-bound specials
- ;; at compile/load time, and use write a FAST-BIND for use with those.
- ;; * PROGV will need to do this, but even there this should not be inline.
- ;; This is probably best moved to C, since dynbind.c also needs to do this.
- (pseudo-atomic
- (emit-label get-tls-index-lock)
- (inst mov tls-index 1)
- (inst xor eax eax)
- (inst lock)
- (inst cmpxchg (make-ea-for-symbol-value *tls-index-lock*) tls-index)
- (inst jmp :ne get-tls-index-lock)
- ;; now with the lock held, see if the symbol's tls index has
- ;; been set in the meantime
- (loadw tls-index symbol symbol-tls-index-slot other-pointer-lowtag)
- (inst or tls-index tls-index)
- (inst jmp :ne release-tls-index-lock)
- ;; allocate a new tls-index
- (load-symbol-value tls-index *free-tls-index*)
- (inst add (make-ea-for-symbol-value *free-tls-index*) 4) ; fixnum + 1
- (storew tls-index symbol symbol-tls-index-slot other-pointer-lowtag)
- (emit-label release-tls-index-lock)
- (store-symbol-value 0 *tls-index-lock*))
-
+ (inst mov tls-index symbol)
+ (inst call (make-fixup
+ (ecase (tn-offset tls-index)
+ (#.eax-offset 'alloc-tls-index-in-eax)
+ (#.ebx-offset 'alloc-tls-index-in-ebx)
+ (#.ecx-offset 'alloc-tls-index-in-ecx)
+ (#.edx-offset 'alloc-tls-index-in-edx)
+ (#.edi-offset 'alloc-tls-index-in-edi)
+ (#.esi-offset 'alloc-tls-index-in-esi))
+ :assembly-routine))