MiscClosures.h 15.7 KB
Newer Older
1 2
/* ----------------------------------------------------------------------------
 *
3
 * (c) The GHC Team, 1998-2009
4
 *
5
 * Declarations for various symbols exported by the RTS.
6
 *
7 8 9
 * ToDo: many of the symbols in here don't need to be exported, but
 * our Cmm code generator doesn't know how to generate local symbols
 * for the RTS bits (it assumes all RTS symbols are external).
10
 *
11
 * See wiki:commentary/compiler/backends/ppr-c#prototypes
12
 *
13 14 15
 * Do not #include this file directly: #include "Rts.h" instead.
 *
 * To understand the structure of the RTS headers, see the wiki:
16
 *   https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes
17
 *
18 19
 * --------------------------------------------------------------------------*/

20
#pragma once
21 22

#if IN_STG_CODE
23 24 25 26
#  define RTS_RET_INFO(i)   extern const W_(i)[]
#  define RTS_FUN_INFO(i)   extern const W_(i)[]
#  define RTS_THUNK_INFO(i) extern const W_(i)[]
#  define RTS_INFO(i)       extern const W_(i)[]
27
#  define RTS_CLOSURE(i)    extern W_(i)[]
28
#  define RTS_FUN_DECL(f)   extern DLL_IMPORT_RTS StgFunPtr f(void)
29 30 31 32 33
#else
#  define RTS_RET_INFO(i)   extern DLL_IMPORT_RTS const StgRetInfoTable i
#  define RTS_FUN_INFO(i)   extern DLL_IMPORT_RTS const StgFunInfoTable i
#  define RTS_THUNK_INFO(i) extern DLL_IMPORT_RTS const StgThunkInfoTable i
#  define RTS_INFO(i)       extern DLL_IMPORT_RTS const StgInfoTable i
34
#  define RTS_CLOSURE(i)    extern DLL_IMPORT_RTS StgClosure i
35
#  define RTS_FUN_DECL(f)   extern DLL_IMPORT_RTS StgFunPtr f(void)
36
#endif
37

38
#if defined(TABLES_NEXT_TO_CODE)
39 40 41 42
#  define RTS_RET(f)      RTS_INFO(f##_info)
#  define RTS_ENTRY(f)    RTS_INFO(f##_info)
#  define RTS_FUN(f)      RTS_FUN_INFO(f##_info)
#  define RTS_THUNK(f)    RTS_THUNK_INFO(f##_info)
43
#else
44 45 46 47
#  define RTS_RET(f)      RTS_INFO(f##_info);  RTS_FUN_DECL(f##_ret)
#  define RTS_ENTRY(f)    RTS_INFO(f##_info);  RTS_FUN_DECL(f##_entry)
#  define RTS_FUN(f)      RTS_FUN_INFO(f##_info); RTS_FUN_DECL(f##_entry)
#  define RTS_THUNK(f)    RTS_THUNK_INFO(f##_info); RTS_FUN_DECL(f##_entry)
48
#endif
49

50
/* Stack frames */
51 52 53 54 55 56 57 58 59
RTS_RET(stg_upd_frame);
RTS_RET(stg_bh_upd_frame);
RTS_RET(stg_marked_upd_frame);
RTS_RET(stg_noupd_frame);
RTS_RET(stg_catch_frame);
RTS_RET(stg_catch_retry_frame);
RTS_RET(stg_atomically_frame);
RTS_RET(stg_atomically_waiting_frame);
RTS_RET(stg_catch_stm_frame);
60 61 62
RTS_RET(stg_unmaskAsyncExceptionszh_ret);
RTS_RET(stg_maskUninterruptiblezh_ret);
RTS_RET(stg_maskAsyncExceptionszh_ret);
63
RTS_RET(stg_stack_underflow_frame);
64
RTS_RET(stg_restore_cccs);
Simon Marlow's avatar
Simon Marlow committed
65
RTS_RET(stg_restore_cccs_eval);
66

