[project @ 2001-12-11 02:59:17 by chak]
[ghc-hetmet.git] / ghc / includes / StgMiscClosures.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StgMiscClosures.h,v 1.41 2001/12/11 02:59:17 chak Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Entry code for various built-in closure types.
7  *
8  * ---------------------------------------------------------------------------*/
9
10 /* The naming scheme here follows the naming scheme for closure types
11  * defined in InfoTables.h.  The actual info tables and entry code for
12  * these objects can be found in StgMiscClosures.hc.
13  */
14
15 /* entry code */
16
17 STGFUN(stg_IND_entry);
18 STGFUN(stg_IND_STATIC_entry);
19 STGFUN(stg_IND_PERM_entry);
20 STGFUN(stg_IND_OLDGEN_entry);
21 STGFUN(stg_IND_OLDGEN_PERM_entry);
22 STGFUN(stg_CAF_UNENTERED_entry);
23 STGFUN(stg_CAF_ENTERED_entry);
24 STGFUN(stg_BLACKHOLE_entry);
25 STGFUN(stg_CAF_BLACKHOLE_entry);
26 STGFUN(stg_BLACKHOLE_BQ_entry);
27 #ifdef SMP
28 STGFUN(stg_WHITEHOLE_entry);
29 #endif
30 #ifdef TICKY_TICKY
31 STGFUN(stg_SE_BLACKHOLE_entry);
32 STGFUN(stg_SE_CAF_BLACKHOLE_entry);
33 #endif
34 #if defined(PAR) || defined(GRAN)
35 STGFUN(stg_RBH_entry);
36 #endif
37 STGFUN(stg_BCO_entry);
38 STGFUN(stg_EVACUATED_entry);
39 STGFUN(stg_FOREIGN_entry);
40 STGFUN(stg_WEAK_entry);
41 STGFUN(stg_NO_FINALIZER_entry);
42 STGFUN(stg_DEAD_WEAK_entry);
43 STGFUN(stg_STABLE_NAME_entry);
44 STGFUN(stg_TSO_entry);
45 STGFUN(stg_FULL_MVAR_entry);
46 STGFUN(stg_EMPTY_MVAR_entry);
47 STGFUN(stg_ARR_WORDS_entry);
48 STGFUN(stg_MUT_ARR_PTRS_entry);
49 STGFUN(stg_MUT_ARR_PTRS_FROZEN_entry);
50 STGFUN(stg_MUT_VAR_entry);
51 STGFUN(stg_END_TSO_QUEUE_entry);
52 STGFUN(stg_MUT_CONS_entry);
53 STGFUN(stg_END_MUT_LIST_entry);
54 STGFUN(stg_dummy_ret_entry);
55
56 /* entry code for constructors created by the bytecode interpreter */
57 STGFUN(stg_interp_constr_entry);
58 STGFUN(stg_interp_constr1_entry);
59 STGFUN(stg_interp_constr2_entry);
60 STGFUN(stg_interp_constr3_entry);
61 STGFUN(stg_interp_constr4_entry);
62 STGFUN(stg_interp_constr5_entry);
63 STGFUN(stg_interp_constr6_entry);
64 STGFUN(stg_interp_constr7_entry);
65 STGFUN(stg_interp_constr8_entry);
66
67 /* Magic glue code for when compiled code returns a value in R1/F1/D1
68    or a VoidRep to the interpreter. */
69 extern DLL_IMPORT_RTS const vec_info_8 stg_ctoi_ret_R1p_info;
70 extern DLL_IMPORT_RTS const vec_info_8 stg_ctoi_ret_R1n_info;
71 extern DLL_IMPORT_RTS const vec_info_8 stg_ctoi_ret_F1_info;
72 extern DLL_IMPORT_RTS const vec_info_8 stg_ctoi_ret_D1_info;
73 extern DLL_IMPORT_RTS const vec_info_8 stg_ctoi_ret_V_info;
74
75 /* Used by the interpreter to return an unboxed value on the stack to
76    compiled code. */
77 extern DLL_IMPORT_RTS const StgInfoTable stg_gc_unbx_r1_ret_info;
78 extern DLL_IMPORT_RTS const StgInfoTable stg_gc_f1_ret_info;
79 extern DLL_IMPORT_RTS const StgInfoTable stg_gc_d1_ret_info;
80 extern DLL_IMPORT_RTS const StgInfoTable stg_gc_l1_ret_info;
81
82 /* this is the NIL ptr for a TSO queue (e.g. runnable queue) */
83 #define END_TSO_QUEUE  ((StgTSO *)(void*)&stg_END_TSO_QUEUE_closure)
84 /* this is the NIL ptr for a list CAFs */
85 #define END_ECAF_LIST   ((StgCAF *)(void*)&stg_END_TSO_QUEUE_closure)
86 #if defined(PAR) || defined(GRAN)
87 /* this is the NIL ptr for a blocking queue */
88 # define END_BQ_QUEUE  ((StgBlockingQueueElement *)(void*)&stg_END_TSO_QUEUE_closure)
89 /* this is the NIL ptr for a blocked fetch queue (as in PendingFetches in GUM) */
90 # define END_BF_QUEUE  ((StgBlockedFetch *)(void*)&stg_END_TSO_QUEUE_closure)
91 #endif
92 /* ToDo?: different name for end of sleeping queue ? -- HWL */
93
94 /* info tables */
95
96 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_info;
97 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_STATIC_info;
98 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_PERM_info;
99 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_OLDGEN_info;
100 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_OLDGEN_PERM_info;
101 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_UNENTERED_info;
102 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_ENTERED_info;
103 extern DLL_IMPORT_RTS const StgInfoTable stg_BLACKHOLE_info;
104 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_BLACKHOLE_info;
105 extern DLL_IMPORT_RTS const StgInfoTable stg_BLACKHOLE_BQ_info;
106 #ifdef SMP
107 extern DLL_IMPORT_RTS const StgInfoTable stg_WHITEHOLE_info;
108 #endif
109 #ifdef TICKY_TICKY
110 extern DLL_IMPORT_RTS const StgInfoTable stg_SE_BLACKHOLE_info;
111 extern DLL_IMPORT_RTS const StgInfoTable stg_SE_CAF_BLACKHOLE_info;
112 #endif
113 #if defined(PAR) || defined(GRAN)
114 extern DLL_IMPORT_RTS const StgInfoTable stg_RBH_info;
115 #endif
116 #if defined(PAR)
117 extern DLL_IMPORT_RTS const StgInfoTable stg_FETCH_ME_BQ_info;
118 #endif
119 extern DLL_IMPORT_RTS const StgInfoTable stg_BCO_info;
120 extern DLL_IMPORT_RTS const StgInfoTable stg_EVACUATED_info;
121 extern DLL_IMPORT_RTS const StgInfoTable stg_FOREIGN_info;
122 extern DLL_IMPORT_RTS const StgInfoTable stg_WEAK_info;
123 extern DLL_IMPORT_RTS const StgInfoTable stg_DEAD_WEAK_info;
124 extern DLL_IMPORT_RTS const StgInfoTable stg_STABLE_NAME_info;
125 extern DLL_IMPORT_RTS const StgInfoTable stg_FULL_MVAR_info;
126 extern DLL_IMPORT_RTS const StgInfoTable stg_EMPTY_MVAR_info;
127 extern DLL_IMPORT_RTS const StgInfoTable stg_TSO_info;
128 extern DLL_IMPORT_RTS const StgInfoTable stg_ARR_WORDS_info;
129 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_WORDS_info;
130 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_PTRS_info;
131 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_PTRS_FROZEN_info;
132 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_VAR_info;
133 extern DLL_IMPORT_RTS const StgInfoTable stg_END_TSO_QUEUE_info;
134 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_CONS_info;
135 extern DLL_IMPORT_RTS const StgInfoTable stg_END_MUT_LIST_info;
136 extern DLL_IMPORT_RTS const StgInfoTable stg_catch_info;
137 extern DLL_IMPORT_RTS const StgInfoTable stg_seq_info;
138 extern DLL_IMPORT_RTS const StgInfoTable stg_dummy_ret_info;
139
140 /* closures */
141
142 extern DLL_IMPORT_RTS StgClosure stg_END_TSO_QUEUE_closure;
143 extern DLL_IMPORT_RTS StgClosure stg_END_MUT_LIST_closure;
144 extern DLL_IMPORT_RTS StgClosure stg_NO_FINALIZER_closure;
145 extern DLL_IMPORT_RTS StgClosure stg_dummy_ret_closure;
146 extern DLL_IMPORT_RTS StgClosure stg_forceIO_closure;
147
148 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_closure[];
149 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_closure[];
150
151 /* standard entry points */
152
153 /* EXTFUN_RTS(stg_error_entry); No longer used */
154
155   /* (see also below  -- KSW 1998-12) */
156
157 /* standard selector thunks */
158
159 EXTINFO_RTS stg_sel_0_upd_info;
160 EXTINFO_RTS stg_sel_1_upd_info;
161 EXTINFO_RTS stg_sel_2_upd_info;
162 EXTINFO_RTS stg_sel_3_upd_info;
163 EXTINFO_RTS stg_sel_4_upd_info;
164 EXTINFO_RTS stg_sel_5_upd_info;
165 EXTINFO_RTS stg_sel_6_upd_info;
166 EXTINFO_RTS stg_sel_7_upd_info;
167 EXTINFO_RTS stg_sel_8_upd_info;
168 EXTINFO_RTS stg_sel_8_upd_info;
169 EXTINFO_RTS stg_sel_9_upd_info;
170 EXTINFO_RTS stg_sel_10_upd_info;
171 EXTINFO_RTS stg_sel_11_upd_info;
172 EXTINFO_RTS stg_sel_12_upd_info;
173 EXTINFO_RTS stg_sel_13_upd_info;
174 EXTINFO_RTS stg_sel_14_upd_info;
175 EXTINFO_RTS stg_sel_15_upd_info;
176
177 EXTINFO_RTS stg_sel_0_noupd_info;
178 EXTINFO_RTS stg_sel_1_noupd_info;
179 EXTINFO_RTS stg_sel_2_noupd_info;
180 EXTINFO_RTS stg_sel_3_noupd_info;
181 EXTINFO_RTS stg_sel_4_noupd_info;
182 EXTINFO_RTS stg_sel_5_noupd_info;
183 EXTINFO_RTS stg_sel_6_noupd_info;
184 EXTINFO_RTS stg_sel_7_noupd_info;
185 EXTINFO_RTS stg_sel_8_noupd_info;
186 EXTINFO_RTS stg_sel_9_noupd_info;
187 EXTINFO_RTS stg_sel_10_noupd_info;
188 EXTINFO_RTS stg_sel_11_noupd_info;
189 EXTINFO_RTS stg_sel_12_noupd_info;
190 EXTINFO_RTS stg_sel_13_noupd_info;
191 EXTINFO_RTS stg_sel_14_noupd_info;
192 EXTINFO_RTS stg_sel_15_noupd_info;
193
194   /* and their standard entry points  -- KSW 1998-12 */
195
196 EXTFUN_RTS(stg_sel_0_upd_entry);
197 EXTFUN_RTS(stg_sel_1_upd_entry);
198 EXTFUN_RTS(stg_sel_2_upd_entry);
199 EXTFUN_RTS(stg_sel_3_upd_entry);
200 EXTFUN_RTS(stg_sel_4_upd_entry);
201 EXTFUN_RTS(stg_sel_5_upd_entry);
202 EXTFUN_RTS(stg_sel_6_upd_entry);
203 EXTFUN_RTS(stg_sel_7_upd_entry);
204 EXTFUN_RTS(stg_sel_8_upd_entry);
205 EXTFUN_RTS(stg_sel_8_upd_entry);
206 EXTFUN_RTS(stg_sel_9_upd_entry);
207 EXTFUN_RTS(stg_sel_10_upd_entry);
208 EXTFUN_RTS(stg_sel_11_upd_entry);
209 EXTFUN_RTS(stg_sel_12_upd_entry);
210 EXTFUN_RTS(stg_sel_13_upd_entry);
211 EXTFUN_RTS(stg_sel_14_upd_entry);
212 EXTFUN_RTS(stg_sel_15_upd_entry);
213
214 EXTFUN_RTS(stg_sel_0_noupd_entry);
215 EXTFUN_RTS(stg_sel_1_noupd_entry);
216 EXTFUN_RTS(stg_sel_2_noupd_entry);
217 EXTFUN_RTS(stg_sel_3_noupd_entry);
218 EXTFUN_RTS(stg_sel_4_noupd_entry);
219 EXTFUN_RTS(stg_sel_5_noupd_entry);
220 EXTFUN_RTS(stg_sel_6_noupd_entry);
221 EXTFUN_RTS(stg_sel_7_noupd_entry);
222 EXTFUN_RTS(stg_sel_8_noupd_entry);
223 EXTFUN_RTS(stg_sel_9_noupd_entry);
224 EXTFUN_RTS(stg_sel_10_noupd_entry);
225 EXTFUN_RTS(stg_sel_11_noupd_entry);
226 EXTFUN_RTS(stg_sel_12_noupd_entry);
227 EXTFUN_RTS(stg_sel_13_noupd_entry);
228 EXTFUN_RTS(stg_sel_14_noupd_entry);
229 EXTFUN_RTS(stg_sel_15_noupd_entry);
230
231 /* standard ap thunks */
232
233 EXTINFO_RTS stg_ap_1_upd_info;
234 EXTINFO_RTS stg_ap_2_upd_info;
235 EXTINFO_RTS stg_ap_3_upd_info;
236 EXTINFO_RTS stg_ap_4_upd_info;
237 EXTINFO_RTS stg_ap_5_upd_info;
238 EXTINFO_RTS stg_ap_6_upd_info;
239 EXTINFO_RTS stg_ap_7_upd_info;
240 EXTINFO_RTS stg_ap_8_upd_info;
241
242 /* standard GC & stack check entry points */
243
244 EXTFUN(stg_gc_entertop);
245 EXTFUN(stg_gc_enter_1_hponly);
246 EXTFUN(__stg_gc_enter_1);
247 EXTFUN(stg_gc_enter_2);
248 EXTFUN(stg_gc_enter_3);
249 EXTFUN(stg_gc_enter_4);
250 EXTFUN(stg_gc_enter_5);
251 EXTFUN(stg_gc_enter_6);
252 EXTFUN(stg_gc_enter_7);
253 EXTFUN(stg_gc_enter_8);
254 EXTFUN(stg_gc_seq_1);
255
256 EI_(stg_gc_noregs_ret_info);
257 EF_(stg_gc_noregs);
258
259 EI_(stg_gc_unpt_r1_ret_info);
260 EF_(stg_gc_unpt_r1);
261
262 EI_(stg_gc_unbx_r1_ret_info);
263 EF_(stg_gc_unbx_r1);
264
265 EI_(stg_gc_f1_ret_info);
266 EF_(stg_gc_f1);
267
268 EI_(stg_gc_d1_ret_info);
269 EF_(stg_gc_d1);
270
271 EI_(stg_gc_l1_ret_info);
272 EF_(stg_gc_l1);
273
274 EI_(stg_gc_ut_1_0_ret_info);
275 EF_(stg_gc_ut_1_0);
276
277 EI_(stg_gc_ut_0_1_ret_info);
278 EF_(stg_gc_ut_0_1);
279
280 EXTFUN(__stg_chk_0);
281 EXTFUN(__stg_chk_1);
282 EXTFUN(stg_chk_1n);
283 EXTFUN(stg_chk_2);
284 EXTFUN(stg_chk_3);
285 EXTFUN(stg_chk_4);
286 EXTFUN(stg_chk_5);
287 EXTFUN(stg_chk_6);
288 EXTFUN(stg_chk_7);
289 EXTFUN(stg_chk_8);
290 EXTFUN(stg_gen_chk_ret);
291 EXTFUN(stg_gen_chk);
292 EXTFUN(stg_gen_hp);
293 EXTFUN(stg_gen_yield);
294 EXTFUN(stg_yield_noregs);
295 EXTFUN(stg_yield_to_interpreter);
296 EXTFUN(stg_gen_block);
297 EXTFUN(stg_block_noregs);
298 EXTFUN(stg_block_1);
299 EXTFUN(stg_block_takemvar);
300 EXTFUN(stg_block_putmvar);
301