(load-symbol-value target *free-tls-index*)
(let ((not-error (gen-label))
(error (generate-error-code nil 'tls-exhausted-error)))
- (inst cmp target (fixnumize tls-size))
+ (inst cmp target (ash tls-size word-shift))
(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))
+ n-word-bytes)
(storew target other symbol-tls-index-slot other-pointer-lowtag)
(emit-label release-tls-index-lock)
;; No need for barriers on x86/x86-64 on unlock.
(load-symbol-value target *free-tls-index*)
(let ((not-error (gen-label))
(error (generate-error-code nil 'tls-exhausted-error)))
- (inst cmp target (fixnumize tls-size))
+ (inst cmp target (ash tls-size word-shift))
(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))
+ n-word-bytes)
(storew target other symbol-tls-index-slot other-pointer-lowtag)
(emit-label release-tls-index-lock)
;; No need for barriers on x86/x86-64 on unlock.
(loop
(if (thread-alive-p thread)
(let* ((epoch sb!kernel::*gc-epoch*)
- (offset (* sb!vm:n-word-bytes
- (sb!vm::symbol-tls-index symbol)))
+ (offset (sb!kernel:get-lisp-obj-address
+ (sb!vm::symbol-tls-index symbol)))
(tl-val (sap-ref-word (%thread-sap thread) offset)))
(cond ((zerop offset)
(return (values nil :no-tls-value)))
;; area...
(with-all-threads-lock
(if (thread-alive-p thread)
- (let ((offset (* sb!vm:n-word-bytes
- (sb!vm::symbol-tls-index symbol))))
+ (let ((offset (sb!kernel:get-lisp-obj-address
+ (sb!vm::symbol-tls-index symbol))))
(cond ((zerop offset)
(values nil :no-tls-value))
(t
get_spinlock(tls_index_lock,(long)th);
if(!sym->tls_index) {
sym->tls_index=SymbolValue(FREE_TLS_INDEX,0);
- SetSymbolValue(FREE_TLS_INDEX,
- make_fixnum(fixnum_value(sym->tls_index)+1),0);
- if(fixnum_value(sym->tls_index)>=TLS_SIZE) {
+ SetSymbolValue(FREE_TLS_INDEX, sym->tls_index+N_WORD_BYTES, 0);
+ if((sym->tls_index)>=(TLS_SIZE << WORD_SHIFT)) {
lose("Thread local storage exhausted.");
}
}
scavenge((lispobj *) th->binding_stack_start,len);
#ifdef LISP_FEATURE_SB_THREAD
/* do the tls as well */
- len=fixnum_value(SymbolValue(FREE_TLS_INDEX,0)) -
+ len=(SymbolValue(FREE_TLS_INDEX,0) >> WORD_SHIFT) -
(sizeof (struct thread))/(sizeof (lispobj));
scavenge((lispobj *) (th+1),len);
#endif
per_thread->dynamic_values[i] = NO_TLS_VALUE_MARKER_WIDETAG;
if (all_threads == 0) {
if(SymbolValue(FREE_TLS_INDEX,0)==UNBOUND_MARKER_WIDETAG) {
- SetSymbolValue(FREE_TLS_INDEX,make_fixnum(tls_index_start),0);
+ SetSymbolValue(FREE_TLS_INDEX,tls_index_start << WORD_SHIFT,0);
SetSymbolValue(TLS_INDEX_LOCK,make_fixnum(0),0);
}
#define STATIC_TLS_INIT(sym,field) \
((struct symbol *)(sym-OTHER_POINTER_LOWTAG))->tls_index= \
- make_fixnum(THREAD_SLOT_OFFSET_WORDS(field))
+ (THREAD_SLOT_OFFSET_WORDS(field) << WORD_SHIFT)
STATIC_TLS_INIT(BINDING_STACK_START,binding_stack_start);
#ifdef BINDING_STACK_POINTER
#ifdef LISP_FEATURE_SB_THREAD
if(thread && sym->tls_index) {
lispobj *r = &(((union per_thread_data *)thread)
- ->dynamic_values[fixnum_value(sym->tls_index)]);
+ ->dynamic_values[(sym->tls_index) >> WORD_SHIFT]);
if((*r)!=NO_TLS_VALUE_MARKER_WIDETAG) return r;
}
#endif
if(thread && sym->tls_index) {
lispobj r=
((union per_thread_data *)thread)
- ->dynamic_values[fixnum_value(sym->tls_index)];
+ ->dynamic_values[(sym->tls_index) >> WORD_SHIFT];
if(r!=NO_TLS_VALUE_MARKER_WIDETAG) return r;
}
#endif
(pointer_sized_uint_t)(tagged_symbol_pointer-OTHER_POINTER_LOWTAG);
#ifdef LISP_FEATURE_SB_THREAD
return ((union per_thread_data *)thread)
- ->dynamic_values[fixnum_value(sym->tls_index)];
+ ->dynamic_values[(sym->tls_index) >> WORD_SHIFT];
#else
return sym->value;
#endif
#ifdef LISP_FEATURE_SB_THREAD
if(thread && sym->tls_index) {
lispobj *pr= &(((union per_thread_data *)thread)
- ->dynamic_values[fixnum_value(sym->tls_index)]);
+ ->dynamic_values[(sym->tls_index) >> WORD_SHIFT]);
if(*pr!=NO_TLS_VALUE_MARKER_WIDETAG) {
*pr=val;
return;
struct symbol *sym= (struct symbol *)
(pointer_sized_uint_t)(tagged_symbol_pointer-OTHER_POINTER_LOWTAG);
((union per_thread_data *)thread)
- ->dynamic_values[fixnum_value(sym->tls_index)]
+ ->dynamic_values[(sym->tls_index) >> WORD_SHIFT]
=val;
#else
SetSymbolValue(tagged_symbol_pointer,val,thread) ;