Record XREFs for symbols that name functions.
[sbcl.git] / src / runtime / globals.h
blob4edaa76d0398f1dd35e61c4096b0f52a350fd2c9
1 /*
2 * This software is part of the SBCL system. See the README file for
3 * more information.
5 * This software is derived from the CMU CL system, which was
6 * written at Carnegie Mellon University and released into the
7 * public domain. The software is in the public domain and is
8 * provided with absolutely no warranty. See the COPYING and CREDITS
9 * files for more information.
12 #ifndef _INCLUDED_GLOBALS_H_
13 #define _INCLUDED_GLOBALS_H_
15 #ifndef __ASSEMBLER__
16 # include <stdbool.h>
17 # include <sys/types.h>
18 # include <unistd.h>
19 # include "runtime.h"
20 # include "os.h"
21 #endif
23 #include "genesis/sbcl.h"
25 #ifndef __ASSEMBLER__
27 struct lisp_startup_options {
28 char noinform; // read from Lisp by (at least) src/code/cold-init
30 extern struct lisp_startup_options lisp_startup_options;
31 extern int pre_verify_gen_0; // set and read from Lisp tests
32 extern int gencgc_verbose;
34 extern sword_t next_free_page;
35 #define dynamic_space_highwatermark() (next_free_page*GENCGC_PAGE_BYTES+DYNAMIC_SPACE_START)
37 #ifdef LISP_FEATURE_SB_THREAD
39 #ifdef LISP_FEATURE_ARM64
40 #define foreign_function_call_active_p(thread) (thread->control_stack_pointer)
41 #else
42 #define foreign_function_call_active_p(thread) (thread->ffcall_active_p)
43 #endif
45 #else
46 extern int foreign_function_call_active;
47 #define foreign_function_call_active_p(thread) \
48 foreign_function_call_active
49 #endif
51 extern os_vm_size_t dynamic_space_size;
52 extern os_vm_size_t thread_control_stack_size;
54 #ifdef LISP_FEATURE_RELOCATABLE_STATIC_SPACE
55 extern uword_t STATIC_SPACE_START, STATIC_SPACE_END;
56 #endif
58 extern uword_t READ_ONLY_SPACE_START, READ_ONLY_SPACE_END;
59 #ifdef LISP_FEATURE_CHENEYGC
60 extern uword_t DYNAMIC_0_SPACE_START, DYNAMIC_1_SPACE_START;
61 #else
62 extern uword_t DYNAMIC_SPACE_START;
63 #endif
64 extern uword_t FIXEDOBJ_SPACE_START, TEXT_SPACE_START, PERMGEN_SPACE_START;
65 extern unsigned int text_space_size;
66 #ifdef LISP_FEATURE_IMMOBILE_SPACE
67 extern uword_t immobile_space_lower_bound, immobile_space_max_offset;
68 extern uword_t immobile_range_1_max_offset, immobile_range_2_min_offset;
69 #endif
70 extern uword_t asm_routines_start, asm_routines_end;
71 extern int gc_card_table_nbits;
73 static inline lispobj points_to_asm_code_p(uword_t ptr) {
74 return asm_routines_start <= ptr && ptr < asm_routines_end;
77 extern os_vm_address_t alloc_profile_buffer;
78 extern lispobj alloc_profile_data; // Lisp SIMPLE-VECTOR
80 extern lispobj arena_chain;
82 #if !defined(LISP_FEATURE_SB_THREAD)
83 extern lispobj *current_control_stack_pointer;
84 #endif
85 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) || !defined(LISP_FEATURE_SB_THREAD)
86 extern lispobj *current_control_frame_pointer;
87 #endif
88 #if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) && !defined(LISP_FEATURE_SB_THREAD)
89 extern lispobj *current_binding_stack_pointer;
90 #endif
92 extern lispobj *read_only_space_free_pointer;
93 extern lispobj *static_space_free_pointer;
94 extern lispobj *permgen_space_free_pointer;
96 static inline bool readonly_space_p(lispobj ptr) {
97 return ptr >= READ_ONLY_SPACE_START && (lispobj*)ptr < read_only_space_free_pointer;
99 static inline bool is_in_static_space(void* ptr) {
100 return (uword_t)ptr >= STATIC_SPACE_START && (lispobj*)ptr < static_space_free_pointer;
103 #ifdef LISP_FEATURE_DARWIN_JIT
104 extern lispobj *static_code_space_free_pointer;
105 #endif
107 extern lispobj *text_space_highwatermark;
108 #ifdef LISP_FEATURE_IMMOBILE_SPACE
109 extern lispobj *fixedobj_free_pointer;
110 extern lispobj ALIEN_LINKAGE_SPACE_START;
111 #endif
112 extern os_vm_address_t anon_dynamic_space_start;
113 extern lispobj* tlsf_mem_start; // meaningful only if immobile space
115 extern lispobj lisp_package_vector;
117 extern void globals_init(void);
119 #else /* __ASSEMBLER__ */
121 # ifdef LISP_FEATURE_MIPS
122 # define EXTERN(name) .globl name
123 # endif
124 /**/
125 # ifdef LISP_FEATURE_SPARC
126 # ifdef SVR4
127 # define EXTERN(name) .global name
128 # else
129 # define EXTERN(name) .global _ ## name
130 # endif
131 # endif
132 /**/
133 # if defined(LISP_FEATURE_PPC) || defined(LISP_FEATURE_PPC64)
134 # ifdef LISP_FEATURE_DARWIN
135 # define EXTERN(name) .globl _ ## name
136 # else
137 # define EXTERN(name) .globl name
138 # endif
139 # endif
140 /**/
141 # if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
142 # define EXTERN(name) .global name
143 # endif
144 /**/
145 # if defined(LISP_FEATURE_ARM) || defined(LISP_FEATURE_ARM64)
146 # define EXTERN(name) .global name
147 # endif
149 # if defined(LISP_FEATURE_RISCV)
150 # define EXTERN(name) .globl name
151 # endif
153 #ifndef LISP_FEATURE_SB_THREAD
154 EXTERN(foreign_function_call_active)
155 #endif
157 #if !defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_C_STACK_IS_CONTROL_STACK)
158 EXTERN(current_control_stack_pointer)
159 #endif
160 #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) || !defined(LISP_FEATURE_SB_THREAD)
161 EXTERN(current_control_frame_pointer)
162 #endif
163 # if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64) && !defined(LISP_FEATURE_SB_THREAD)
164 EXTERN(current_binding_stack_pointer)
165 # endif
167 #endif /* __ASSEMBLER__ */
169 #endif /* _INCLUDED_GLOBALS_H_ */