67 68 69 70 71 72 73
// RTS_FUN(stg_interp_constr1_entry);
// RTS_FUN(stg_interp_constr2_entry);
// RTS_FUN(stg_interp_constr3_entry);
// RTS_FUN(stg_interp_constr4_entry);
// RTS_FUN(stg_interp_constr5_entry);
// RTS_FUN(stg_interp_constr6_entry);
// RTS_FUN(stg_interp_constr7_entry);
74 75 76 77 78
//
// This is referenced using the FFI in the compiler (ByteCodeItbls),
// so we can't give it the correct type here because the prototypes
// would clash (FFI references are always declared with type StgWord[]
// in the generated C code).
79 80

/* Magic glue code for when compiled code returns a value in R1/F1/D1
81
   or a VoidRep to the interpreter. */
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
RTS_RET(stg_ctoi_R1p);
RTS_RET(stg_ctoi_R1unpt);
RTS_RET(stg_ctoi_R1n);
RTS_RET(stg_ctoi_F1);
RTS_RET(stg_ctoi_D1);
RTS_RET(stg_ctoi_L1);
RTS_RET(stg_ctoi_V);

RTS_RET(stg_apply_interp);

RTS_ENTRY(stg_IND);
RTS_ENTRY(stg_IND_direct);
RTS_ENTRY(stg_IND_STATIC);
RTS_ENTRY(stg_BLACKHOLE);
RTS_ENTRY(stg_CAF_BLACKHOLE);
RTS_ENTRY(__stg_EAGER_BLACKHOLE);
RTS_ENTRY(stg_WHITEHOLE);
RTS_ENTRY(stg_BLOCKING_QUEUE_CLEAN);
RTS_ENTRY(stg_BLOCKING_QUEUE_DIRTY);

RTS_FUN(stg_BCO);
RTS_ENTRY(stg_EVACUATED);
RTS_ENTRY(stg_WEAK);
RTS_ENTRY(stg_DEAD_WEAK);
106
RTS_ENTRY(stg_C_FINALIZER_LIST);
107 108 109
RTS_ENTRY(stg_STABLE_NAME);
RTS_ENTRY(stg_MVAR_CLEAN);
RTS_ENTRY(stg_MVAR_DIRTY);
110 111
RTS_ENTRY(stg_TVAR_CLEAN);
RTS_ENTRY(stg_TVAR_DIRTY);
112
RTS_ENTRY(stg_TSO);
113
RTS_ENTRY(stg_STACK);
114
RTS_ENTRY(stg_RUBBISH_ENTRY);
115 116 117 118
RTS_ENTRY(stg_ARR_WORDS);
RTS_ENTRY(stg_MUT_ARR_WORDS);
RTS_ENTRY(stg_MUT_ARR_PTRS_CLEAN);
RTS_ENTRY(stg_MUT_ARR_PTRS_DIRTY);
119 120
RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN_CLEAN);
RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN_DIRTY);
121 122
RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_CLEAN);
RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_DIRTY);
123 124
RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN_CLEAN);
RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN_DIRTY);
125 126 127
RTS_ENTRY(stg_MUT_VAR_CLEAN);
RTS_ENTRY(stg_MUT_VAR_DIRTY);
RTS_ENTRY(stg_END_TSO_QUEUE);
128
RTS_ENTRY(stg_GCD_CAF);
Ben Gamari's avatar
Ben Gamari committed
129
RTS_ENTRY(stg_STM_AWOKEN);
130 131 132 133 134 135 136 137 138 139
RTS_ENTRY(stg_MSG_TRY_WAKEUP);
RTS_ENTRY(stg_MSG_THROWTO);
RTS_ENTRY(stg_MSG_BLACKHOLE);
RTS_ENTRY(stg_MSG_NULL);
RTS_ENTRY(stg_MVAR_TSO_QUEUE);
RTS_ENTRY(stg_catch);
RTS_ENTRY(stg_PAP);
RTS_ENTRY(stg_AP);
RTS_ENTRY(stg_AP_NOUPD);
RTS_ENTRY(stg_AP_STACK);
140
RTS_ENTRY(stg_AP_STACK_NOUPD);
141 142 143
RTS_ENTRY(stg_dummy_ret);
RTS_ENTRY(stg_raise);
RTS_ENTRY(stg_raise_ret);
144
RTS_ENTRY(stg_atomically);
145 146 147 148 149 150
RTS_ENTRY(stg_TVAR_WATCH_QUEUE);
RTS_ENTRY(stg_TREC_CHUNK);
RTS_ENTRY(stg_TREC_HEADER);
RTS_ENTRY(stg_END_STM_WATCH_QUEUE);
RTS_ENTRY(stg_END_STM_CHUNK_LIST);
RTS_ENTRY(stg_NO_TREC);
151 152
RTS_ENTRY(stg_COMPACT_NFDATA_CLEAN);
RTS_ENTRY(stg_COMPACT_NFDATA_DIRTY);
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
RTS_ENTRY(stg_SRT_1);
RTS_ENTRY(stg_SRT_2);
RTS_ENTRY(stg_SRT_3);
RTS_ENTRY(stg_SRT_4);
RTS_ENTRY(stg_SRT_5);
RTS_ENTRY(stg_SRT_6);
RTS_ENTRY(stg_SRT_7);
RTS_ENTRY(stg_SRT_8);
RTS_ENTRY(stg_SRT_9);
RTS_ENTRY(stg_SRT_10);
RTS_ENTRY(stg_SRT_11);
RTS_ENTRY(stg_SRT_12);
RTS_ENTRY(stg_SRT_13);
RTS_ENTRY(stg_SRT_14);
RTS_ENTRY(stg_SRT_15);
RTS_ENTRY(stg_SRT_16);
169

