9d907ab3ba44c4eb4222f27380941c21085cf73b
[ghc.git] / includes / stg / MiscClosures.h
1 /* ----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2009
4 *
5 * Declarations for various symbols exported by the RTS.
6 *
7 * ToDo: many of the symbols in here don't need to be exported, but
8 * our Cmm code generator doesn't know how to generate local symbols
9 * for the RTS bits (it assumes all RTS symbols are external).
10 *
11 * See wiki:Commentary/Compiler/Backends/PprC#Prototypes
12 *
13 * Do not #include this file directly: #include "Rts.h" instead.
14 *
15 * To understand the structure of the RTS headers, see the wiki:
16 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
17 *
18 * --------------------------------------------------------------------------*/
19
20 #ifndef STGMISCCLOSURES_H
21 #define STGMISCCLOSURES_H
22
23 #if IN_STG_CODE
24 # define RTS_RET_INFO(i) extern W_(i)[]
25 # define RTS_FUN_INFO(i) extern W_(i)[]
26 # define RTS_THUNK_INFO(i) extern W_(i)[]
27 # define RTS_INFO(i) extern W_(i)[]
28 # define RTS_CLOSURE(i) extern W_(i)[]
29 # define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
30 #else
31 # define RTS_RET_INFO(i) extern DLL_IMPORT_RTS const StgRetInfoTable i
32 # define RTS_FUN_INFO(i) extern DLL_IMPORT_RTS const StgFunInfoTable i
33 # define RTS_THUNK_INFO(i) extern DLL_IMPORT_RTS const StgThunkInfoTable i
34 # define RTS_INFO(i) extern DLL_IMPORT_RTS const StgInfoTable i
35 # define RTS_CLOSURE(i) extern DLL_IMPORT_RTS StgClosure i
36 # define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
37 #endif
38
39 #ifdef TABLES_NEXT_TO_CODE
40 # define RTS_RET(f) RTS_INFO(f##_info)
41 # define RTS_ENTRY(f) RTS_INFO(f##_info)
42 # define RTS_FUN(f) RTS_FUN_INFO(f##_info)
43 # define RTS_THUNK(f) RTS_THUNK_INFO(f##_info)
44 #else
45 # define RTS_RET(f) RTS_INFO(f##_info); RTS_FUN_DECL(f##_ret)
46 # define RTS_ENTRY(f) RTS_INFO(f##_info); RTS_FUN_DECL(f##_entry)
47 # define RTS_FUN(f) RTS_FUN_INFO(f##_info); RTS_FUN_DECL(f##_entry)
48 # define RTS_THUNK(f) RTS_THUNK_INFO(f##_info); RTS_FUN_DECL(f##_entry)
49 #endif
50
51 /* Stack frames */
52 RTS_RET(stg_upd_frame);
53 RTS_RET(stg_bh_upd_frame);
54 RTS_RET(stg_marked_upd_frame);
55 RTS_RET(stg_noupd_frame);
56 RTS_RET(stg_catch_frame);
57 RTS_RET(stg_catch_retry_frame);
58 RTS_RET(stg_atomically_frame);
59 RTS_RET(stg_atomically_waiting_frame);
60 RTS_RET(stg_catch_stm_frame);
61 RTS_RET(stg_unmaskAsyncExceptionszh_ret);
62 RTS_RET(stg_maskUninterruptiblezh_ret);
63 RTS_RET(stg_maskAsyncExceptionszh_ret);
64 RTS_RET(stg_stack_underflow_frame);
65 RTS_RET(stg_restore_cccs);
66 RTS_RET(stg_restore_cccs_eval);
67
68 // RTS_FUN(stg_interp_constr1_entry);
69 // RTS_FUN(stg_interp_constr2_entry);
70 // RTS_FUN(stg_interp_constr3_entry);
71 // RTS_FUN(stg_interp_constr4_entry);
72 // RTS_FUN(stg_interp_constr5_entry);
73 // RTS_FUN(stg_interp_constr6_entry);
74 // RTS_FUN(stg_interp_constr7_entry);
75 //
76 // This is referenced using the FFI in the compiler (ByteCodeItbls),
77 // so we can't give it the correct type here because the prototypes
78 // would clash (FFI references are always declared with type StgWord[]
79 // in the generated C code).
80
81 /* Magic glue code for when compiled code returns a value in R1/F1/D1
82 or a VoidRep to the interpreter. */
83 RTS_RET(stg_ctoi_R1p);
84 RTS_RET(stg_ctoi_R1unpt);
85 RTS_RET(stg_ctoi_R1n);
86 RTS_RET(stg_ctoi_F1);
87 RTS_RET(stg_ctoi_D1);
88 RTS_RET(stg_ctoi_L1);
89 RTS_RET(stg_ctoi_V);
90
91 RTS_RET(stg_apply_interp);
92
93 RTS_ENTRY(stg_IND);
94 RTS_ENTRY(stg_IND_direct);
95 RTS_ENTRY(stg_IND_STATIC);
96 RTS_ENTRY(stg_BLACKHOLE);
97 RTS_ENTRY(stg_CAF_BLACKHOLE);
98 RTS_ENTRY(__stg_EAGER_BLACKHOLE);
99 RTS_ENTRY(stg_WHITEHOLE);
100 RTS_ENTRY(stg_BLOCKING_QUEUE_CLEAN);
101 RTS_ENTRY(stg_BLOCKING_QUEUE_DIRTY);
102
103 RTS_FUN(stg_BCO);
104 RTS_ENTRY(stg_EVACUATED);
105 RTS_ENTRY(stg_WEAK);
106 RTS_ENTRY(stg_DEAD_WEAK);
107 RTS_ENTRY(stg_C_FINALIZER_LIST);
108 RTS_ENTRY(stg_STABLE_NAME);
109 RTS_ENTRY(stg_MVAR_CLEAN);
110 RTS_ENTRY(stg_MVAR_DIRTY);
111 RTS_ENTRY(stg_TVAR_CLEAN);
112 RTS_ENTRY(stg_TVAR_DIRTY);
113 RTS_ENTRY(stg_TSO);
114 RTS_ENTRY(stg_STACK);
115 RTS_ENTRY(stg_RUBBISH_ENTRY);
116 RTS_ENTRY(stg_ARR_WORDS);
117 RTS_ENTRY(stg_MUT_ARR_WORDS);
118 RTS_ENTRY(stg_MUT_ARR_PTRS_CLEAN);
119 RTS_ENTRY(stg_MUT_ARR_PTRS_DIRTY);
120 RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN);
121 RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN0);
122 RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_CLEAN);
123 RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_DIRTY);
124 RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN);
125 RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN0);
126 RTS_ENTRY(stg_MUT_VAR_CLEAN);
127 RTS_ENTRY(stg_MUT_VAR_DIRTY);
128 RTS_ENTRY(stg_END_TSO_QUEUE);
129 RTS_ENTRY(stg_GCD_CAF);
130 RTS_ENTRY(stg_STM_AWOKEN);
131 RTS_ENTRY(stg_MSG_TRY_WAKEUP);
132 RTS_ENTRY(stg_MSG_THROWTO);
133 RTS_ENTRY(stg_MSG_BLACKHOLE);
134 RTS_ENTRY(stg_MSG_NULL);
135 RTS_ENTRY(stg_MVAR_TSO_QUEUE);
136 RTS_ENTRY(stg_catch);
137 RTS_ENTRY(stg_PAP);
138 RTS_ENTRY(stg_AP);
139 RTS_ENTRY(stg_AP_NOUPD);
140 RTS_ENTRY(stg_AP_STACK);
141 RTS_ENTRY(stg_AP_STACK_NOUPD);
142 RTS_ENTRY(stg_dummy_ret);
143 RTS_ENTRY(stg_raise);
144 RTS_ENTRY(stg_raise_ret);
145 RTS_ENTRY(stg_atomically);
146 RTS_ENTRY(stg_TVAR_WATCH_QUEUE);
147 RTS_ENTRY(stg_INVARIANT_CHECK_QUEUE);
148 RTS_ENTRY(stg_ATOMIC_INVARIANT);
149 RTS_ENTRY(stg_TREC_CHUNK);
150 RTS_ENTRY(stg_TREC_HEADER);
151 RTS_ENTRY(stg_END_STM_WATCH_QUEUE);
152 RTS_ENTRY(stg_END_INVARIANT_CHECK_QUEUE);
153 RTS_ENTRY(stg_END_STM_CHUNK_LIST);
154 RTS_ENTRY(stg_NO_TREC);
155 RTS_ENTRY(stg_COMPACT_NFDATA_CLEAN);
156 RTS_ENTRY(stg_COMPACT_NFDATA_DIRTY);
157
158 /* closures */
159
160 RTS_CLOSURE(stg_END_TSO_QUEUE_closure);
161 RTS_CLOSURE(stg_STM_AWOKEN_closure);
162 RTS_CLOSURE(stg_NO_FINALIZER_closure);
163 RTS_CLOSURE(stg_dummy_ret_closure);
164 RTS_CLOSURE(stg_forceIO_closure);
165
166 RTS_CLOSURE(stg_END_STM_WATCH_QUEUE_closure);
167 RTS_CLOSURE(stg_END_INVARIANT_CHECK_QUEUE_closure);
168 RTS_CLOSURE(stg_END_STM_CHUNK_LIST_closure);
169 RTS_CLOSURE(stg_NO_TREC_closure);
170
171 RTS_ENTRY(stg_NO_FINALIZER_entry);
172
173 #if IN_STG_CODE
174 extern DLL_IMPORT_RTS StgWordArray stg_CHARLIKE_closure;
175 extern DLL_IMPORT_RTS StgWordArray stg_INTLIKE_closure;
176 #else
177 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_closure[];
178 extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_closure[];
179 #endif
180
181 /* StgStartup */
182
183 RTS_RET(stg_forceIO);
184 RTS_RET(stg_noforceIO);
185
186 /* standard entry points */
187
188 /* standard selector thunks */
189
190 RTS_ENTRY(stg_sel_0_upd);
191 RTS_ENTRY(stg_sel_1_upd);
192 RTS_ENTRY(stg_sel_2_upd);
193 RTS_ENTRY(stg_sel_3_upd);
194 RTS_ENTRY(stg_sel_4_upd);
195 RTS_ENTRY(stg_sel_5_upd);
196 RTS_ENTRY(stg_sel_6_upd);
197 RTS_ENTRY(stg_sel_7_upd);
198 RTS_ENTRY(stg_sel_8_upd);
199 RTS_ENTRY(stg_sel_9_upd);
200 RTS_ENTRY(stg_sel_10_upd);
201 RTS_ENTRY(stg_sel_11_upd);
202 RTS_ENTRY(stg_sel_12_upd);
203 RTS_ENTRY(stg_sel_13_upd);
204 RTS_ENTRY(stg_sel_14_upd);
205 RTS_ENTRY(stg_sel_15_upd);
206
207 RTS_ENTRY(stg_sel_0_noupd);
208 RTS_ENTRY(stg_sel_1_noupd);
209 RTS_ENTRY(stg_sel_2_noupd);
210 RTS_ENTRY(stg_sel_3_noupd);
211 RTS_ENTRY(stg_sel_4_noupd);
212 RTS_ENTRY(stg_sel_5_noupd);
213 RTS_ENTRY(stg_sel_6_noupd);
214 RTS_ENTRY(stg_sel_7_noupd);
215 RTS_ENTRY(stg_sel_8_noupd);
216 RTS_ENTRY(stg_sel_9_noupd);
217 RTS_ENTRY(stg_sel_10_noupd);
218 RTS_ENTRY(stg_sel_11_noupd);
219 RTS_ENTRY(stg_sel_12_noupd);
220 RTS_ENTRY(stg_sel_13_noupd);
221 RTS_ENTRY(stg_sel_14_noupd);
222 RTS_ENTRY(stg_sel_15_noupd);
223
224 /* standard ap thunks */
225
226 RTS_THUNK(stg_ap_1_upd);
227 RTS_THUNK(stg_ap_2_upd);
228 RTS_THUNK(stg_ap_3_upd);
229 RTS_THUNK(stg_ap_4_upd);
230 RTS_THUNK(stg_ap_5_upd);
231 RTS_THUNK(stg_ap_6_upd);
232 RTS_THUNK(stg_ap_7_upd);
233
234 /* standard application routines (see also utils/genapply,
235 * and compiler/codeGen/StgCmmArgRep.hs).
236 */
237 RTS_RET(stg_ap_v);
238 RTS_RET(stg_ap_f);
239 RTS_RET(stg_ap_d);
240 RTS_RET(stg_ap_l);
241 RTS_RET(stg_ap_v16);
242 RTS_RET(stg_ap_v32);
243 RTS_RET(stg_ap_v64);
244 RTS_RET(stg_ap_n);
245 RTS_RET(stg_ap_p);
246 RTS_RET(stg_ap_pv);
247 RTS_RET(stg_ap_pp);
248 RTS_RET(stg_ap_ppv);
249 RTS_RET(stg_ap_ppp);
250 RTS_RET(stg_ap_pppv);
251 RTS_RET(stg_ap_pppp);
252 RTS_RET(stg_ap_ppppp);
253 RTS_RET(stg_ap_pppppp);
254
255 RTS_FUN_DECL(stg_ap_0_fast);
256 RTS_FUN_DECL(stg_ap_v_fast);
257 RTS_FUN_DECL(stg_ap_f_fast);
258 RTS_FUN_DECL(stg_ap_d_fast);
259 RTS_FUN_DECL(stg_ap_l_fast);
260 RTS_FUN_DECL(stg_ap_v16_fast);
261 RTS_FUN_DECL(stg_ap_v32_fast);
262 RTS_FUN_DECL(stg_ap_v64_fast);
263 RTS_FUN_DECL(stg_ap_n_fast);
264 RTS_FUN_DECL(stg_ap_p_fast);
265 RTS_FUN_DECL(stg_ap_pv_fast);
266 RTS_FUN_DECL(stg_ap_pp_fast);
267 RTS_FUN_DECL(stg_ap_ppv_fast);
268 RTS_FUN_DECL(stg_ap_ppp_fast);
269 RTS_FUN_DECL(stg_ap_pppv_fast);
270 RTS_FUN_DECL(stg_ap_pppp_fast);
271 RTS_FUN_DECL(stg_ap_ppppp_fast);
272 RTS_FUN_DECL(stg_ap_pppppp_fast);
273 RTS_FUN_DECL(stg_PAP_apply);
274
275 /* standard GC & stack check entry points, all defined in HeapStackCheck.cmm */
276
277 RTS_FUN_DECL(stg_gc_noregs);
278
279 RTS_RET(stg_enter_checkbh);
280
281 RTS_RET(stg_ret_v);
282 RTS_RET(stg_ret_p);
283 RTS_RET(stg_ret_n);
284 RTS_RET(stg_ret_f);
285 RTS_RET(stg_ret_d);
286 RTS_RET(stg_ret_l);
287
288 RTS_FUN_DECL(stg_gc_prim);
289 RTS_FUN_DECL(stg_gc_prim_p);
290 RTS_FUN_DECL(stg_gc_prim_pp);
291 RTS_FUN_DECL(stg_gc_prim_n);
292
293 RTS_RET(stg_gc_prim_p_ll_ret);
294 RTS_FUN_DECL(stg_gc_prim_p_ll);
295
296 RTS_RET(stg_enter);
297 RTS_FUN_DECL(__stg_gc_enter_1);
298
299 RTS_FUN_DECL(stg_gc_unpt_r1);
300 RTS_FUN_DECL(stg_gc_unbx_r1);
301 RTS_FUN_DECL(stg_gc_f1);
302 RTS_FUN_DECL(stg_gc_d1);
303 RTS_FUN_DECL(stg_gc_l1);
304 RTS_FUN_DECL(stg_gc_pp);
305 RTS_FUN_DECL(stg_gc_ppp);
306 RTS_FUN_DECL(stg_gc_pppp);
307
308 RTS_RET(stg_gc_fun);
309 RTS_FUN_DECL(__stg_gc_fun);
310
311 RTS_FUN_DECL(stg_yield_noregs);
312 RTS_FUN_DECL(stg_yield_to_interpreter);
313 RTS_FUN_DECL(stg_block_noregs);
314 RTS_FUN_DECL(stg_block_blackhole);
315 RTS_FUN_DECL(stg_block_blackhole_finally);
316 RTS_FUN_DECL(stg_block_takemvar);
317 RTS_FUN_DECL(stg_block_readmvar);
318 RTS_RET(stg_block_takemvar);
319 RTS_RET(stg_block_readmvar);
320 RTS_FUN_DECL(stg_block_putmvar);
321 RTS_RET(stg_block_putmvar);
322 #ifdef mingw32_HOST_OS
323 RTS_FUN_DECL(stg_block_async);
324 RTS_RET(stg_block_async);
325 RTS_FUN_DECL(stg_block_async_void);
326 RTS_RET(stg_block_async_void);
327 #endif
328 RTS_FUN_DECL(stg_block_stmwait);
329 RTS_FUN_DECL(stg_block_throwto);
330 RTS_RET(stg_block_throwto);
331
332 /* Entry/exit points from StgStartup.cmm */
333
334 RTS_RET(stg_stop_thread);
335
336 RTS_FUN_DECL(stg_returnToStackTop);
337 RTS_FUN_DECL(stg_returnToSched);
338 RTS_FUN_DECL(stg_returnToSchedNotPaused);
339 RTS_FUN_DECL(stg_returnToSchedButFirst);
340 RTS_FUN_DECL(stg_threadFinished);
341
342 RTS_FUN_DECL(StgReturn);
343
344 /* -----------------------------------------------------------------------------
345 PrimOps
346 -------------------------------------------------------------------------- */
347
348 RTS_FUN_DECL(stg_decodeFloatzuIntzh);
349 RTS_FUN_DECL(stg_decodeDoublezu2Intzh);
350 RTS_FUN_DECL(stg_decodeDoublezuInt64zh);
351
352 RTS_FUN_DECL(stg_unsafeThawArrayzh);
353 RTS_FUN_DECL(stg_casArrayzh);
354 RTS_FUN_DECL(stg_newByteArrayzh);
355 RTS_FUN_DECL(stg_newPinnedByteArrayzh);
356 RTS_FUN_DECL(stg_newAlignedPinnedByteArrayzh);
357 RTS_FUN_DECL(stg_isByteArrayPinnedzh);
358 RTS_FUN_DECL(stg_isMutableByteArrayPinnedzh);
359 RTS_FUN_DECL(stg_shrinkMutableByteArrayzh);
360 RTS_FUN_DECL(stg_resizzeMutableByteArrayzh);
361 RTS_FUN_DECL(stg_casIntArrayzh);
362 RTS_FUN_DECL(stg_newArrayzh);
363 RTS_FUN_DECL(stg_newArrayArrayzh);
364 RTS_FUN_DECL(stg_copyArrayzh);
365 RTS_FUN_DECL(stg_copyMutableArrayzh);
366 RTS_FUN_DECL(stg_copyArrayArrayzh);
367 RTS_FUN_DECL(stg_copyMutableArrayArrayzh);
368 RTS_FUN_DECL(stg_cloneArrayzh);
369 RTS_FUN_DECL(stg_cloneMutableArrayzh);
370 RTS_FUN_DECL(stg_freezzeArrayzh);
371 RTS_FUN_DECL(stg_thawArrayzh);
372
373 RTS_FUN_DECL(stg_newSmallArrayzh);
374 RTS_FUN_DECL(stg_unsafeThawSmallArrayzh);
375 RTS_FUN_DECL(stg_cloneSmallArrayzh);
376 RTS_FUN_DECL(stg_cloneSmallMutableArrayzh);
377 RTS_FUN_DECL(stg_freezzeSmallArrayzh);
378 RTS_FUN_DECL(stg_thawSmallArrayzh);
379 RTS_FUN_DECL(stg_copySmallArrayzh);
380 RTS_FUN_DECL(stg_copySmallMutableArrayzh);
381 RTS_FUN_DECL(stg_casSmallArrayzh);
382
383 RTS_FUN_DECL(stg_newMutVarzh);
384 RTS_FUN_DECL(stg_atomicModifyMutVarzh);
385 RTS_FUN_DECL(stg_casMutVarzh);
386
387 RTS_FUN_DECL(stg_isEmptyMVarzh);
388 RTS_FUN_DECL(stg_newMVarzh);
389 RTS_FUN_DECL(stg_takeMVarzh);
390 RTS_FUN_DECL(stg_putMVarzh);
391 RTS_FUN_DECL(stg_readMVarzh);
392 RTS_FUN_DECL(stg_tryTakeMVarzh);
393 RTS_FUN_DECL(stg_tryPutMVarzh);
394 RTS_FUN_DECL(stg_tryReadMVarzh);
395
396 RTS_FUN_DECL(stg_waitReadzh);
397 RTS_FUN_DECL(stg_waitWritezh);
398 RTS_FUN_DECL(stg_delayzh);
399 #ifdef mingw32_HOST_OS
400 RTS_FUN_DECL(stg_asyncReadzh);
401 RTS_FUN_DECL(stg_asyncWritezh);
402 RTS_FUN_DECL(stg_asyncDoProczh);
403 #endif
404
405 RTS_FUN_DECL(stg_catchzh);
406 RTS_FUN_DECL(stg_raisezh);
407 RTS_FUN_DECL(stg_raiseIOzh);
408
409 RTS_FUN_DECL(stg_makeStableNamezh);
410 RTS_FUN_DECL(stg_makeStablePtrzh);
411 RTS_FUN_DECL(stg_deRefStablePtrzh);
412
413 RTS_FUN_DECL(stg_compactAddzh);
414 RTS_FUN_DECL(stg_compactAddWithSharingzh);
415 RTS_FUN_DECL(stg_compactNewzh);
416 RTS_FUN_DECL(stg_compactAppendzh);
417 RTS_FUN_DECL(stg_compactResizzezh);
418 RTS_FUN_DECL(stg_compactGetRootzh);
419 RTS_FUN_DECL(stg_compactContainszh);
420 RTS_FUN_DECL(stg_compactContainsAnyzh);
421 RTS_FUN_DECL(stg_compactGetFirstBlockzh);
422 RTS_FUN_DECL(stg_compactGetNextBlockzh);
423 RTS_FUN_DECL(stg_compactAllocateBlockzh);
424 RTS_FUN_DECL(stg_compactFixupPointerszh);
425 RTS_FUN_DECL(stg_compactSizzezh);
426
427 RTS_FUN_DECL(stg_forkzh);
428 RTS_FUN_DECL(stg_forkOnzh);
429 RTS_FUN_DECL(stg_yieldzh);
430 RTS_FUN_DECL(stg_killMyself);
431 RTS_FUN_DECL(stg_killThreadzh);
432 RTS_FUN_DECL(stg_getMaskingStatezh);
433 RTS_FUN_DECL(stg_maskAsyncExceptionszh);
434 RTS_FUN_DECL(stg_maskUninterruptiblezh);
435 RTS_FUN_DECL(stg_unmaskAsyncExceptionszh);
436 RTS_FUN_DECL(stg_myThreadIdzh);
437 RTS_FUN_DECL(stg_labelThreadzh);
438 RTS_FUN_DECL(stg_isCurrentThreadBoundzh);
439 RTS_FUN_DECL(stg_threadStatuszh);
440
441 RTS_FUN_DECL(stg_mkWeakzh);
442 RTS_FUN_DECL(stg_mkWeakNoFinalizzerzh);
443 RTS_FUN_DECL(stg_mkWeakForeignzh);
444 RTS_FUN_DECL(stg_addCFinalizzerToWeakzh);
445 RTS_FUN_DECL(stg_finalizzeWeakzh);
446 RTS_FUN_DECL(stg_deRefWeakzh);
447
448 RTS_FUN_DECL(stg_runRWzh);
449
450 RTS_FUN_DECL(stg_newBCOzh);
451 RTS_FUN_DECL(stg_mkApUpd0zh);
452
453 RTS_FUN_DECL(stg_retryzh);
454 RTS_FUN_DECL(stg_catchRetryzh);
455 RTS_FUN_DECL(stg_catchSTMzh);
456 RTS_FUN_DECL(stg_atomicallyzh);
457 RTS_FUN_DECL(stg_newTVarzh);
458 RTS_FUN_DECL(stg_readTVarzh);
459 RTS_FUN_DECL(stg_readTVarIOzh);
460 RTS_FUN_DECL(stg_writeTVarzh);
461 RTS_FUN_DECL(stg_checkzh);
462
463 RTS_FUN_DECL(stg_unpackClosurezh);
464 RTS_FUN_DECL(stg_getApStackValzh);
465 RTS_FUN_DECL(stg_getSparkzh);
466 RTS_FUN_DECL(stg_numSparkszh);
467
468 RTS_FUN_DECL(stg_noDuplicatezh);
469
470 RTS_FUN_DECL(stg_traceCcszh);
471 RTS_FUN_DECL(stg_clearCCSzh);
472 RTS_FUN_DECL(stg_traceEventzh);
473 RTS_FUN_DECL(stg_traceMarkerzh);
474
475 /* Other misc stuff */
476 // See wiki:Commentary/Compiler/Backends/PprC#Prototypes
477
478 #if IN_STG_CODE && !IN_STGCRUN
479
480 // Interpreter.c
481 extern StgWord rts_stop_next_breakpoint[];
482 extern StgWord rts_stop_on_exception[];
483 extern StgWord rts_breakpoint_io_action[];
484
485 // Schedule.c
486 extern StgWord RTS_VAR(blocked_queue_hd), RTS_VAR(blocked_queue_tl);
487 extern StgWord RTS_VAR(sleeping_queue);
488 extern StgWord RTS_VAR(sched_mutex);
489
490 // Apply.cmm
491 // canned bitmap for each arg type
492 extern StgWord stg_arg_bitmaps[];
493 extern StgWord stg_ap_stack_entries[];
494 extern StgWord stg_stack_save_entries[];
495
496 // Storage.c
497 extern unsigned int RTS_VAR(g0);
498 extern unsigned int RTS_VAR(large_alloc_lim);
499 extern StgWord RTS_VAR(atomic_modify_mutvar_mutex);
500
501 // RtsFlags
502 extern StgWord RTS_VAR(RtsFlags); // bogus type
503
504 // Stable.c
505 extern StgWord RTS_VAR(stable_ptr_table);
506 extern StgWord RTS_VAR(stable_name_table);
507
508 // Profiling.c
509 extern unsigned int RTS_VAR(era);
510 extern unsigned int RTS_VAR(entering_PAP);
511 extern StgWord RTS_VAR(CC_LIST); /* registered CC list */
512 extern StgWord RTS_VAR(CCS_LIST); /* registered CCS list */
513 extern StgWord CCS_OVERHEAD[];
514 extern StgWord CCS_SYSTEM[];
515 extern unsigned int RTS_VAR(CC_ID); /* global ids */
516 extern unsigned int RTS_VAR(CCS_ID);
517
518 // Calls to these rts functions are generated directly
519 // by codegen (see compiler/codeGen/StgCmmProf.hs)
520 // and don't require (don't emit) forward declarations.
521 //
522 // In unregisterised mode (when building via .hc files)
523 // the calls are ordinary C calls. Functions must be in
524 // scope and must match prototype assumed by
525 // 'compiler/codeGen/StgCmmProf.hs'
526 // as opposed to real prototype declared in
527 // 'includes/rts/prof/CCS.h'
528 void enterFunCCS (void *reg, void *ccsfn);
529 void * pushCostCentre (void *ccs, void *cc);
530
531 // Capability.c
532 extern unsigned int n_capabilities;
533
534 #endif
535
536 #endif /* STGMISCCLOSURES_H */