buildscript options to enable exaclty which coreprof events are needed, keeps instrum...
[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 m, int size);
27 void * mycalloc_i(int m, int size);
28 void myfree(void * ptr);
29 #define RUNMALLOC(x) mycalloc(1,x) // handle interruption inside
30 #define RUNMALLOC_I(x) mycalloc_i(1,x) //with interruption blocked beforehand
31 #define RUNFREE(x) myfree(x)
32 #ifdef MULTICORE_GC
33 #include "multicoregc.h"
34 void * mycalloc_share(struct garbagelist * stackptr, int m, int size);
35 void * mycalloc_share_ngc(int m, int size);
36 void * mycalloc_share_ngc_I(int m, int size);
37 void mycalloc_free_ngc(void * ptr);
38 void mycalloc_free_ngc_I(void * ptr);
39 #define FREEMALLOC(s, x) mycalloc_share((s),1,(x))
40 #define FREEMALLOC_NGC(x) mycalloc_share_ngc(1, (x))
41 #define FREEMALLOC_NGC_I(x) mycalloc_share_ngc_I(1, (x))
42 #define FREE_NGC(x) mycalloc_free_ngc(x)
43 #define FREE_NGC_I(x) mycalloc_free_ngc_I(x)
44 #else
45 void * mycalloc_share(int m, int size);
46 #define FREEMALLOC(x) mycalloc_share(1,x)
47 #endif // #ifdef MULTICORE_GC
48 //#define PTR(x) (32+(x-1)&~31)
49 #endif  // #ifdef MULTICORE
50 #endif  // #ifdef PRECISE_GC
51 #endif  // #ifdef BOEHM_GC
52 #endif  // #ifdef MEMH