6cc9173510fc454b0824e48f080e79fb1a5725cf
[ghc-hetmet.git] / ghc / includes / StgMiscClosures.h
1 /* -----------------------------------------------------------------------------
2  * $Id: StgMiscClosures.h,v 1.47 2003/03/27 13:54:31 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-2002
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 /* Various entry points */
16 STGFUN(stg_PAP_entry);
17 STGFUN(stg_BCO_entry);
18
19 /* Entry code for constructors created by the bytecode interpreter */
20 STGFUN(stg_interp_constr_entry);
21 STGFUN(stg_interp_constr1_entry);
22 STGFUN(stg_interp_constr2_entry);
23 STGFUN(stg_interp_constr3_entry);
24 STGFUN(stg_interp_constr4_entry);
25 STGFUN(stg_interp_constr5_entry);
26 STGFUN(stg_interp_constr6_entry);
27 STGFUN(stg_interp_constr7_entry);
28 STGFUN(stg_interp_constr8_entry);
29
30 /* Magic glue code for when compiled code returns a value in R1/F1/D1
31    or a VoidRep to the interpreter. */
32 extern DLL_IMPORT_RTS const StgPolyInfoTable stg_ctoi_ret_R1p_info;
33 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_R1unpt_info;
34 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_R1n_info;
35 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_F1_info;
36 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_D1_info;
37 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_L1_info;
38 extern DLL_IMPORT_RTS const StgRetInfoTable stg_ctoi_ret_V_info;
39
40 extern DLL_IMPORT_RTS const StgRetInfoTable stg_apply_interp_info;
41
42 /* this is the NIL ptr for a TSO queue (e.g. runnable queue) */
43 #define END_TSO_QUEUE  ((StgTSO *)(void*)&stg_END_TSO_QUEUE_closure)
44 /* this is the NIL ptr for a list CAFs */
45 #define END_ECAF_LIST   ((StgCAF *)(void*)&stg_END_TSO_QUEUE_closure)
46 #if defined(PAR) || defined(GRAN)
47 /* this is the NIL ptr for a blocking queue */
48 # define END_BQ_QUEUE  ((StgBlockingQueueElement *)(void*)&stg_END_TSO_QUEUE_closure)
49 /* this is the NIL ptr for a blocked fetch queue (as in PendingFetches in GUM) */
50 # define END_BF_QUEUE  ((StgBlockedFetch *)(void*)&stg_END_TSO_QUEUE_closure)
51 #endif
52 /* ToDo?: different name for end of sleeping queue ? -- HWL */
53
54 /* info tables */
55
56 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_info;
57 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_direct_info;
58 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_0_info;
59 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_1_info;
60 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_2_info;
61 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_3_info;
62 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_4_info;
63 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_5_info;
64 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_6_info;
65 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_7_info;
66 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_STATIC_info;
67 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_PERM_info;
68 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_OLDGEN_info;
69 extern DLL_IMPORT_RTS const StgInfoTable stg_IND_OLDGEN_PERM_info;
70 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_UNENTERED_info;
71 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_ENTERED_info;
72 extern DLL_IMPORT_RTS const StgInfoTable stg_BLACKHOLE_info;
73 extern DLL_IMPORT_RTS const StgInfoTable stg_CAF_BLACKHOLE_info;
74 extern DLL_IMPORT_RTS const StgInfoTable stg_BLACKHOLE_BQ_info;
75 #ifdef SMP
76 extern DLL_IMPORT_RTS const StgInfoTable stg_WHITEHOLE_info;
77 #endif
78 #ifdef TICKY_TICKY
79 extern DLL_IMPORT_RTS const StgInfoTable stg_SE_BLACKHOLE_info;
80 extern DLL_IMPORT_RTS const StgInfoTable stg_SE_CAF_BLACKHOLE_info;
81 #endif
82 #if defined(PAR) || defined(GRAN)
83 extern DLL_IMPORT_RTS const StgInfoTable stg_RBH_info;
84 #endif
85 #if defined(PAR)
86 extern DLL_IMPORT_RTS const StgInfoTable stg_FETCH_ME_BQ_info;
87 #endif
88 extern DLL_IMPORT_RTS const StgFunInfoTable stg_BCO_info;
89 extern DLL_IMPORT_RTS const StgInfoTable stg_EVACUATED_info;
90 extern DLL_IMPORT_RTS const StgInfoTable stg_FOREIGN_info;
91 extern DLL_IMPORT_RTS const StgInfoTable stg_WEAK_info;
92 extern DLL_IMPORT_RTS const StgInfoTable stg_DEAD_WEAK_info;
93 extern DLL_IMPORT_RTS const StgInfoTable stg_STABLE_NAME_info;
94 extern DLL_IMPORT_RTS const StgInfoTable stg_FULL_MVAR_info;
95 extern DLL_IMPORT_RTS const StgInfoTable stg_EMPTY_MVAR_info;
96 extern DLL_IMPORT_RTS const StgInfoTable stg_TSO_info;
97 extern DLL_IMPORT_RTS const StgInfoTable stg_ARR_WORDS_info;
98 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_WORDS_info;
99 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_PTRS_info;
100 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_ARR_PTRS_FROZEN_info;
101 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_VAR_info;
102 extern DLL_IMPORT_RTS const StgInfoTable stg_END_TSO_QUEUE_info;
103 extern DLL_IMPORT_RTS const StgInfoTable stg_MUT_CONS_info;
104 extern DLL_IMPORT_RTS const StgInfoTable stg_END_MUT_LIST_info;
105 extern DLL_IMPORT_RTS const StgInfoTable stg_catch_info;
106 extern DLL_IMPORT_RTS const StgPolyInfoTable stg_seq_frame_info;
107 extern DLL_IMPORT_RTS const StgInfoTable stg_PAP_info;
108 extern DLL_IMPORT_RTS const StgInfoTable stg_AP_info;
109 extern DLL_IMPORT_RTS const StgInfoTable stg_AP_STACK_info;
110 extern DLL_IMPORT_RTS const StgInfoTable stg_dummy_ret_info;
111 extern DLL_IMPORT_RTS const StgInfoTable stg_raise_info;
112 extern DLL_IMPORT_RTS const StgRetInfoTable stg_forceIO_info;
113 extern DLL_IMPORT_RTS const StgRetInfoTable stg_noforceIO_info;
114 /* closures */
115
116 extern DLL_IMPORT_RTS StgClosure stg_END_TSO_QUEUE_closure;
117 extern DLL_IMPORT_RTS StgClosure stg_END_MUT_LIST_closure;
118 extern DLL_IMPORT_RTS StgClosure stg_NO_FINALIZER_closure;
119 extern DLL_IMPORT_RTS StgClosure stg_dummy_ret_closure;
120 extern DLL_IMPORT_RTS StgClosure stg_forceIO_closure;
121
122 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_closure[];
123 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_closure[];
124
125
126 /* standard entry points */
127
128 /* standard selector thunks */
129
130 EXTINFO_RTS stg_sel_0_upd_info;
131 EXTINFO_RTS stg_sel_1_upd_info;
132 EXTINFO_RTS stg_sel_2_upd_info;
133 EXTINFO_RTS stg_sel_3_upd_info;
134 EXTINFO_RTS stg_sel_4_upd_info;
135 EXTINFO_RTS stg_sel_5_upd_info;
136 EXTINFO_RTS stg_sel_6_upd_info;
137 EXTINFO_RTS stg_sel_7_upd_info;
138 EXTINFO_RTS stg_sel_8_upd_info;
139 EXTINFO_RTS stg_sel_8_upd_info;
140 EXTINFO_RTS stg_sel_9_upd_info;
141 EXTINFO_RTS stg_sel_10_upd_info;
142 EXTINFO_RTS stg_sel_11_upd_info;
143 EXTINFO_RTS stg_sel_12_upd_info;
144 EXTINFO_RTS stg_sel_13_upd_info;
145 EXTINFO_RTS stg_sel_14_upd_info;
146 EXTINFO_RTS stg_sel_15_upd_info;
147
148 EXTINFO_RTS stg_sel_0_noupd_info;
149 EXTINFO_RTS stg_sel_1_noupd_info;
150 EXTINFO_RTS stg_sel_2_noupd_info;
151 EXTINFO_RTS stg_sel_3_noupd_info;
152 EXTINFO_RTS stg_sel_4_noupd_info;
153 EXTINFO_RTS stg_sel_5_noupd_info;
154 EXTINFO_RTS stg_sel_6_noupd_info;
155 EXTINFO_RTS stg_sel_7_noupd_info;
156 EXTINFO_RTS stg_sel_8_noupd_info;
157 EXTINFO_RTS stg_sel_9_noupd_info;
158 EXTINFO_RTS stg_sel_10_noupd_info;
159 EXTINFO_RTS stg_sel_11_noupd_info;
160 EXTINFO_RTS stg_sel_12_noupd_info;
161 EXTINFO_RTS stg_sel_13_noupd_info;
162 EXTINFO_RTS stg_sel_14_noupd_info;
163 EXTINFO_RTS stg_sel_15_noupd_info;
164
165   /* and their standard entry points  -- KSW 1998-12 */
166
167 EXTFUN_RTS(stg_sel_0_upd_entry);
168 EXTFUN_RTS(stg_sel_1_upd_entry);
169 EXTFUN_RTS(stg_sel_2_upd_entry);
170 EXTFUN_RTS(stg_sel_3_upd_entry);
171 EXTFUN_RTS(stg_sel_4_upd_entry);
172 EXTFUN_RTS(stg_sel_5_upd_entry);
173 EXTFUN_RTS(stg_sel_6_upd_entry);
174 EXTFUN_RTS(stg_sel_7_upd_entry);
175 EXTFUN_RTS(stg_sel_8_upd_entry);
176 EXTFUN_RTS(stg_sel_8_upd_entry);
177 EXTFUN_RTS(stg_sel_9_upd_entry);
178 EXTFUN_RTS(stg_sel_10_upd_entry);
179 EXTFUN_RTS(stg_sel_11_upd_entry);
180 EXTFUN_RTS(stg_sel_12_upd_entry);
181 EXTFUN_RTS(stg_sel_13_upd_entry);
182 EXTFUN_RTS(stg_sel_14_upd_entry);
183 EXTFUN_RTS(stg_sel_15_upd_entry);
184
185 EXTFUN_RTS(stg_sel_0_noupd_entry);
186 EXTFUN_RTS(stg_sel_1_noupd_entry);
187 EXTFUN_RTS(stg_sel_2_noupd_entry);
188 EXTFUN_RTS(stg_sel_3_noupd_entry);
189 EXTFUN_RTS(stg_sel_4_noupd_entry);
190 EXTFUN_RTS(stg_sel_5_noupd_entry);
191 EXTFUN_RTS(stg_sel_6_noupd_entry);
192 EXTFUN_RTS(stg_sel_7_noupd_entry);
193 EXTFUN_RTS(stg_sel_8_noupd_entry);
194 EXTFUN_RTS(stg_sel_9_noupd_entry);
195 EXTFUN_RTS(stg_sel_10_noupd_entry);
196 EXTFUN_RTS(stg_sel_11_noupd_entry);
197 EXTFUN_RTS(stg_sel_12_noupd_entry);
198 EXTFUN_RTS(stg_sel_13_noupd_entry);
199 EXTFUN_RTS(stg_sel_14_noupd_entry);
200 EXTFUN_RTS(stg_sel_15_noupd_entry);
201
202 // standard ap thunks
203
204 ETI_RTS stg_ap_1_upd_info;
205 ETI_RTS stg_ap_2_upd_info;
206 ETI_RTS stg_ap_3_upd_info;
207 ETI_RTS stg_ap_4_upd_info;
208 ETI_RTS stg_ap_5_upd_info;
209 ETI_RTS stg_ap_6_upd_info;
210 ETI_RTS stg_ap_7_upd_info;
211 ETI_RTS stg_ap_8_upd_info;
212
213 // standard application routines (see also rts/gen_apply.py, 
214 // and compiler/codeGen/CgStackery.lhs).
215
216 extern DLL_IMPORT_RTS const StgPolyInfoTable stg_ap_0_info;
217 ERI_(stg_ap_v_info);
218 ERI_(stg_ap_f_info);
219 ERI_(stg_ap_d_info);
220 ERI_(stg_ap_l_info);
221 ERI_(stg_ap_n_info);
222 ERI_(stg_ap_p_info);
223 ERI_(stg_ap_pv_info);
224 ERI_(stg_ap_pp_info);
225 ERI_(stg_ap_ppv_info);
226 ERI_(stg_ap_ppp_info);
227 ERI_(stg_ap_pppp_info);
228 ERI_(stg_ap_ppppp_info);
229 ERI_(stg_ap_pppppp_info);
230 ERI_(stg_ap_ppppppp_info);
231
232 EXTFUN(stg_ap_0_ret);
233 EXTFUN(stg_ap_v_ret);
234 EXTFUN(stg_ap_f_ret);
235 EXTFUN(stg_ap_d_ret);
236 EXTFUN(stg_ap_l_ret);
237 EXTFUN(stg_ap_n_ret);
238 EXTFUN(stg_ap_p_ret);
239 EXTFUN(stg_ap_pv_ret);
240 EXTFUN(stg_ap_pp_ret);
241 EXTFUN(stg_ap_ppv_ret);
242 EXTFUN(stg_ap_ppp_ret);
243 EXTFUN(stg_ap_pppp_ret);
244 EXTFUN(stg_ap_ppppp_ret);
245 EXTFUN(stg_ap_pppppp_ret);
246 EXTFUN(stg_ap_ppppppp_ret);
247
248 /* standard GC & stack check entry points, all defined in HeapStackCheck.hc */
249
250 ERI_(stg_enter_info);
251 EF_(stg_enter_ret);
252
253 ERI_(stg_gc_void_info);
254
255 EF_(__stg_gc_enter_1);
256
257 EF_(stg_gc_noregs);
258
259 ERI_(stg_gc_unpt_r1_info);
260 EF_(stg_gc_unpt_r1);
261
262 ERI_(stg_gc_unbx_r1_info);
263 EF_(stg_gc_unbx_r1);
264
265 ERI_(stg_gc_f1_info);
266 EF_(stg_gc_f1);
267
268 ERI_(stg_gc_d1_info);
269 EF_(stg_gc_d1);
270
271 ERI_(stg_gc_l1_info);
272 EF_(stg_gc_l1);
273
274 EF_(__stg_gc_fun);
275 ERI_(stg_gc_fun_info);
276 EF_(stg_gc_fun_ret);
277
278 EF_(stg_gc_gen);
279 ERI_(stg_gc_gen_info);
280
281 EF_(stg_ut_1_0_unreg_ret);
282 ERI_(stg_ut_1_0_unreg_info);
283
284 EF_(stg_gc_gen_hp);
285 EF_(stg_gc_ut);
286 EF_(stg_gen_yield);
287 EF_(stg_yield_noregs);
288 EF_(stg_yield_to_interpreter);
289 EF_(stg_gen_block);
290 EF_(stg_block_noregs);
291 EF_(stg_block_1);
292 EF_(stg_block_takemvar);
293 EF_(stg_block_putmvar);
294 #ifdef mingw32_TARGET_OS
295 EF_(stg_block_async);
296 #endif