a90d27c064f4d60458a09512fc5cdf32ef8a9b82
[mono.git] / mono / utils / gc_wrapper.h
1 /* 
2  * Copyright 2004-2011 Novell, Inc (http://www.novell.com)
3  * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
4  */
5 #ifndef __MONO_OS_GC_WRAPPER_H__
6 #define __MONO_OS_GC_WRAPPER_H__
7
8 #include <config.h>
9 #include <stdlib.h>
10
11 #ifdef HAVE_BOEHM_GC
12
13 #       ifdef _MSC_VER
14 #               include <winsock2.h>
15 #       else
16                 /* libgc specifies this on the command line,
17                  * so we must define it ourselfs
18                 */
19 #               define GC_GCJ_SUPPORT
20 #       endif
21
22         /*
23          * Local allocation is only beneficial if we have __thread
24          * We had to fix a bug with include order in libgc, so only do
25          * it if it is the included one.
26          */
27         
28 #       if defined(HAVE_KW_THREAD) && !defined(__powerpc__)
29         /* The local alloc stuff is in pthread_support.c, but solaris uses solaris_threads.c */
30         /* It is also disabled on solaris/x86 by libgc/configure.ac */
31         /* 
32                  * ARM has no definition for some atomic functions in gc_locks.h and
33                  * support is also disabled in libgc/configure.ac.
34                  */
35 #       if !defined(__sparc__) && !defined(__sun) && !defined(__arm__) && !defined(__mips__)
36 #                   define GC_REDIRECT_TO_LOCAL
37 #       endif
38 #       endif
39
40 #       define GC_INSIDE_DLL
41 #       include <gc.h>
42 #       include <gc_typed.h>
43 #       include <gc_mark.h>
44 #       include <gc_gcj.h>
45
46 #if defined(HOST_WIN32)
47 #define CreateThread GC_CreateThread
48 #endif
49
50 #elif defined(HAVE_SGEN_GC)
51
52 #else /* not Boehm and not sgen GC */
53 #endif
54
55 #endif