170 171
/* closures */

172 173 174 175 176
RTS_CLOSURE(stg_END_TSO_QUEUE_closure);
RTS_CLOSURE(stg_STM_AWOKEN_closure);
RTS_CLOSURE(stg_NO_FINALIZER_closure);
RTS_CLOSURE(stg_dummy_ret_closure);
RTS_CLOSURE(stg_forceIO_closure);
177

178 179 180
RTS_CLOSURE(stg_END_STM_WATCH_QUEUE_closure);
RTS_CLOSURE(stg_END_STM_CHUNK_LIST_closure);
RTS_CLOSURE(stg_NO_TREC_closure);
181

182
RTS_ENTRY(stg_NO_FINALIZER_entry);
183

184
#if IN_STG_CODE
185 186
extern DLL_IMPORT_RTS StgWordArray stg_CHARLIKE_closure;
extern DLL_IMPORT_RTS StgWordArray stg_INTLIKE_closure;
187
#else
188 189
extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_closure[];
extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_closure[];
190 191 192 193
#endif

/* StgStartup */

194 195
RTS_RET(stg_forceIO);
RTS_RET(stg_noforceIO);
196

197
/* standard entry points */
198

199 200
/* standard selector thunks */

201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
RTS_ENTRY(stg_sel_0_upd);
RTS_ENTRY(stg_sel_1_upd);
RTS_ENTRY(stg_sel_2_upd);
RTS_ENTRY(stg_sel_3_upd);
RTS_ENTRY(stg_sel_4_upd);
RTS_ENTRY(stg_sel_5_upd);
RTS_ENTRY(stg_sel_6_upd);
RTS_ENTRY(stg_sel_7_upd);
RTS_ENTRY(stg_sel_8_upd);
RTS_ENTRY(stg_sel_9_upd);
RTS_ENTRY(stg_sel_10_upd);
RTS_ENTRY(stg_sel_11_upd);
RTS_ENTRY(stg_sel_12_upd);
RTS_ENTRY(stg_sel_13_upd);
RTS_ENTRY(stg_sel_14_upd);
RTS_ENTRY(stg_sel_15_upd);

RTS_ENTRY(stg_sel_0_noupd);
RTS_ENTRY(stg_sel_1_noupd);
RTS_ENTRY(stg_sel_2_noupd);
RTS_ENTRY(stg_sel_3_noupd);
RTS_ENTRY(stg_sel_4_noupd);
RTS_ENTRY(stg_sel_5_noupd);
RTS_ENTRY(stg_sel_6_noupd);
RTS_ENTRY(stg_sel_7_noupd);
RTS_ENTRY(stg_sel_8_noupd);
RTS_ENTRY(stg_sel_9_noupd);
RTS_ENTRY(stg_sel_10_noupd);
RTS_ENTRY(stg_sel_11_noupd);
RTS_ENTRY(stg_sel_12_noupd);
RTS_ENTRY(stg_sel_13_noupd);
RTS_ENTRY(stg_sel_14_noupd);
RTS_ENTRY(stg_sel_15_noupd);
234 235 236

