changes.
[IRC.git] / Robust / src / Runtime / mem.h
1 #ifndef MEMH
2 #define MEMH
3 #include <stdlib.h>
4 #ifndef RAW
5 #include <stdio.h>
6 #endif
7
8 #ifdef BOEHM_GC
9 #include "gc.h"
10 #define FREEMALLOC(x) GC_malloc(x)
11 #define RUNMALLOC(x) GC_malloc(x)
12 #define RUNFREE(x)
13 #else
14 #ifdef PRECISE_GC
15 #include "garbage.h"
16 #ifdef COREPROF
17 #include "coreprof.h"
18 #define RUNMALLOC(x) cp_calloc(x)
19 #define RUNFREE(x) cp_free(x)
20 #else
21 #define RUNMALLOC(x) calloc(1,x)
22 #define RUNFREE(x) free(x)
23 #endif
24 #else
25 #ifdef MULTICORE
26 void * mycalloc(int size, char * file, int line);
27 void * mycalloc_i(int size, char * file, int line);
28 void myfree(void * ptr);
29 void myfree_i(void * ptr);
30
31 #define RUNMALLOC(x) mycalloc(x,__FILE__,__LINE__) // handle interruption inside
32 #define RUNCALLOC(x) mycalloc(x,__FILE__,__LINE__) // handle interruption inside
33 #define RUNMALLOC_I(x) mycalloc_i(x,__FILE__,__LINE__) //with interruption blocked beforehand
34 #define RUNCALLOC_I(x) mycalloc_i(x,__FILE__,__LINE__) //with interruption blocked beforehand
35
36 #define RUNFREE(x) myfree(x)
37 #define RUNFREE_I(x) myfree_i(x)
38 #if defined(MULTICORE_GC)||defined(PMC_GC)
39 #include "multicoregc.h"
40 void * mycalloc_share(struct garbagelist * stackptr, int size);
41 void * mycalloc_share_ngc(int size);
42 void * mycalloc_share_ngc_I(int size);
43 void mycalloc_free_ngc(void * ptr);
44 void mycalloc_free_ngc_I(void * ptr);
45 #define FREEMALLOC(s, x) mycalloc_share(s,x)
46 #else
47 void * mycalloc_share(int size);
48 #define FREEMALLOC(x) mycalloc_share(x)
49 #endif // #ifdef MULTICORE_GC
50 #endif  // #ifdef MULTICORE
51 #endif  // #ifdef PRECISE_GC
52 #endif  // #ifdef BOEHM_GC
53 #endif  // #ifdef MEMH