Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Taylor <elijahtaylor@google.com>2010-12-17 03:26:34 +0300
committerElijah Taylor <elijahtaylor@google.com>2010-12-17 03:26:34 +0300
commit06fa666aeeb53c7407db5c175a6c49f43a86dd34 (patch)
treeaf30b16bb697e1244e5c6058ecab77bc91dcff2e /libgc/include
parent9e73759b4d52ceed59cfe6fd53abbd9aff947f3d (diff)
Merged in rest of Native Client changes, untested
Diffstat (limited to 'libgc/include')
-rw-r--r--libgc/include/gc_pthread_redirects.h5
-rw-r--r--libgc/include/private/gc_priv.h2
-rw-r--r--libgc/include/private/gcconfig.h50
-rw-r--r--libgc/include/private/pthread_stop_world.h9
-rw-r--r--libgc/include/private/pthread_support.h3
5 files changed, 62 insertions, 7 deletions
diff --git a/libgc/include/gc_pthread_redirects.h b/libgc/include/gc_pthread_redirects.h
index bedcc26ac7e..520a36bf66c 100644
--- a/libgc/include/gc_pthread_redirects.h
+++ b/libgc/include/gc_pthread_redirects.h
@@ -59,6 +59,11 @@
#endif
int GC_pthread_join(pthread_t thread, void **retval);
int GC_pthread_detach(pthread_t thread);
+#if defined(__native_client__) || defined(NACL)
+ void GC_pthread_exit(void *status);
+# undef pthread_exit
+# define pthread_exit GC_pthread_exit
+#endif
#if defined(GC_OSF1_THREADS) \
&& defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_)
diff --git a/libgc/include/private/gc_priv.h b/libgc/include/private/gc_priv.h
index 2efb4732f79..5c4c5146ba2 100644
--- a/libgc/include/private/gc_priv.h
+++ b/libgc/include/private/gc_priv.h
@@ -1962,6 +1962,8 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
/* SPARC/Linux doesn't properly define SIGPWR in <signal.h>.
* It is aliased to SIGLOST in asm/signal.h, though. */
# define SIG_SUSPEND SIGLOST
+# elif defined(NACL)
+# define SIG_SUSPEND 0
# else
/* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */
# define SIG_SUSPEND SIGPWR
diff --git a/libgc/include/private/gcconfig.h b/libgc/include/private/gcconfig.h
index d1c46944bfe..8276079d91e 100644
--- a/libgc/include/private/gcconfig.h
+++ b/libgc/include/private/gcconfig.h
@@ -65,6 +65,11 @@
# endif
/* Determine the machine type: */
+# if defined(__native_client__)
+# define NACL
+# define I386
+# define mach_type_known
+# endif
# if defined(__arm__) || defined(__thumb__)
# define ARM32
# if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
@@ -1086,13 +1091,19 @@
# endif
# ifdef I386
-# define MACH_TYPE "I386"
-# if defined(__LP64__) || defined(_WIN64)
-# define CPP_WORDSZ 64
-# define ALIGNMENT 8
-# else
+# if defined( NACL )
+# define MACH_TYPE "NACL"
# define CPP_WORDSZ 32
# define ALIGNMENT 4
+# else
+# define MACH_TYPE "I386"
+# if defined(__LP64__) || defined(_WIN64)
+# define CPP_WORDSZ 64
+# define ALIGNMENT 8
+# else
+# define CPP_WORDSZ 32
+# define ALIGNMENT 4
+# endif
/* Appears to hold for all "32 bit" compilers */
/* except Borland. The -a4 option fixes */
/* Borland. */
@@ -1188,7 +1199,32 @@
# define HEAP_START DATAEND
# endif /* USE_MMAP */
# endif /* DGUX */
-
+# ifdef NACL
+# define OS_TYPE "NACL"
+ extern int etext[];
+# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
+ extern int _end[];
+# define DATAEND (_end)
+# ifdef STACK_GRAN
+# undef STACK_GRAN
+# endif /* STACK_GRAN */
+# define STACK_GRAN 0x10000
+# define HEURISTIC1
+# ifdef USE_MMAP
+# undef USE_MMAP
+# endif
+# ifdef USE_MUNMAP
+# undef USE_MUNMAP
+# endif
+# ifdef USE_MMAP_ANON
+# undef USE_MMAP_ANON
+# endif
+# ifdef USE_MMAP_FIXED
+# undef USE_MMAP_FIXED
+# endif
+# define GETPAGESIZE() 65536
+# define MAX_NACL_GC_THREADS 1024
+# endif
# ifdef LINUX
# ifndef __GNUC__
/* The Intel compiler doesn't like inline assembly */
@@ -2271,7 +2307,7 @@
# if defined(GC_IRIX_THREADS) && !defined(IRIX5)
--> inconsistent configuration
# endif
-# if defined(GC_LINUX_THREADS) && !defined(LINUX)
+# if defined(GC_LINUX_THREADS) && !(defined(LINUX) || defined(NACL))
--> inconsistent configuration
# endif
# if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
diff --git a/libgc/include/private/pthread_stop_world.h b/libgc/include/private/pthread_stop_world.h
index 054c7a0eacd..bd72739f580 100644
--- a/libgc/include/private/pthread_stop_world.h
+++ b/libgc/include/private/pthread_stop_world.h
@@ -7,6 +7,15 @@ struct thread_stop_info {
/* last successfully handled a suspend */
/* signal. */
ptr_t stack_ptr; /* Valid only when stopped. */
+#ifdef NACL
+/* Grab NACL_GC_REG_STORAGE_SIZE pointers off the stack when going into */
+/* a syscall. 20 is more than we need, but it's an overestimate in case*/
+/* the instrumented function uses any callee saved registers, they may */
+/* be pushed to the stack much earlier. Also, on amd64 'push' puts 8 */
+/* bytes on the stack even though our pointers are 4 bytes. */
+#define NACL_GC_REG_STORAGE_SIZE 20
+ ptr_t reg_storage[NACL_GC_REG_STORAGE_SIZE];
+#endif
};
#endif
diff --git a/libgc/include/private/pthread_support.h b/libgc/include/private/pthread_support.h
index 852d3815bc6..dbd6dbcde89 100644
--- a/libgc/include/private/pthread_support.h
+++ b/libgc/include/private/pthread_support.h
@@ -92,6 +92,9 @@ typedef struct GC_Thread_Rep {
# define THREAD_TABLE_SZ 128 /* Must be power of 2 */
extern volatile GC_thread GC_threads[THREAD_TABLE_SZ];
+#ifdef NACL
+extern __thread GC_thread gc_thread_self;
+#endif
extern GC_bool GC_thr_initialized;