/* standard ap thunks */

237 238 239 240 241 242 243
RTS_THUNK(stg_ap_1_upd);
RTS_THUNK(stg_ap_2_upd);
RTS_THUNK(stg_ap_3_upd);
RTS_THUNK(stg_ap_4_upd);
RTS_THUNK(stg_ap_5_upd);
RTS_THUNK(stg_ap_6_upd);
RTS_THUNK(stg_ap_7_upd);
244

245
/* standard application routines (see also utils/genapply,
246
 * and GHC.StgToCmm.ArgRep).
247
 */
248 249 250 251
RTS_RET(stg_ap_v);
RTS_RET(stg_ap_f);
RTS_RET(stg_ap_d);
RTS_RET(stg_ap_l);
252
RTS_RET(stg_ap_v16);
253
RTS_RET(stg_ap_v32);
254
RTS_RET(stg_ap_v64);
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
RTS_RET(stg_ap_n);
RTS_RET(stg_ap_p);
RTS_RET(stg_ap_pv);
RTS_RET(stg_ap_pp);
RTS_RET(stg_ap_ppv);
RTS_RET(stg_ap_ppp);
RTS_RET(stg_ap_pppv);
RTS_RET(stg_ap_pppp);
RTS_RET(stg_ap_ppppp);
RTS_RET(stg_ap_pppppp);

RTS_FUN_DECL(stg_ap_0_fast);
RTS_FUN_DECL(stg_ap_v_fast);
RTS_FUN_DECL(stg_ap_f_fast);
RTS_FUN_DECL(stg_ap_d_fast);
RTS_FUN_DECL(stg_ap_l_fast);
271
RTS_FUN_DECL(stg_ap_v16_fast);
272
RTS_FUN_DECL(stg_ap_v32_fast);
273
RTS_FUN_DECL(stg_ap_v64_fast);
274 275 276 277 278 279 280 281 282 283 284
RTS_FUN_DECL(stg_ap_n_fast);
RTS_FUN_DECL(stg_ap_p_fast);
RTS_FUN_DECL(stg_ap_pv_fast);
RTS_FUN_DECL(stg_ap_pp_fast);
RTS_FUN_DECL(stg_ap_ppv_fast);
RTS_FUN_DECL(stg_ap_ppp_fast);
RTS_FUN_DECL(stg_ap_pppv_fast);
RTS_FUN_DECL(stg_ap_pppp_fast);
RTS_FUN_DECL(stg_ap_ppppp_fast);
RTS_FUN_DECL(stg_ap_pppppp_fast);
RTS_FUN_DECL(stg_PAP_apply);
285

286
/* standard GC & stack check entry points, all defined in HeapStackCheck.cmm */
287

288 289 290 291 292 293 294 295
RTS_FUN_DECL(stg_gc_noregs);

RTS_RET(stg_ret_v);
RTS_RET(stg_ret_p);
RTS_RET(stg_ret_n);
RTS_RET(stg_ret_f);
RTS_RET(stg_ret_d);
RTS_RET(stg_ret_l);
296

297
RTS_FUN_DECL(stg_gc_prim);
298 299 300 301
RTS_FUN_DECL(stg_gc_prim_p);
RTS_FUN_DECL(stg_gc_prim_pp);
RTS_FUN_DECL(stg_gc_prim_n);

302 303 304
RTS_RET(stg_gc_prim_p_ll_ret);
RTS_FUN_DECL(stg_gc_prim_p_ll);

305
RTS_RET(stg_enter);
306 307 308 309 310 311 312
RTS_FUN_DECL(__stg_gc_enter_1);

RTS_FUN_DECL(stg_gc_unpt_r1);
RTS_FUN_DECL(stg_gc_unbx_r1);
RTS_FUN_DECL(stg_gc_f1);
RTS_FUN_DECL(stg_gc_d1);
RTS_FUN_DECL(stg_gc_l1);
313 314 315
RTS_FUN_DECL(stg_gc_pp);
RTS_FUN_DECL(stg_gc_ppp);
RTS_FUN_DECL(stg_gc_pppp);
316 317 318 319 320 321 322 323 324 325

RTS_RET(stg_gc_fun);
RTS_FUN_DECL(__stg_gc_fun);

