1 /* -*-C-*-
2 
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts
6     Institute of Technology
7 
8 This file is part of MIT/GNU Scheme.
9 
10 MIT/GNU Scheme is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or (at
13 your option) any later version.
14 
15 MIT/GNU Scheme is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with MIT/GNU Scheme; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
23 USA.
24 
25 */
26 
27 /* Global-variable storage */
28 
29 #include "scheme.h"
30 
31 #ifndef CC_SUPPORT_P
32    SCHEME_OBJECT Registers [REGBLOCK_MINIMUM_LENGTH];
33 #endif
34 
35 /* next free word in heap */
36 SCHEME_OBJECT * Free;
37 
38 /* value of Free on entry to primitive, or 0 if not in primitive */
39 SCHEME_OBJECT * Free_primitive = 0;
40 
41 /* strict limit for Free */
42 SCHEME_OBJECT * heap_alloc_limit;
43 
44 /* limits of active heap */
45 SCHEME_OBJECT * heap_start;
46 SCHEME_OBJECT * heap_end;
47 
48 /* pointer to most-recently pushed item */
49 SCHEME_OBJECT * stack_pointer;
50 
51 /*-strict limit for stack_pointer */
52 SCHEME_OBJECT * stack_guard;
53 
54 /* limits of stack */
55 SCHEME_OBJECT * stack_start;
56 SCHEME_OBJECT * stack_end;
57 
58 /* next free word in constant space */
59 SCHEME_OBJECT * constant_alloc_next;
60 
61 /* limits of constant space */
62 SCHEME_OBJECT * constant_start;
63 SCHEME_OBJECT * constant_end;
64 
65 /* Address of the most recent return code in the stack.
66    This is only meaningful while in compiled code.  */
67 SCHEME_OBJECT * last_return_code;
68 
69 SCHEME_OBJECT fixed_objects;
70 
71 /* Array of contiguous auxiliary storage, one entry per ephemeron, for
72    the sake of the garbage collector, which can use the array however
73    it pleases -- as a hash table, binary tree, &c.  */
74 
75 SCHEME_OBJECT ephemeron_array = SHARP_F;
76 unsigned long ephemeron_count = 0;
77 
78 bool trapping;
79 
80 unsigned long n_heap_blocks;
81 unsigned long n_constant_blocks;
82 unsigned long n_stack_blocks;
83 SCHEME_OBJECT * memory_block_start;
84 SCHEME_OBJECT * memory_block_end;
85 
86 unsigned long heap_reserved;
87 
88 /* Amount of space needed when GC requested */
89 unsigned long gc_space_needed;
90 
91 /* Number of new ephemerons requested from the GC.  */
92 unsigned long n_ephemerons_requested;
93 bool ephemeron_request_hard_p;
94 
95 #ifndef HEAP_IN_LOW_MEMORY
96    SCHEME_OBJECT * memory_base;
97 #endif
98 
99 #ifdef ENABLE_DEBUGGING_TOOLS
100    bool Eval_Debug = false;
101    bool Hex_Input_Debug = false;
102    bool File_Load_Debug = false;
103    bool Reloc_Debug = false;
104    bool Intern_Debug = false;
105    bool Cont_Debug = false;
106    bool Primitive_Debug = false;
107    bool Lookup_Debug = false;
108    bool Define_Debug = false;
109    bool GC_Debug = false;
110    bool Upgrade_Debug = false;
111    bool Dump_Debug = false;
112    bool Trace_On_Error = false;
113    bool Bignum_Debug = false;
114    bool Per_File = false;
115    unsigned int debug_slotno = 0;
116    unsigned int debug_nslots = 0;
117    unsigned int local_slotno = 0;
118    unsigned int local_nslots = 0;
119    unsigned int debug_circle [100];
120    unsigned int local_circle [100];
121 #endif
122 
123 const char * CONT_PRINT_RETURN_MESSAGE =   "SAVE_CONT, return code";
124 const char * CONT_PRINT_EXPR_MESSAGE   =   "SAVE_CONT, expression";
125 const char * RESTORE_CONT_RETURN_MESSAGE = "RESTORE_CONT, return code";
126 const char * RESTORE_CONT_EXPR_MESSAGE =   "RESTORE_CONT, expression";
127 
128 /* Interpreter code name and message tables */
129 
130 unsigned long MAX_RETURN = MAX_RETURN_CODE;
131 
132 const char * Return_Names [] = RETURN_NAME_TABLE;	/* in returns.h */
133 const char * type_names [] = TYPE_NAME_TABLE;		/* in types.h */
134 const char * Abort_Names [] = ABORT_NAME_TABLE;		/* in const.h */
135 const char * Error_Names [] = ERROR_NAME_TABLE;		/* in errors.h */
136 const char * Term_Names [] = TERM_NAME_TABLE;		/* in errors.h */
137 const char * term_messages [] = TERM_MESSAGE_TABLE;	/* in errors.h */
138 const char * fixed_objects_names [] = FIXED_OBJECTS_NAMES; /* in fixobj.h */
139