[project @ 2004-08-13 13:04:50 by simonmar]
[ghc-hetmet.git] / ghc / includes / RtsExternal.h
1 /* -----------------------------------------------------------------------------
2  * $Id: RtsExternal.h,v 1.2 2004/08/13 13:09: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 /* Concurrency/Exception PrimOps. */
34 extern int cmp_thread(StgPtr tso1, StgPtr tso2);
35 extern int rts_getThreadId(StgPtr tso);
36 extern int forkOS_createThread ( HsStablePtr entry );
37
38 /* grimy low-level support functions defined in StgPrimFloat.c */
39 extern StgDouble __encodeDouble (I_ size, StgByteArray arr, I_ e);
40 extern StgDouble __int_encodeDouble (I_ j, I_ e);
41 extern StgFloat  __encodeFloat (I_ size, StgByteArray arr, I_ e);
42 extern StgFloat  __int_encodeFloat (I_ j, I_ e);
43 extern StgInt    isDoubleNaN(StgDouble d);
44 extern StgInt    isDoubleInfinite(StgDouble d);
45 extern StgInt    isDoubleDenormalized(StgDouble d);
46 extern StgInt    isDoubleNegativeZero(StgDouble d);
47 extern StgInt    isFloatNaN(StgFloat f);
48 extern StgInt    isFloatInfinite(StgFloat f);
49 extern StgInt    isFloatDenormalized(StgFloat f);
50 extern StgInt    isFloatNegativeZero(StgFloat f);
51
52 /* Suspending/resuming threads around foreign calls */
53 extern StgInt        suspendThread ( StgRegTable * );
54 extern StgRegTable * resumeThread  ( StgInt );
55
56 /* -----------------------------------------------------------------------------
57    Storage manager stuff exported
58    -------------------------------------------------------------------------- */
59
60 /* Prototype for an evacuate-like function */
61 typedef void (*evac_fn)(StgClosure **);
62
63 extern void performGC(void);
64 extern void performMajorGC(void);
65 extern void performGCWithRoots(void (*get_roots)(evac_fn));
66
67 #endif /*  RTSEXTERNAL_H */