[project @ 2004-10-15 07:48:29 by simonmar]
[ghc-hetmet.git] / ghc / includes / RtsExternal.h
1 /* -----------------------------------------------------------------------------
2  * $Id: RtsExternal.h,v 1.6 2004/10/15 07:48:29 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-2004
5  *
6  * Things visible externally to the RTS
7  *
8  * -------------------------------------------------------------------------- */
9
10 #ifndef RTSEXTERNAL_H
11 #define RTSEXTERNAL_H
12
13 /* The RTS public interface. */
14 #include "RtsAPI.h"
15
16 /* The standard FFI interface */
17 #include "HsFFI.h"
18
19 /* -----------------------------------------------------------------------------
20    Functions exported by the RTS for use in Stg code
21    -------------------------------------------------------------------------- */
22
23 #if IN_STG_CODE
24 extern void newCAF(void*);
25 #else
26 extern void newCAF(StgClosure*);
27 #endif
28
29 /* ToDo: remove? */
30 extern I_ genSymZh(void);
31 extern I_ resetGenSymZh(void);
32
33 /* Alternate to raise(3) for threaded rts, for OpenBSD */
34 extern int genericRaise(int sig);
35
36 /* Concurrency/Exception PrimOps. */
37 extern int cmp_thread(StgPtr tso1, StgPtr tso2);
38 extern int rts_getThreadId(StgPtr tso);
39 extern int forkOS_createThread ( HsStablePtr entry );
40 extern StgInt forkProcess(HsStablePtr *entry);
41 extern StgBool rtsSupportsBoundThreads(void);
42
43 /* grimy low-level support functions defined in StgPrimFloat.c */
44 extern StgDouble __encodeDouble (I_ size, StgByteArray arr, I_ e);
45 extern StgDouble __int_encodeDouble (I_ j, I_ e);
46 extern StgFloat  __encodeFloat (I_ size, StgByteArray arr, I_ e);
47 extern StgFloat  __int_encodeFloat (I_ j, I_ e);
48 extern StgInt    isDoubleNaN(StgDouble d);
49 extern StgInt    isDoubleInfinite(StgDouble d);
50 extern StgInt    isDoubleDenormalized(StgDouble d);
51 extern StgInt    isDoubleNegativeZero(StgDouble d);
52 extern StgInt    isFloatNaN(StgFloat f);
53 extern StgInt    isFloatInfinite(StgFloat f);
54 extern StgInt    isFloatDenormalized(StgFloat f);
55 extern StgInt    isFloatNegativeZero(StgFloat f);
56
57 /* Suspending/resuming threads around foreign calls */
58 extern StgInt        suspendThread ( StgRegTable * );
59 extern StgRegTable * resumeThread  ( StgInt );
60
61 /* Creating and destroying an adjustor thunk */
62 extern void*  createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
63 extern void   freeHaskellFunctionPtr(void* ptr);
64
65 /* -----------------------------------------------------------------------------
66    Storage manager stuff exported
67    -------------------------------------------------------------------------- */
68
69 /* Prototype for an evacuate-like function */
70 typedef void (*evac_fn)(StgClosure **);
71
72 extern void performGC(void);
73 extern void performMajorGC(void);
74 extern void performGCWithRoots(void (*get_roots)(evac_fn));
75
76 #endif /*  RTSEXTERNAL_H */