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