From 1600081cf1b71b3d0e2e40de1c1c124a3a4fd40c Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 13 Sep 2006 17:30:28 +0000 Subject: [PATCH] 0.9.16.28: Shorten pseudo-atomic sequence on x86 and x86-64. Do this by combining *pseudo-atomic-{atomic,interrupted}* into a single variable, *pseudo-atomic-bits*, which is a fixnum bitmask where bit 0 denotes atomic-ness and bit 1 denotes interruptedness. * Change genesis to initialize this variable properly (this didn't need to be done for the old variables because the allocation sequences would set them upon entrance); * Modify functions and macros accessing pseudo-atomic variables to reflect the new state of the world; --- package-data-list.lisp-expr | 3 +- src/code/early-fasl.lisp | 3 +- src/code/early-impl.lisp | 3 +- src/code/toplevel.lisp | 3 +- src/compiler/generic/genesis.lisp | 8 +++- src/compiler/generic/objdef.lisp | 3 +- src/compiler/x86-64/macros.lisp | 46 +++++++------------- src/compiler/x86-64/parms.lisp | 3 +- src/compiler/x86/macros.lisp | 40 ++++++------------ src/compiler/x86/parms.lisp | 3 +- src/runtime/dynbind.c | 9 ++-- src/runtime/gc.h | 50 +--------------------- src/runtime/pseudo-atomic.h | 83 +++++++++++++++++++++++++++++++++++++ src/runtime/thread.c | 9 ++-- src/runtime/x86-64-arch.c | 10 ++--- src/runtime/x86-arch.c | 10 ++--- tests/threads.impure.lisp | 3 +- version.lisp-expr | 2 +- 18 files changed, 149 insertions(+), 142 deletions(-) create mode 100644 src/runtime/pseudo-atomic.h diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index e9d850b..9a00ffa 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -1395,8 +1395,7 @@ is a good idea, but see SB-SYS re. blurring of boundaries." "PACKAGE-INTERNAL-SYMBOLS" "PACKAGE-EXTERNAL-SYMBOLS" "PARSE-DEFMACRO" "PARSE-UNKNOWN-TYPE" "PARSE-UNKNOWN-TYPE-SPECIFIER" "PATHNAME-DESIGNATOR" - #!+(or x86 x86-64) "*PSEUDO-ATOMIC-ATOMIC*" - #!+(or x86 x86-64) "*PSEUDO-ATOMIC-INTERRUPTED*" + #!+(or x86 x86-64) "*PSEUDO-ATOMIC-BITS*" "PUNT-PRINT-IF-TOO-LONG" "READER-IMPOSSIBLE-NUMBER-ERROR" "READER-PACKAGE-ERROR" "READER-EOF-ERROR" "RESTART-DESIGNATOR" diff --git a/src/code/early-fasl.lisp b/src/code/early-fasl.lisp index 3a4f6e0..401d208 100644 --- a/src/code/early-fasl.lisp +++ b/src/code/early-fasl.lisp @@ -76,7 +76,7 @@ ;;; versions which break binary compatibility. But it certainly should ;;; be incremented for release versions which break binary ;;; compatibility. -(def!constant +fasl-file-version+ 69) +(def!constant +fasl-file-version+ 70) ;;; (record of versions before 2003 deleted in 2003-04-26/0.pre8.107 or so) ;;; 38: (2003-01-05) changed names of internal SORT machinery ;;; 39: (2003-02-20) in 0.7.12.1 a slot was added to @@ -140,6 +140,7 @@ ;;; 0.9.14.something ;;; 68: (2006-08-14) changed number of arguments of LOAD-DEFMETHOD ;;; 69: (2006-08-17) changed validity of various initargs for methods +;;; 70: (2006-09-13) changes to *PSEUDO-ATOMIC* on x86 and x86-64 ;;; the conventional file extension for our fasl files (declaim (type simple-string *fasl-file-type*)) diff --git a/src/code/early-impl.lisp b/src/code/early-impl.lisp index 6009653..071a1b6 100644 --- a/src/code/early-impl.lisp +++ b/src/code/early-impl.lisp @@ -33,8 +33,7 @@ ;; :X86. (Note that non-X86 ports mention ;; pseudo-atomicity too, but they handle it without ;; messing with special variables.) - #!+(or x86 x86-64) *pseudo-atomic-atomic* - #!+(or x86 x86-64) *pseudo-atomic-interrupted* + #!+(or x86 x86-64) *pseudo-atomic-bits* sb!unix::*interrupts-enabled* sb!unix::*interrupt-pending* *free-interrupt-context-index* diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp index 883c7f8..17ff6e8 100644 --- a/src/code/toplevel.lisp +++ b/src/code/toplevel.lisp @@ -25,8 +25,7 @@ ;;; specials initialized by !COLD-INIT ;;; FIXME: These could be converted to DEFVARs. -(declaim (special #!+(or x86 x86-64) *pseudo-atomic-atomic* - #!+(or x86 x86-64) *pseudo-atomic-interrupted* +(declaim (special #!+(or x86 x86-64) *pseudo-atomic-bits* sb!unix::*interrupts-enabled* sb!unix::*interrupt-pending* *type-system-initialized*)) diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index bd77bbb..1e3ed36 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -1223,7 +1223,13 @@ core and return a descriptor to it." offset-wanted)))) ;; Establish the value of T. (let ((t-symbol (cold-intern t))) - (cold-set t-symbol t-symbol)))) + (cold-set t-symbol t-symbol)) + ;; Establish the value of *PSEUDO-ATOMIC-BITS* so that the + ;; allocation sequences that expect it to be zero upon entrance + ;; actually find it to be so. + #!+(or x86-64 x86) + (let ((p-a-a-symbol (cold-intern 'sb!kernel:*pseudo-atomic-bits*))) + (cold-set p-a-a-symbol (make-fixnum-descriptor 0))))) ;;; a helper function for FINISH-SYMBOLS: Return a cold alist suitable ;;; to be stored in *!INITIAL-LAYOUTS*. diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp index 5a637c3..b013c6a 100644 --- a/src/compiler/generic/objdef.lisp +++ b/src/compiler/generic/objdef.lisp @@ -435,8 +435,7 @@ ;; starting, running, suspended, dead (state :c-type "volatile lispobj") (tls-cookie) ; on x86, the LDT index - #!+(or x86 x86-64) (pseudo-atomic-atomic) - #!+(or x86 x86-64) (pseudo-atomic-interrupted) + #!+(or x86 x86-64) (pseudo-atomic-bits) (interrupt-data :c-type "struct interrupt_data *" :length #!+alpha 2 #!-alpha 1) (interrupt-contexts :c-type "os_context_t *" :rest-p t)) diff --git a/src/compiler/x86-64/macros.lisp b/src/compiler/x86-64/macros.lisp index eeb35c1..1152889 100644 --- a/src/compiler/x86-64/macros.lisp +++ b/src/compiler/x86-64/macros.lisp @@ -290,11 +290,6 @@ ;;; place and there's no logical single place to attach documentation. ;;; grep (mostly in src/runtime) is your friend -;;; FIXME: *PSEUDO-ATOMIC-FOO* could be made into *PSEUDO-ATOMIC-BITS*, -;;; set with a single operation and cleared with SHR *PSEUDO-ATOMIC-BITS*,-2; -;;; the ATOMIC bit is bit 0, the INTERRUPTED bit is bit 1, and you check -;;; the C flag after the shift to see whether you were interrupted. - ;;; FIXME: THIS NAME IS BACKWARDS! (defmacro maybe-pseudo-atomic (really-p &body body) `(if ,really-p @@ -305,18 +300,16 @@ (defmacro pseudo-atomic (&rest forms) (with-unique-names (label) `(let ((,label (gen-label))) - (inst mov (make-ea :byte + (inst or (make-ea :byte :base thread-base-tn - :disp (* 8 thread-pseudo-atomic-atomic-slot)) + :disp (* 8 thread-pseudo-atomic-bits-slot)) (fixnumize 1)) ,@forms - (inst mov (make-ea :byte - :base thread-base-tn - :disp (* 8 thread-pseudo-atomic-atomic-slot)) 0) - (inst cmp (make-ea :byte + (inst xor (make-ea :byte :base thread-base-tn - :disp (* 8 thread-pseudo-atomic-interrupted-slot)) 0) - (inst jmp :eq ,label) + :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) @@ -329,27 +322,20 @@ `(let ((,label (gen-label))) ;; FIXME: The MAKE-EA noise should become a MACROLET macro or ;; something. (perhaps SVLB, for static variable low byte) - (inst mov (make-ea :byte :disp (+ nil-value - (static-symbol-offset - '*pseudo-atomic-atomic*) - (ash symbol-value-slot word-shift) - (- other-pointer-lowtag))) - (fixnumize 1)) + (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 mov (make-ea :byte :disp (+ nil-value + (inst xor (make-ea :byte :disp (+ nil-value (static-symbol-offset - '*pseudo-atomic-atomic*) + '*pseudo-atomic-bits*) (ash symbol-value-slot word-shift) (- other-pointer-lowtag))) - 0) - (inst cmp (make-ea :byte - :disp (+ nil-value - (static-symbol-offset - '*pseudo-atomic-interrupted*) - (ash symbol-value-slot word-shift) - (- other-pointer-lowtag))) - 0) - (inst jmp :eq ,label) + (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) diff --git a/src/compiler/x86-64/parms.lisp b/src/compiler/x86-64/parms.lisp index eed4cfe..148763f 100644 --- a/src/compiler/x86-64/parms.lisp +++ b/src/compiler/x86-64/parms.lisp @@ -166,8 +166,7 @@ '(*alien-stack* ;; interrupt handling - *pseudo-atomic-atomic* - *pseudo-atomic-interrupted* + *pseudo-atomic-bits* #!+sb-thread *stop-for-gc-pending* diff --git a/src/compiler/x86/macros.lisp b/src/compiler/x86/macros.lisp index e99bf9b..c010cfd 100644 --- a/src/compiler/x86/macros.lisp +++ b/src/compiler/x86/macros.lisp @@ -332,11 +332,6 @@ ;;; place and there's no logical single place to attach documentation. ;;; grep (mostly in src/runtime) is your friend -;;; FIXME: *PSEUDO-ATOMIC-FOO* could be made into *PSEUDO-ATOMIC-BITS*, -;;; set with a single operation and cleared with SHR *PSEUDO-ATOMIC-BITS*,-2; -;;; the ATOMIC bit is bit 0, the INTERRUPTED bit is bit 1, and you check -;;; the C flag after the shift to see whether you were interrupted. -;;; ;;; KLUDGE: since the stack on the x86 is treated conservatively, it ;;; does not matter whether a signal occurs during construction of a ;;; dynamic-extent object, as the half-finished construction of the @@ -351,15 +346,13 @@ (with-unique-names (label) `(let ((,label (gen-label))) (inst fs-segment-prefix) - (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot)) + (inst or (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot)) (fixnumize 1)) ,@forms (inst fs-segment-prefix) - (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot)) 0) - (inst fs-segment-prefix) - (inst cmp (make-ea :byte - :disp (* 4 thread-pseudo-atomic-interrupted-slot)) 0) - (inst jmp :eq ,label) + (inst xor (make-ea :byte :disp (* 4 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) @@ -372,27 +365,20 @@ ;; FIXME: The MAKE-EA noise should become a MACROLET macro ;; or something. (perhaps SVLB, for static variable low ;; byte) - (inst mov (make-ea :byte :disp (+ nil-value - (static-symbol-offset - '*pseudo-atomic-atomic*) - (ash symbol-value-slot word-shift) - (- other-pointer-lowtag))) + (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 mov (make-ea :byte :disp (+ nil-value + (inst xor (make-ea :byte :disp (+ nil-value (static-symbol-offset - '*pseudo-atomic-atomic*) + '*pseudo-atomic-bits*) (ash symbol-value-slot word-shift) (- other-pointer-lowtag))) - 0) - (inst cmp (make-ea :byte - :disp (+ nil-value - (static-symbol-offset - '*pseudo-atomic-interrupted*) - (ash symbol-value-slot word-shift) - (- other-pointer-lowtag))) - 0) - (inst jmp :eq ,label) + (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) diff --git a/src/compiler/x86/parms.lisp b/src/compiler/x86/parms.lisp index e9ae52c..816db31 100644 --- a/src/compiler/x86/parms.lisp +++ b/src/compiler/x86/parms.lisp @@ -312,8 +312,7 @@ '(*alien-stack* ;; interrupt handling - *pseudo-atomic-atomic* - *pseudo-atomic-interrupted* + *pseudo-atomic-bits* #!+sb-thread *stop-for-gc-pending* #!+sb-thread *free-tls-index* #!+sb-thread *tls-index-lock* diff --git a/src/runtime/dynbind.c b/src/runtime/dynbind.c index d9774d6..5bed359 100644 --- a/src/runtime/dynbind.c +++ b/src/runtime/dynbind.c @@ -18,6 +18,7 @@ #include "globals.h" #include "dynbind.h" #include "thread.h" +#include "pseudo-atomic.h" #include "genesis/symbol.h" #include "genesis/binding.h" #include "genesis/thread.h" @@ -43,8 +44,8 @@ void bind_variable(lispobj symbol, lispobj value, void *th) if(!sym->tls_index) { lispobj *tls_index_lock= &((struct symbol *)native_pointer(TLS_INDEX_LOCK))->value; - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(0),th); - SetSymbolValue(PSEUDO_ATOMIC_ATOMIC, make_fixnum(1),th); + clear_pseudo_atomic_interrupted(th); + set_pseudo_atomic_atomic(th); get_spinlock(tls_index_lock,(long)th); if(!sym->tls_index) { sym->tls_index=SymbolValue(FREE_TLS_INDEX,0); @@ -52,8 +53,8 @@ void bind_variable(lispobj symbol, lispobj value, void *th) make_fixnum(fixnum_value(sym->tls_index)+1),0); } release_spinlock(tls_index_lock); - SetSymbolValue(PSEUDO_ATOMIC_ATOMIC, make_fixnum(0),th); - if (fixnum_value(SymbolValue(PSEUDO_ATOMIC_INTERRUPTED,th))) + clear_pseudo_atomic_atomic(th); + if (get_pseudo_atomic_interrupted(th)) do_pending_interrupt(); } } diff --git a/src/runtime/gc.h b/src/runtime/gc.h index 2929013..3d43c0b 100644 --- a/src/runtime/gc.h +++ b/src/runtime/gc.h @@ -33,54 +33,6 @@ extern int maybe_gc_pending; #include "fixnump.h" -#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) - -#define set_alloc_pointer(value) \ - SetSymbolValue(ALLOCATION_POINTER, value, 0) -#define get_alloc_pointer() \ - SymbolValue(ALLOCATION_POINTER, 0) -#define get_binding_stack_pointer(thread) \ - SymbolValue(BINDING_STACK_POINTER, thread) -#define get_pseudo_atomic_atomic(thread) \ - SymbolValue(PSEUDO_ATOMIC_ATOMIC, thread) -#define set_pseudo_atomic_atomic(thread) \ - SetSymbolValue(PSEUDO_ATOMIC_ATOMIC, make_fixnum(1), thread); -#define clear_pseudo_atomic_atomic(thread) \ - SetSymbolValue(PSEUDO_ATOMIC_ATOMIC, make_fixnum(0), thread); -#define get_pseudo_atomic_interrupted(thread) \ - fixnum_value(SymbolValue(PSEUDO_ATOMIC_INTERRUPTED, thread)) -#define clear_pseudo_atomic_interrupted(thread) \ - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(0), thread) -#define set_pseudo_atomic_interrupted(thread) \ - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1), thread) - -#elif defined(LISP_FEATURE_PPC) && defined(LISP_FEATURE_GENCGC) - -#define set_alloc_pointer(value) \ - (dynamic_space_free_pointer = \ - (value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK)) - -#define get_alloc_pointer() \ - ((unsigned long) dynamic_space_free_pointer & ~LOWTAG_MASK) -#define get_binding_stack_pointer(thread) \ - (current_binding_stack_pointer) -#define get_pseudo_atomic_atomic(thread) \ - ((unsigned long)dynamic_space_free_pointer & flag_PseudoAtomic) -#define set_pseudo_atomic_atomic(thread) \ - (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long)dynamic_space_free_pointer | flag_PseudoAtomic)) -#define clear_pseudo_atomic_atomic(thread) \ - (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomic)) -#define get_pseudo_atomic_interrupted(thread) \ - ((unsigned long) dynamic_space_free_pointer & flag_PseudoAtomicInterrupted) -#define clear_pseudo_atomic_interrupted(thread) \ - (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomicInterrupted)) -#define set_pseudo_atomic_interrupted(thread) \ - (dynamic_space_free_pointer \ - = (lispobj*) ((unsigned long) dynamic_space_free_pointer | flag_PseudoAtomicInterrupted)) - -#endif +#include "pseudo-atomic.h" #endif /* _GC_H_ */ diff --git a/src/runtime/pseudo-atomic.h b/src/runtime/pseudo-atomic.h new file mode 100644 index 0000000..bd0cc55 --- /dev/null +++ b/src/runtime/pseudo-atomic.h @@ -0,0 +1,83 @@ +/* + * macros for manipulating pseudo-atomic flags (per thread) + */ + +/* + * This software is part of the SBCL system. See the README file for + * more information. + * + * This software is derived from the CMU CL system, which was + * written at Carnegie Mellon University and released into the + * public domain. The software is in the public domain and is + * provided with absolutely no warranty. See the COPYING and CREDITS + * files for more information. + */ + +#ifndef PSEUDO_ATOMIC_H +#define PSEUDO_ATOMIC_H + +#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) + +#define set_alloc_pointer(value) \ + SetSymbolValue(ALLOCATION_POINTER, value, 0) +#define get_alloc_pointer() \ + SymbolValue(ALLOCATION_POINTER, 0) +#define get_binding_stack_pointer(thread) \ + SymbolValue(BINDING_STACK_POINTER, thread) +#define get_pseudo_atomic_atomic(thread) \ + (fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) & make_fixnum(1))) +#define set_pseudo_atomic_atomic(thread) \ + { \ + lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \ + SetSymbolValue(PSEUDO_ATOMIC_BITS, bits | make_fixnum(1), thread); \ + } +#define clear_pseudo_atomic_atomic(thread) \ + { \ + lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \ + SetSymbolValue(PSEUDO_ATOMIC_BITS, bits & ~make_fixnum(1), thread); \ + } +#define get_pseudo_atomic_interrupted(thread) \ + (fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) & make_fixnum(2))) +#define clear_pseudo_atomic_interrupted(thread) \ + { \ + lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \ + SetSymbolValue(PSEUDO_ATOMIC_BITS, bits & ~make_fixnum(2), thread); \ + } + +#define set_pseudo_atomic_interrupted(thread) \ + { \ + lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \ + SetSymbolValue(PSEUDO_ATOMIC_BITS, bits | make_fixnum(2), thread); \ + } + +#elif defined(LISP_FEATURE_PPC) && defined(LISP_FEATURE_GENCGC) + +#define set_alloc_pointer(value) \ + (dynamic_space_free_pointer = \ + (value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK)) + +#define get_alloc_pointer() \ + ((unsigned long) dynamic_space_free_pointer & ~LOWTAG_MASK) +#define get_binding_stack_pointer(thread) \ + (current_binding_stack_pointer) +#define get_pseudo_atomic_atomic(thread) \ + ((unsigned long)dynamic_space_free_pointer & flag_PseudoAtomic) +#define set_pseudo_atomic_atomic(thread) \ + (dynamic_space_free_pointer \ + = (lispobj*) ((unsigned long)dynamic_space_free_pointer | flag_PseudoAtomic)) +#define clear_pseudo_atomic_atomic(thread) \ + (dynamic_space_free_pointer \ + = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomic)) +#define get_pseudo_atomic_interrupted(thread) \ + ((unsigned long) dynamic_space_free_pointer & flag_PseudoAtomicInterrupted) +#define clear_pseudo_atomic_interrupted(thread) \ + (dynamic_space_free_pointer \ + = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomicInterrupted)) +#define set_pseudo_atomic_interrupted(thread) \ + (dynamic_space_free_pointer \ + = (lispobj*) ((unsigned long) dynamic_space_free_pointer | flag_PseudoAtomicInterrupted)) + +#endif + +#endif /* PSEUDO_ATOMIC_H */ + diff --git a/src/runtime/thread.c b/src/runtime/thread.c index b10ea3c..6d5ddaa 100644 --- a/src/runtime/thread.c +++ b/src/runtime/thread.c @@ -332,8 +332,7 @@ create_thread_struct(lispobj initial_function) { STATIC_TLS_INIT(CONTROL_STACK_END,control_stack_end); STATIC_TLS_INIT(ALIEN_STACK,alien_stack_pointer); #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64) - STATIC_TLS_INIT(PSEUDO_ATOMIC_ATOMIC,pseudo_atomic_atomic); - STATIC_TLS_INIT(PSEUDO_ATOMIC_INTERRUPTED,pseudo_atomic_interrupted); + STATIC_TLS_INIT(PSEUDO_ATOMIC_BITS,pseudo_atomic_bits); #endif #undef STATIC_TLS_INIT } @@ -357,8 +356,7 @@ create_thread_struct(lispobj initial_function) { th->alien_stack_pointer=((void *)th->alien_stack_start); #endif #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64) - th->pseudo_atomic_interrupted=0; - th->pseudo_atomic_atomic=0; + th->pseudo_atomic_bits=0; #endif #ifdef LISP_FEATURE_GENCGC gc_set_region_empty(&th->alloc_region); @@ -377,8 +375,7 @@ create_thread_struct(lispobj initial_function) { #if defined(LISP_FEATURE_X86) || defined (LISP_FEATURE_X86_64) SetSymbolValue(BINDING_STACK_POINTER,(lispobj)th->binding_stack_pointer,th); SetSymbolValue(ALIEN_STACK,(lispobj)th->alien_stack_pointer,th); - SetSymbolValue(PSEUDO_ATOMIC_ATOMIC,(lispobj)th->pseudo_atomic_atomic,th); - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED,th->pseudo_atomic_interrupted,th); + SetSymbolValue(PSEUDO_ATOMIC_BITS,(lispobj)th->pseudo_atomic_bits,th); #else current_binding_stack_pointer=th->binding_stack_pointer; current_control_stack_pointer=th->control_stack_start; diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index b45dcd5..eaa1e23 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -122,21 +122,21 @@ arch_internal_error_arguments(os_context_t *context) boolean arch_pseudo_atomic_atomic(os_context_t *context) { - return SymbolValue(PSEUDO_ATOMIC_ATOMIC,arch_os_get_current_thread()); + return get_pseudo_atomic_atomic(arch_os_get_current_thread()); } void arch_set_pseudo_atomic_interrupted(os_context_t *context) { - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1), - arch_os_get_current_thread()); + struct thread *thread = arch_os_get_current_thread(); + set_pseudo_atomic_interrupted(thread); } void arch_clear_pseudo_atomic_interrupted(os_context_t *context) { - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(0), - arch_os_get_current_thread()); + struct thread *thread = arch_os_get_current_thread(); + clear_pseudo_atomic_interrupted(thread); } /* diff --git a/src/runtime/x86-arch.c b/src/runtime/x86-arch.c index 9a835fa..ba0cf36 100644 --- a/src/runtime/x86-arch.c +++ b/src/runtime/x86-arch.c @@ -129,21 +129,21 @@ arch_internal_error_arguments(os_context_t *context) boolean arch_pseudo_atomic_atomic(os_context_t *context) { - return SymbolValue(PSEUDO_ATOMIC_ATOMIC,arch_os_get_current_thread()); + return get_pseudo_atomic_atomic(arch_os_get_current_thread()); } void arch_set_pseudo_atomic_interrupted(os_context_t *context) { - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(1), - arch_os_get_current_thread()); + struct thread *thread = arch_os_get_current_thread(); + set_pseudo_atomic_interrupted(thread); } void arch_clear_pseudo_atomic_interrupted(os_context_t *context) { - SetSymbolValue(PSEUDO_ATOMIC_INTERRUPTED, make_fixnum(0), - arch_os_get_current_thread()); + struct thread *thread = arch_os_get_current_thread(); + clear_pseudo_atomic_interrupted(thread); } /* diff --git a/tests/threads.impure.lisp b/tests/threads.impure.lisp index d2140d4..ed87761 100644 --- a/tests/threads.impure.lisp +++ b/tests/threads.impure.lisp @@ -319,7 +319,8 @@ (lambda () (princ ".") (force-output) (assert (thread-alive-p *current-thread*)) - (assert (zerop SB-KERNEL:*PSEUDO-ATOMIC-ATOMIC*))))) + (assert + (not (logbitp 0 SB-KERNEL:*PSEUDO-ATOMIC-BITS*)))))) (terminate-thread c) (wait-for-threads (list c))) diff --git a/version.lisp-expr b/version.lisp-expr index 03a45c0..b3d0e9f 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; 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".) -"0.9.16.27" +"0.9.16.28" -- 1.7.10.4