1 /* globals.h 2 * Copyright 1984-2017 Cisco Systems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* globals that do NOT need to be preserved in a saved heap. 18 * they must be initialized each time the system is brought up. */ 19 20 /* gc.c */ 21 EXTERN IBOOL S_checkheap; 22 EXTERN uptr S_checkheap_errors; 23 #ifndef WIN32 24 EXTERN ptr S_child_processes[static_generation+1]; 25 #endif /* WIN32 */ 26 27 /* scheme.c */ 28 EXTERN IBOOL S_boot_time; 29 EXTERN int S_vfasl_boot_mode; 30 EXTERN IBOOL S_errors_to_console; 31 EXTERN ptr S_threads; 32 EXTERN uptr S_nthreads; 33 EXTERN uptr S_pagesize; 34 EXTERN void (*S_abnormal_exit_proc)(); 35 EXTERN char *Sschemeheapdirs; 36 EXTERN char *Sdefaultheapdirs; 37 #ifdef PTHREADS 38 EXTERN s_thread_key_t S_tc_key; 39 EXTERN scheme_mutex_t S_tc_mutex; 40 EXTERN s_thread_cond_t S_collect_cond; 41 EXTERN s_thread_cond_t S_collect_thread0_cond; 42 EXTERN scheme_mutex_t S_alloc_mutex; /* ordered after S_tc_mutex */ 43 EXTERN s_thread_cond_t S_terminated_cond; 44 EXTERN int S_collect_waiting_threads; 45 EXTERN ptr S_collect_waiting_tcs[maximum_parallel_collect_threads]; 46 EXTERN int S_num_preserve_ownership_threads; 47 # ifdef IMPLICIT_ATOMIC_AS_EXPLICIT 48 EXTERN s_thread_mutex_t S_implicit_mutex; 49 # endif 50 #endif 51 52 /* segment.c */ 53 /* update of the segment table is protected by alloc mutex */ 54 #ifdef segment_t2_bits 55 #ifdef segment_t3_bits 56 EXTERN t2table *S_segment_info[1<<segment_t3_bits]; 57 #else 58 EXTERN t1table *S_segment_info[1<<segment_t2_bits]; 59 #endif 60 #else 61 EXTERN seginfo *S_segment_info[1<<segment_t1_bits]; 62 #endif 63 64 EXTERN chunkinfo *S_chunks_full; 65 EXTERN chunkinfo *S_chunks[PARTIAL_CHUNK_POOLS+1]; 66 EXTERN chunkinfo *S_code_chunks_full; 67 EXTERN chunkinfo *S_code_chunks[PARTIAL_CHUNK_POOLS+1]; 68 69 /* schsig.c */ 70 71 /* foreign.c */ 72 #ifdef LOAD_SHARED_OBJECT 73 EXTERN ptr S_foreign_dynamic; 74 #endif 75 76 /* globals that do need to be preserved in a saved heap */ 77 EXTERN struct S_G_struct { 78 /* scheme.c */ 79 double thread_context[size_tc / sizeof(double)]; 80 thread_gc main_thread_gc; 81 ptr active_threads_id; 82 ptr error_invoke_code_object; 83 ptr invoke_code_object; 84 ptr dummy_code_object; 85 ptr heap_reserve_ratio_id; 86 IBOOL retain_static_relocation; 87 IBOOL enable_object_counts; 88 IBOOL enable_object_backreferences; 89 ptr scheme_version_id; 90 ptr make_load_binary_id; 91 ptr load_binary; 92 ptr profile_counters; 93 94 /* foreign.c */ 95 ptr foreign_static; 96 ptr foreign_names; 97 98 /* thread.c */ 99 ptr threadno; 100 101 /* segment.c */ 102 seginfo *occupied_segments[static_generation+1][max_real_space+1]; 103 uptr number_of_nonstatic_segments; 104 uptr number_of_empty_segments; 105 106 /* alloc.c */ 107 ptr *protected[max_protected]; 108 uptr protect_next; 109 uptr bytes_of_space[static_generation+1][max_real_space+1]; /* protected by alloc mutex */ 110 uptr bytes_of_generation[static_generation+1]; /* protected by alloc mutex */ 111 uptr bitmask_overhead[static_generation+1]; 112 uptr g0_bytes_after_last_gc; 113 uptr collect_trip_bytes; 114 ptr nonprocedure_code; 115 ptr null_string; 116 ptr null_vector; 117 ptr null_fxvector; 118 ptr null_flvector; 119 ptr null_bytevector; 120 ptr null_immutable_string; 121 ptr null_immutable_vector; 122 ptr null_immutable_bytevector; 123 ptr zero_length_bignum; 124 seginfo *dirty_segments[DIRTY_SEGMENT_LISTS]; 125 126 /* schsig.c */ 127 ptr error_id; 128 ptr nuate_id; 129 ptr null_continuation_id; 130 ptr collect_request_pending_id; 131 ptr event_and_resume_id; 132 ptr event_and_resume_star_id; 133 134 /* gc.c */ 135 ptr guardians[static_generation+1]; 136 ptr locked_objects[static_generation+1]; 137 ptr unlocked_objects[static_generation+1]; 138 IGEN min_free_gen; 139 IGEN new_min_free_gen; 140 IGEN max_nonstatic_generation; 141 IGEN new_max_nonstatic_generation; 142 IGEN min_mark_gen; 143 uptr countof[static_generation+1][countof_types]; 144 uptr bytesof[static_generation+1][countof_types]; 145 uptr gctimestamp[static_generation+1]; 146 ptr rtds_with_counts[static_generation+1]; 147 uptr countof_size[countof_types]; 148 ptr static_id; 149 ptr countof_names; 150 ptr gcbackreference[static_generation+1]; 151 IGEN prcgeneration; 152 uptr bytes_finalized; 153 dirtycardinfo *new_dirty_cards; 154 IBOOL must_mark_gen0; 155 156 /* intern.c */ 157 iptr oblist_length; 158 iptr oblist_count; 159 bucket **oblist; 160 bucket_list *buckets_of_generation[static_generation]; 161 162 /* prim.c */ 163 ptr library_entry_vector; 164 ptr c_entry_vector; 165 166 /* fasl.c */ 167 ptr base_rtd; 168 ptr rtd_key; 169 ptr eq_symbol; 170 ptr eq_ht_rtd; 171 ptr symbol_symbol; 172 ptr symbol_ht_rtd; 173 ptr eqp; 174 ptr eqvp; 175 ptr equalp; 176 ptr symboleqp; 177 178 /* vfasl.c */ 179 struct vfasl_hash_table *c_entries; 180 struct vfasl_hash_table *library_entries; 181 struct vfasl_hash_table *library_entry_codes; 182 } S_G; 183