RTS_FUN_DECL(stg_yield_noregs);
RTS_FUN_DECL(stg_yield_to_interpreter);
RTS_FUN_DECL(stg_block_noregs);
RTS_FUN_DECL(stg_block_blackhole);
RTS_FUN_DECL(stg_block_blackhole_finally);
RTS_FUN_DECL(stg_block_takemvar);
326
RTS_FUN_DECL(stg_block_readmvar);
327
RTS_RET(stg_block_takemvar);
328
RTS_RET(stg_block_readmvar);
329 330
RTS_FUN_DECL(stg_block_putmvar);
RTS_RET(stg_block_putmvar);
331
#if defined(mingw32_HOST_OS)
332 333 334 335
RTS_FUN_DECL(stg_block_async);
RTS_RET(stg_block_async);
RTS_FUN_DECL(stg_block_async_void);
RTS_RET(stg_block_async_void);
336
#endif
337 338 339
RTS_FUN_DECL(stg_block_stmwait);
RTS_FUN_DECL(stg_block_throwto);
RTS_RET(stg_block_throwto);
340 341 342

/* Entry/exit points from StgStartup.cmm */

343
RTS_RET(stg_stop_thread);
344

345 346 347 348 349
RTS_FUN_DECL(stg_returnToStackTop);
RTS_FUN_DECL(stg_returnToSched);
RTS_FUN_DECL(stg_returnToSchedNotPaused);
RTS_FUN_DECL(stg_returnToSchedButFirst);
RTS_FUN_DECL(stg_threadFinished);
350

351
RTS_FUN_DECL(StgReturn);
352

353 354 355 356
/* -----------------------------------------------------------------------------
   PrimOps
   -------------------------------------------------------------------------- */

357 358
RTS_FUN_DECL(stg_decodeFloatzuIntzh);
RTS_FUN_DECL(stg_decodeDoublezu2Intzh);
359
RTS_FUN_DECL(stg_decodeDoublezuInt64zh);
360 361

RTS_FUN_DECL(stg_unsafeThawArrayzh);
362
RTS_FUN_DECL(stg_casArrayzh);
363 364 365
RTS_FUN_DECL(stg_newByteArrayzh);
RTS_FUN_DECL(stg_newPinnedByteArrayzh);
RTS_FUN_DECL(stg_newAlignedPinnedByteArrayzh);
366 367
RTS_FUN_DECL(stg_isByteArrayPinnedzh);
RTS_FUN_DECL(stg_isMutableByteArrayPinnedzh);
368
RTS_FUN_DECL(stg_shrinkMutableByteArrayzh);
369
RTS_FUN_DECL(stg_resizzeMutableByteArrayzh);
370
RTS_FUN_DECL(stg_shrinkSmallMutableArrayzh);
371
RTS_FUN_DECL(stg_casIntArrayzh);
372
RTS_FUN_DECL(stg_newArrayzh);
373
RTS_FUN_DECL(stg_newArrayArrayzh);
tibbe's avatar
tibbe committed
374 375 376 377
RTS_FUN_DECL(stg_copyArrayzh);
RTS_FUN_DECL(stg_copyMutableArrayzh);
RTS_FUN_DECL(stg_copyArrayArrayzh);
RTS_FUN_DECL(stg_copyMutableArrayArrayzh);
378 379 380 381
RTS_FUN_DECL(stg_cloneArrayzh);
RTS_FUN_DECL(stg_cloneMutableArrayzh);
RTS_FUN_DECL(stg_freezzeArrayzh);
RTS_FUN_DECL(stg_thawArrayzh);
382

383 384 385 386 387 388 389 390 391 392
RTS_FUN_DECL(stg_newSmallArrayzh);
RTS_FUN_DECL(stg_unsafeThawSmallArrayzh);
RTS_FUN_DECL(stg_cloneSmallArrayzh);
RTS_FUN_DECL(stg_cloneSmallMutableArrayzh);
RTS_FUN_DECL(stg_freezzeSmallArrayzh);
RTS_FUN_DECL(stg_thawSmallArrayzh);
RTS_FUN_DECL(stg_copySmallArrayzh);
RTS_FUN_DECL(stg_copySmallMutableArrayzh);
RTS_FUN_DECL(stg_casSmallArrayzh);

