2 * macros for manipulating pseudo-atomic flags (per thread)
6 * This software is part of the SBCL system. See the README file for
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
16 #ifndef PSEUDO_ATOMIC_H
17 #define PSEUDO_ATOMIC_H
19 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
21 #define set_alloc_pointer(value) \
22 SetSymbolValue(ALLOCATION_POINTER, value, 0)
23 #define get_alloc_pointer() \
24 SymbolValue(ALLOCATION_POINTER, 0)
25 #define get_binding_stack_pointer(thread) \
26 SymbolValue(BINDING_STACK_POINTER, thread)
27 #define get_pseudo_atomic_atomic(thread) \
28 (fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) & make_fixnum(1)))
29 #define set_pseudo_atomic_atomic(thread) \
31 lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \
32 SetSymbolValue(PSEUDO_ATOMIC_BITS, bits | make_fixnum(1), thread); \
34 #define clear_pseudo_atomic_atomic(thread) \
36 lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \
37 SetSymbolValue(PSEUDO_ATOMIC_BITS, bits & ~make_fixnum(1), thread); \
39 #define get_pseudo_atomic_interrupted(thread) \
40 (fixnum_value(SymbolValue(PSEUDO_ATOMIC_BITS, thread) & make_fixnum(2)))
41 #define clear_pseudo_atomic_interrupted(thread) \
43 lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \
44 SetSymbolValue(PSEUDO_ATOMIC_BITS, bits & ~make_fixnum(2), thread); \
47 #define set_pseudo_atomic_interrupted(thread) \
49 lispobj bits = SymbolValue(PSEUDO_ATOMIC_BITS, thread); \
50 SetSymbolValue(PSEUDO_ATOMIC_BITS, bits | make_fixnum(2), thread); \
53 #elif defined(LISP_FEATURE_PPC) && defined(LISP_FEATURE_GENCGC)
55 #define set_alloc_pointer(value) \
56 (dynamic_space_free_pointer = \
58 ((value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK))))
60 #define get_alloc_pointer() \
61 ((unsigned long) dynamic_space_free_pointer & ~LOWTAG_MASK)
62 #define get_binding_stack_pointer(thread) \
63 (current_binding_stack_pointer)
64 #define get_pseudo_atomic_atomic(thread) \
65 ((unsigned long)dynamic_space_free_pointer & flag_PseudoAtomic)
66 #define set_pseudo_atomic_atomic(thread) \
67 (dynamic_space_free_pointer \
68 = (lispobj*) ((unsigned long)dynamic_space_free_pointer | flag_PseudoAtomic))
69 #define clear_pseudo_atomic_atomic(thread) \
70 (dynamic_space_free_pointer \
71 = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomic))
72 #define get_pseudo_atomic_interrupted(thread) \
73 ((unsigned long) dynamic_space_free_pointer & flag_PseudoAtomicInterrupted)
74 #define clear_pseudo_atomic_interrupted(thread) \
75 (dynamic_space_free_pointer \
76 = (lispobj*) ((unsigned long) dynamic_space_free_pointer & ~flag_PseudoAtomicInterrupted))
77 #define set_pseudo_atomic_interrupted(thread) \
78 (dynamic_space_free_pointer \
79 = (lispobj*) ((unsigned long) dynamic_space_free_pointer | flag_PseudoAtomicInterrupted))
83 #endif /* PSEUDO_ATOMIC_H */