From: Elijah Taylor Date: Tue, 9 Aug 2011 20:03:46 +0000 (+0200) Subject: More NACL updates X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=756af50efc443752da4947b9b6c6fdf3593277e5;p=gc More NACL updates --- diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 8ff4fbfb..0d28d986 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -1202,7 +1202,8 @@ # ifdef NACL # define OS_TYPE "NACL" extern int etext[]; -# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) +//# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) +# define DATASTART ((ptr_t)0x10000000) extern int _end[]; # define DATAEND (_end) # ifdef STACK_GRAN diff --git a/pthread_stop_world.c b/pthread_stop_world.c index b1f98099..3819693c 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -461,6 +461,7 @@ static void pthread_stop_world() #else /* NACL */ GC_thread p; int i; + int num_sleeps = 0; #if DEBUG_THREADS GC_printf1("pthread_stop_world: num_threads %d\n", nacl_num_gc_threads - 1); @@ -470,6 +471,7 @@ static void pthread_stop_world() while (1) { #define NACL_PARK_WAIT_NANOSECONDS 100000 + #define NANOS_PER_SECOND 1000000000 int num_threads_parked = 0; struct timespec ts; int num_used = 0; @@ -491,6 +493,10 @@ static void pthread_stop_world() GC_printf1("sleeping waiting for %d threads to park...\n", nacl_num_gc_threads - num_threads_parked - 1); #endif nanosleep(&ts, 0); + if (++num_sleeps > NANOS_PER_SECOND / NACL_PARK_WAIT_NANOSECONDS) { + GC_printf1("GC appears stalled waiting for %d threads to park...\n", nacl_num_gc_threads - num_threads_parked - 1); + num_sleeps = 0; + } } #endif /* NACL */ diff --git a/pthread_support.c b/pthread_support.c index 96e8a011..4b3d825f 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -688,9 +688,14 @@ extern pthread_mutex_t nacl_thread_alloc_lock; extern __thread int nacl_thread_idx; extern __thread GC_thread nacl_gc_thread_self; +extern void nacl_pre_syscall_hook(); +extern void nacl_post_syscall_hook(); +extern void nacl_register_gc_hooks(void (*pre)(), void (*post)()); + void nacl_initialize_gc_thread() { int i; + nacl_register_gc_hooks(nacl_pre_syscall_hook, nacl_post_syscall_hook); pthread_mutex_lock(&nacl_thread_alloc_lock); if (!nacl_thread_parking_inited) {