1 /* -----------------------------------------------------------------------------
2 * $Id: RtsExternal.h,v 1.8 2005/01/31 12:55:50 simonmar Exp $
4 * (c) The GHC Team, 1998-2004
6 * Things visible externally to the RTS
8 * -------------------------------------------------------------------------- */
13 /* The RTS public interface. */
16 /* The standard FFI interface */
19 /* -----------------------------------------------------------------------------
20 Functions exported by the RTS for use in Stg code
21 -------------------------------------------------------------------------- */
24 extern void newCAF(void*);
26 extern void newCAF(StgClosure*);
30 extern I_ genSymZh(void);
31 extern I_ resetGenSymZh(void);
33 /* Alternate to raise(3) for threaded rts, for OpenBSD */
34 extern int genericRaise(int sig);
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);
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);
57 /* Suspending/resuming threads around foreign calls */
58 extern StgInt suspendThread ( StgRegTable * );
59 extern StgRegTable * resumeThread ( StgInt );
61 /* Creating and destroying an adjustor thunk */
62 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr,
64 extern void freeHaskellFunctionPtr(void* ptr);
66 #if defined(mingw32_HOST_OS)
67 extern int stg_InstallConsoleEvent(int action, StgStablePtr *handler);
69 extern int stg_sig_install (int, int, StgStablePtr *, void *);
72 /* -----------------------------------------------------------------------------
73 Storage manager stuff exported
74 -------------------------------------------------------------------------- */
76 /* Prototype for an evacuate-like function */
77 typedef void (*evac_fn)(StgClosure **);
79 extern void performGC(void);
80 extern void performMajorGC(void);
81 extern void performGCWithRoots(void (*get_roots)(evac_fn));
83 #endif /* RTSEXTERNAL_H */