b4774db1aa0110bbf2f5eaf3fd48e7f2f92fa1ee
[sbcl.git] / src / runtime / globals.c
1 /*
2  * variables everybody needs to look at or frob on
3  */
4
5 /*
6  * This software is part of the SBCL system. See the README file for
7  * more information.
8  *
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.
14  */
15
16 #include <stdio.h>
17
18 #include "runtime.h"
19 #include "sbcl.h"
20 #include "globals.h"
21 #include "validate.h"
22
23 int foreign_function_call_active;
24
25 lispobj *current_control_stack_pointer;
26 lispobj *current_control_frame_pointer;
27 #ifndef BINDING_STACK_POINTER
28 lispobj *current_binding_stack_pointer;
29 #endif
30
31 /* ALLOCATION_POINTER is more or less synonymous with RT, it seems.
32  * Anyone want to do an RT port of sbcl?  
33  */
34
35 #ifndef ALLOCATION_POINTER
36 /* The Object Formerly Known As current_dynamic_space_free_pointer */
37 lispobj *dynamic_space_free_pointer;
38 #endif
39
40 #ifndef INTERNAL_GC_TRIGGER
41 lispobj *current_auto_gc_trigger;
42 #endif
43
44 /* For copying GCs, this points to the start of the dynamic space
45  * currently in use (that will become the from_space when the next GC
46  * is done).  For the GENCGC, it always points to DYNAMIC_SPACE_START. */
47 lispobj *current_dynamic_space =
48 #ifndef GENCGC
49     DYNAMIC_0_SPACE_START;
50 #else
51     DYNAMIC_SPACE_START;
52 #endif
53
54 void globals_init(void)
55 {
56     /* Space, stack, and free pointer vars are initialized by
57      * validate() and coreparse(). */
58
59 #ifndef INTERNAL_GC_TRIGGER
60     /* no GC trigger yet */
61     current_auto_gc_trigger = NULL;
62 #endif
63
64     /* Set foreign function call active. */
65     foreign_function_call_active = 1;
66
67     /* Initialize the current Lisp state. */
68 #ifndef __i386__ /* if stack grows upward */
69     current_control_stack_pointer = (lispobj *)CONTROL_STACK_START;
70 #else
71     current_control_stack_pointer = (lispobj *)CONTROL_STACK_END;
72 #endif
73
74     current_control_frame_pointer = (lispobj *)0;
75 #ifndef BINDING_STACK_POINTER
76     current_binding_stack_pointer = BINDING_STACK_START;
77 #endif
78 }