RtsUtils.h 1.25 KB
Newer Older
1
/* -----------------------------------------------------------------------------
2
 *
Simon Marlow's avatar
Simon Marlow committed
3
 * (c) The GHC Team, 1998-2009
4 5 6 7 8
 *
 * General utility functions used in the RTS.
 *
 * ---------------------------------------------------------------------------*/

9 10 11
#ifndef RTSUTILS_H
#define RTSUTILS_H

12
#include "BeginPrivate.h"
13

14
/* -----------------------------------------------------------------------------
15
 * (Checked) dynamic allocation
16 17
 * -------------------------------------------------------------------------- */

Simon Marlow's avatar
Simon Marlow committed
18 19
void initAllocator(void);
void shutdownAllocator(void);
20

Simon Marlow's avatar
Simon Marlow committed
21
void *stgMallocBytes(int n, char *msg)
22
    GNUC3_ATTRIBUTE(__malloc__);
23

Simon Marlow's avatar
Simon Marlow committed
24
void *stgReallocBytes(void *p, int n, char *msg);
25

Simon Marlow's avatar
Simon Marlow committed
26
void *stgCallocBytes(int n, int m, char *msg)
27
     GNUC3_ATTRIBUTE(__malloc__);
28

Ben Gamari's avatar
Ben Gamari committed
29 30
char *stgStrndup(const char *s, size_t n);

Simon Marlow's avatar
Simon Marlow committed
31
void stgFree(void* p);
32

33 34 35
/* -----------------------------------------------------------------------------
 * Misc other utilities
 * -------------------------------------------------------------------------- */
36

Simon Marlow's avatar
Simon Marlow committed
37
void heapOverflow(void);
38

Simon Marlow's avatar
Simon Marlow committed
39
char *time_str(void);
Ian Lynagh's avatar
Ian Lynagh committed
40
char *showStgWord64(StgWord64, char *, rtsBool);
41

sof's avatar
sof committed
42
#ifdef DEBUG
Simon Marlow's avatar
Simon Marlow committed
43
void heapCheckFail( void );
sof's avatar
sof committed
44
#endif
45

46 47
void printRtsInfo(void);

48 49
void checkFPUStack(void);

50
#include "EndPrivate.h"
51

52
#endif /* RTSUTILS_H */