393
RTS_FUN_DECL(stg_newMutVarzh);
394 395
RTS_FUN_DECL(stg_atomicModifyMutVar2zh);
RTS_FUN_DECL(stg_atomicModifyMutVarzuzh);
Simon Marlow's avatar
Simon Marlow committed
396
RTS_FUN_DECL(stg_casMutVarzh);
397 398 399 400 401

RTS_FUN_DECL(stg_isEmptyMVarzh);
RTS_FUN_DECL(stg_newMVarzh);
RTS_FUN_DECL(stg_takeMVarzh);
RTS_FUN_DECL(stg_putMVarzh);
402
RTS_FUN_DECL(stg_readMVarzh);
403 404
RTS_FUN_DECL(stg_tryTakeMVarzh);
RTS_FUN_DECL(stg_tryPutMVarzh);
405
RTS_FUN_DECL(stg_tryReadMVarzh);
406 407 408 409

RTS_FUN_DECL(stg_waitReadzh);
RTS_FUN_DECL(stg_waitWritezh);
RTS_FUN_DECL(stg_delayzh);
410
#if defined(mingw32_HOST_OS)
411 412 413
RTS_FUN_DECL(stg_asyncReadzh);
RTS_FUN_DECL(stg_asyncWritezh);
RTS_FUN_DECL(stg_asyncDoProczh);
414
#endif
415

416 417 418 419 420 421 422 423
RTS_FUN_DECL(stg_catchzh);
RTS_FUN_DECL(stg_raisezh);
RTS_FUN_DECL(stg_raiseIOzh);

RTS_FUN_DECL(stg_makeStableNamezh);
RTS_FUN_DECL(stg_makeStablePtrzh);
RTS_FUN_DECL(stg_deRefStablePtrzh);

424 425
RTS_FUN_DECL(stg_compactAddzh);
RTS_FUN_DECL(stg_compactAddWithSharingzh);
gcampax's avatar
gcampax committed
426 427 428 429 430 431 432 433 434 435
RTS_FUN_DECL(stg_compactNewzh);
RTS_FUN_DECL(stg_compactAppendzh);
RTS_FUN_DECL(stg_compactResizzezh);
RTS_FUN_DECL(stg_compactGetRootzh);
RTS_FUN_DECL(stg_compactContainszh);
RTS_FUN_DECL(stg_compactContainsAnyzh);
RTS_FUN_DECL(stg_compactGetFirstBlockzh);
RTS_FUN_DECL(stg_compactGetNextBlockzh);
RTS_FUN_DECL(stg_compactAllocateBlockzh);
RTS_FUN_DECL(stg_compactFixupPointerszh);
436
RTS_FUN_DECL(stg_compactSizzezh);
gcampax's avatar
gcampax committed
437

438 439 440
RTS_FUN_DECL(stg_forkzh);
RTS_FUN_DECL(stg_forkOnzh);
RTS_FUN_DECL(stg_yieldzh);
441
RTS_FUN_DECL(stg_killMyself);
442
RTS_FUN_DECL(stg_killThreadzh);
443 444 445 446
RTS_FUN_DECL(stg_getMaskingStatezh);
RTS_FUN_DECL(stg_maskAsyncExceptionszh);
RTS_FUN_DECL(stg_maskUninterruptiblezh);
RTS_FUN_DECL(stg_unmaskAsyncExceptionszh);
447 448 449 450 451 452
RTS_FUN_DECL(stg_myThreadIdzh);
RTS_FUN_DECL(stg_labelThreadzh);
RTS_FUN_DECL(stg_isCurrentThreadBoundzh);
RTS_FUN_DECL(stg_threadStatuszh);

RTS_FUN_DECL(stg_mkWeakzh);
453
RTS_FUN_DECL(stg_mkWeakNoFinalizzerzh);
454
RTS_FUN_DECL(stg_mkWeakForeignzh);
455
RTS_FUN_DECL(stg_addCFinalizzerToWeakzh);
456 457 458
RTS_FUN_DECL(stg_finalizzeWeakzh);
RTS_FUN_DECL(stg_deRefWeakzh);

459 460
RTS_FUN_DECL(stg_runRWzh);

