# 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
#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);
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;
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 */
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)
{