[utils] Explicitly check if the system has mincore instead of relying on mmap been...
[mono-project.git] / mono / metadata / mempool-internals.h
bloba317a669b9c63f6470fc2239fcfa4713625119e5
1 #ifndef _MONO_MEMPOOL_INTERNALS_H_
2 #define _MONO_MEMPOOL_INTERNALS_H_
4 #include <glib.h>
6 #include "mono/utils/mono-compiler.h"
7 #include "mono/metadata/mempool.h"
9 static inline GList*
10 g_list_prepend_mempool (MonoMemPool *mp, GList *list, gpointer data)
12 GList *new_list;
14 new_list = mono_mempool_alloc (mp, sizeof (GList));
15 new_list->data = data;
16 new_list->prev = list ? list->prev : NULL;
17 new_list->next = list;
19 if (new_list->prev)
20 new_list->prev->next = new_list;
21 if (list)
22 list->prev = new_list;
24 return new_list;
27 static inline GSList*
28 g_slist_prepend_mempool (MonoMemPool *mp, GSList *list, gpointer data)
30 GSList *new_list;
32 new_list = mono_mempool_alloc (mp, sizeof (GSList));
33 new_list->data = data;
34 new_list->next = list;
36 return new_list;
39 static inline GSList*
40 g_slist_append_mempool (MonoMemPool *mp, GSList *list, gpointer data)
42 GSList *new_list;
43 GSList *last;
45 new_list = mono_mempool_alloc (mp, sizeof (GSList));
46 new_list->data = data;
47 new_list->next = NULL;
49 if (list) {
50 last = list;
51 while (last->next)
52 last = last->next;
53 last->next = new_list;
55 return list;
56 } else
57 return new_list;
60 long
61 mono_mempool_get_bytes_allocated (void) MONO_INTERNAL;
63 #endif