461 462 463 464 465 466 467 468 469 470 471 472 473
RTS_FUN_DECL(stg_newBCOzh);
RTS_FUN_DECL(stg_mkApUpd0zh);

RTS_FUN_DECL(stg_retryzh);
RTS_FUN_DECL(stg_catchRetryzh);
RTS_FUN_DECL(stg_catchSTMzh);
RTS_FUN_DECL(stg_atomicallyzh);
RTS_FUN_DECL(stg_newTVarzh);
RTS_FUN_DECL(stg_readTVarzh);
RTS_FUN_DECL(stg_readTVarIOzh);
RTS_FUN_DECL(stg_writeTVarzh);

RTS_FUN_DECL(stg_unpackClosurezh);
474
RTS_FUN_DECL(stg_closureSizzezh);
475 476
RTS_FUN_DECL(stg_getApStackValzh);
RTS_FUN_DECL(stg_getSparkzh);
477
RTS_FUN_DECL(stg_numSparkszh);
478 479 480 481

RTS_FUN_DECL(stg_noDuplicatezh);

RTS_FUN_DECL(stg_traceCcszh);
482
RTS_FUN_DECL(stg_clearCCSzh);
483
RTS_FUN_DECL(stg_traceEventzh);
484
RTS_FUN_DECL(stg_traceBinaryEventzh);
485
RTS_FUN_DECL(stg_traceMarkerzh);
486 487 488
RTS_FUN_DECL(stg_getThreadAllocationCounterzh);
RTS_FUN_DECL(stg_setThreadAllocationCounterzh);

489

490
/* Other misc stuff */
491
// See wiki:commentary/compiler/backends/ppr-c#prototypes
492 493 494

#if IN_STG_CODE && !IN_STGCRUN

495 496 497 498 499
// Interpreter.c
extern StgWord rts_stop_next_breakpoint[];
extern StgWord rts_stop_on_exception[];
extern StgWord rts_breakpoint_io_action[];

500 501 502 503 504 505 506
// Schedule.c
extern StgWord RTS_VAR(blocked_queue_hd), RTS_VAR(blocked_queue_tl);
extern StgWord RTS_VAR(sleeping_queue);
extern StgWord RTS_VAR(sched_mutex);

// Apply.cmm
// canned bitmap for each arg type
507 508 509
extern const StgWord stg_arg_bitmaps[];
extern const StgWord stg_ap_stack_entries[];
extern const StgWord stg_stack_save_entries[];
510 511

// Storage.c
512
extern unsigned int RTS_VAR(g0);
513
extern unsigned int RTS_VAR(large_alloc_lim);
514 515 516 517 518
extern StgWord RTS_VAR(atomic_modify_mutvar_mutex);

// RtsFlags
extern StgWord RTS_VAR(RtsFlags); // bogus type

David Feuer's avatar
David Feuer committed
519
// StablePtr.c
520
extern StgWord RTS_VAR(stable_ptr_table);
David Feuer's avatar
David Feuer committed
521 522

// StableName.c
523
extern StgWord RTS_VAR(stable_name_table);
524 525 526 527

// Profiling.c
extern unsigned int RTS_VAR(era);
extern unsigned int RTS_VAR(entering_PAP);
528
extern StgWord      CCS_OVERHEAD[];
529
extern StgWord      CCS_SYSTEM[];
530 531

// Calls to these rts functions are generated directly
532
// by codegen (see GHC.StgToCmm.Prof)
533 534 535 536 537
// and don't require (don't emit) forward declarations.
//
// In unregisterised mode (when building via .hc files)
// the calls are ordinary C calls. Functions must be in
// scope and must match prototype assumed by
538
//    'GHC.StgToCmm.Prof'
539 540 541 542
// as opposed to real prototype declared in
//    'includes/rts/prof/CCS.h'
void enterFunCCS (void *reg, void *ccsfn);
void * pushCostCentre (void *ccs, void *cc);
543

544 545
// Capability.c
extern unsigned int n_capabilities;
Ben Gamari's avatar
Ben Gamari committed
546 547 548 549 550 551 552

/* -----------------------------------------------------------------------------
   Nonmoving GC write barrier
   -------------------------------------------------------------------------- */

#include <rts/NonMoving.h>

553

554
#endif