RtsUtils.h 1.23 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
#pragma once
10

11
#include "BeginPrivate.h"
12

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

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

20
void *stgMallocBytes(size_t n, char *msg)
21
    GNUC3_ATTRIBUTE(__malloc__);
22

23
void *stgReallocBytes(void *p, size_t n, char *msg);
24

25
void *stgCallocBytes(size_t n, size_t m, char *msg)
26
     GNUC3_ATTRIBUTE(__malloc__);
27

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

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

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

Simon Marlow's avatar
Simon Marlow committed
36
char *time_str(void);
Ben Gamari's avatar
Ben Gamari committed
37
char *showStgWord64(StgWord64, char *, bool);
38

Ben Gamari's avatar
Ben Gamari committed
39
#if defined(DEBUG)
Simon Marlow's avatar
Simon Marlow committed
40
void heapCheckFail( void );
sof's avatar
sof committed
41
#endif
42

43 44
void printRtsInfo(void);

45 46
void checkFPUStack(void);

47 48 49
#define xstr(s) str(s)
#define str(s) #s

50
#include "EndPrivate.h"